[miniflare] Add local simulation for browser rendering devtools endpo…#13025
[miniflare] Add local simulation for browser rendering devtools endpo…#13025ruifigueira wants to merge 5 commits intomainfrom
Conversation
🦋 Changeset detectedLatest commit: e2636b6 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
There was a problem hiding this comment.
I'm Bonk, and I've done a quick review of your PR.
This PR adds local simulation for browser rendering devtools endpoints in miniflare, implementing ~15 new route handlers that proxy Chrome's DevTools JSON and WebSocket endpoints.
Issues
- Bug:
proxyPageWebSocketwill throw on reserved WebSocket close codes — The existingBrowserSession.fetchmethod has aforwardClosehelper (line 92-99) that guards against reserved close codes 1005 and 1006 which throwInvalidAccessErrorwhen passed toWebSocket.close(). The newproxyPageWebSocketfunction directly forwardscodeandreasonwithout this guard, so any Chrome page connection that closes with code 1005 or 1006 will crash the proxy.
| server.addEventListener("close", ({ code, reason }) => ws.close(code, reason)); | ||
| ws.addEventListener("close", ({ code, reason }) => server.close(code, reason)); |
There was a problem hiding this comment.
Reserved close codes 1005 (No Status Received) and 1006 (Abnormal Closure) are valid in CloseEvent but throw InvalidAccessError when passed to .close(). The existing BrowserSession.fetch already handles this (see forwardClose at line 92). This proxy should do the same.
| server.addEventListener("close", ({ code, reason }) => ws.close(code, reason)); | |
| ws.addEventListener("close", ({ code, reason }) => server.close(code, reason)); | |
| server.addEventListener("close", ({ code, reason }) => { | |
| if (code === 1005 || code === 1006) { | |
| ws.close(); | |
| } else { | |
| ws.close(code, reason); | |
| } | |
| }); | |
| ws.addEventListener("close", ({ code, reason }) => { | |
| if (code === 1005 || code === 1006) { | |
| server.close(); | |
| } else { | |
| server.close(code, reason); | |
| } | |
| }); |
|
I'm Bonk, and I've done a quick review of your PR. This PR adds local simulation for browser rendering devtools endpoints in miniflare, implementing ~15 new route handlers that proxy Chrome's DevTools JSON and WebSocket endpoints. Issue found: The new |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
7c3a803 to
5b74cc2
Compare
5b74cc2 to
e2636b6
Compare
…ints
Fixes #[insert GH or internal issue link(s)].
Describe your change...
A picture of a cute animal (not mandatory, but encouraged)