electron/patches/devtools_frontend
trop[bot] 270c9e7ce9
fix: prefer browser runtime over node in DevTools HostRuntime detection (#50274)
Upstream DevTools' HostRuntime checks `IS_NODE` before `IS_BROWSER` when
selecting the platform runtime. In Electron, `process` is available in
renderer processes, so `IS_NODE` evaluates to `true` in the DevTools
context. This causes DevTools to dynamically import the Node.js platform
runtime, which uses `node:worker_threads`. DevTools Web Workers running
under the `devtools://` protocol cannot load Node.js built-in modules,
so the import fails and breaks features like the formatter worker.

Fix by swapping the check order to prefer `IS_BROWSER` when both are
true. This is safe because in pure Node.js environments (the only case
where the node runtime is needed), `window` and `self` are both
undefined, so `IS_BROWSER` is always `false` regardless of check order.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2026-03-16 14:41:51 +01:00
..
.patches fix: prefer browser runtime over node in DevTools HostRuntime detection (#50274) 2026-03-16 14:41:51 +01:00
chore_expose_ui_to_allow_electron_to_set_dock_side.patch chore: bump chromium to 147.0.7727.0 (main) (#50115) 2026-03-10 23:14:36 -04:00
fix_prefer_browser_runtime_over_node_in_hostruntime_detection.patch fix: prefer browser runtime over node in DevTools HostRuntime detection (#50274) 2026-03-16 14:41:51 +01:00