Fix window.atob/window.btoa runtime crashes under Node#1949
Fix window.atob/window.btoa runtime crashes under Node#1949batbone wants to merge 1 commit intoChromeDevTools:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
This fix is trivial and does not CLA. |
|
what chrome-devtools-mcp version are you seeing this with? |
|
I have fixed the specific occurrence upstream https://crrev.com/c/7790303 I think this code should not be running in the latest mcp server version and I was not able to reproduce it on a page with sse streams. |
Summary
globalThis.windowalias before vendored DevTools/Lighthouse runtime paths executeReferenceError: window is not definedwhen runtime code callswindow.atob/window.btoaContext
The published
chrome-devtools-mcpbundle currently includes vendored runtime code paths that callwindow.atobandwindow.btoaeven when the MCP server is running under Node.js. In that environment, Node provides globalatob/btoa, but not a browserwindowobject, which causes crashes during affected flows (for example SSE parsing through the MCP transport).This patch keeps the fix narrow by exposing
globalThis.window = globalThiswhenwindowis otherwise absent, so those vendored runtime calls resolve correctly in Node.Here is the original error: