fix(webview): allow service worker via CSP worker-src#1016
Conversation
This unblocks webview loading when VS Code fails service worker registration with InvalidStateError. Co-authored-by: smolpaws <engel@enyst.org>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe CSP configuration in Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the Content Security Policy (CSP) in src/webview/getWebviewHtml.ts to explicitly allow service workers by adding the worker-src directive. Feedback indicates that the CSP is currently missing a connect-src directive; since default-src is set to 'none', network operations such as fetch and WebSocket will be blocked unless connect-src is explicitly defined.
🔧 VSCode Extension Built Successfully• File: openhands-tab-0.9.3.vsix (548 KB) To install:
Built with Node 22. Commit a28f1c9. |
What
Add
worker-srcto the webview Content-Security-Policy so VS Code can register the webview service worker.Why
Without
worker-src, the webview can fail to load with:Summary by CodeRabbit
Release Notes