Skip to content

fix: renderer crash after IPC to a window.open() child with its own contextIsolation - #53541

Merged
MarshallOfSound merged 1 commit into
42-x-yfrom
window-open-ci-env-42-x-y
Sep 4, 2026
Merged

fix: renderer crash after IPC to a window.open() child with its own contextIsolation#53541
MarshallOfSound merged 1 commit into
42-x-yfrom
window-open-ci-env-42-x-y

Conversation

@MarshallOfSound

Copy link
Copy Markdown
Member

Backport of #53535

See that PR for details. The only conflict was the include block in shell/renderer/electron_render_frame_observer.cc (this branch does not have <utility> and <vector> there).

Notes: Fixed a renderer crash when the main process sent IPC to, or a page navigated, a same-process window.open() child whose contextIsolation differed from its opener's.

…ontextIsolation (#53535)

A window.open() child of an opener with contextIsolation: false gets
contextIsolation: true unless the handler overrides it, but its synchronous
about:blank document starts with the opener's WebPreferences. Its Node.js
environment is therefore created in the main world. Once the browser sends
the child's own preferences, the observer and GetContext() pick the isolated
world instead, so the first IPC message to the child created a context there
and hit CHECK(!environments_.contains(render_frame)). Navigating such a child
skipped the release of its environment for the same reason.

Record the world of each frame's environment when it is created. While the
environment exists, only that world is notified of context creation and
release, and GetContext() returns the environment's context, so IPC reaches
the preload that ran in it.

(cherry picked from commit 5856ddc)
@MarshallOfSound MarshallOfSound added backport This is a backport PR semver/patch backwards-compatible bug fixes 42-x-y labels Sep 4, 2026
@electron-cation electron-cation Bot added new-pr 🌱 PR opened recently and removed new-pr 🌱 PR opened recently labels Sep 4, 2026
@MarshallOfSound
MarshallOfSound enabled auto-merge (squash) September 4, 2026 19:45
@MarshallOfSound MarshallOfSound self-assigned this Sep 4, 2026
@MarshallOfSound
MarshallOfSound merged commit eaba829 into 42-x-y Sep 4, 2026
99 checks passed
@MarshallOfSound
MarshallOfSound deleted the window-open-ci-env-42-x-y branch September 4, 2026 20:43
@release-clerk

release-clerk Bot commented Sep 4, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed a renderer crash when the main process sent IPC to, or a page navigated, a same-process window.open() child whose contextIsolation differed from its opener's.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

42-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants