Skip to content

fix: removing a loaded <webview> threw "Invalid guestInstanceId" - #54089

Merged
jkleinsc merged 1 commit into
mainfrom
claude/project-thread-5hx84y
Sep 18, 2026
Merged

jkleinsc merged 1 commit into
mainfrom
claude/project-thread-5hx84y

Conversation

@MarshallOfSound

@MarshallOfSound MarshallOfSound commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

Description of Change

Before: removing a <webview> whose guest had loaded threw Uncaught Error: Invalid guestInstanceId: N out of the element's disconnectedCallback, and because the throw skipped the element reset, re-inserting that <webview> never created a new guest.

After: the element is removed (and can be re-inserted) with no error, as it was before #53684.

Removing the element tears down its internal iframe first, which destroys the guest and drops it from guestInstances; disconnectedCallback then sends GUEST_VIEW_MANAGER_DETACH_GUEST for an id that is already gone. #53684 put getGuestForFrame() in front of detachGuest(), and it throws for an unknown id.

How: the detach handler returns early when the id is no longer in guestInstances — the no-op detachGuest() always did for that case — and keeps the sender-frame check for live guests.

Fixes #53989.

Checklist

Release Notes

Notes: Fixed an "Invalid guestInstanceId" error when removing a loaded <webview> from the DOM.

Removing a <webview> from the DOM tears down its internal iframe first,
which destroys the guest and drops it from guestInstances. The element's
disconnectedCallback then sends GUEST_VIEW_MANAGER_DETACH_GUEST for that
id. Since #53684 the handler validates the id with getGuestForFrame()
before detaching, so the already-gone guest made the sync IPC throw back
into disconnectedCallback. The uncaught error also skipped the element's
reset, so a removed <webview> that was re-inserted never got a new guest.

Treat a detach for an unknown guest as a no-op again (as detachGuest()
always did) and keep the sender-frame check for live guests.

Fixes #53989.
@MarshallOfSound
MarshallOfSound requested a review from a team as a code owner September 18, 2026 15:20
@release-clerk

release-clerk Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Release note looks good now.

@MarshallOfSound MarshallOfSound added semver/patch backwards-compatible bug fixes target/45-x-y PR should also be added to the "45-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. target/43-x-y PR should also be added to the "43-x-y" branch. target/42-x-y PR should also be added to the "42-x-y" branch. labels Sep 18, 2026
@MarshallOfSound MarshallOfSound self-assigned this Sep 18, 2026

@jkleinsc jkleinsc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jkleinsc
jkleinsc enabled auto-merge (squash) September 18, 2026 17:42
@jkleinsc
jkleinsc merged commit 03ce8ca into main Sep 18, 2026
108 checks passed
@jkleinsc
jkleinsc deleted the claude/project-thread-5hx84y branch September 18, 2026 18:04
@release-clerk

release-clerk Bot commented Sep 18, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed an "Invalid guestInstanceId" error when removing a loaded &lt;webview&gt; from the DOM.

@trop

trop Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "45-x-y", please check out #54096

@trop

trop Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "43-x-y", please check out #54097

@trop trop Bot removed the target/45-x-y PR should also be added to the "45-x-y" branch. label Sep 18, 2026
@trop

trop Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "42-x-y", please check out #54098

@trop

trop Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "44-x-y", please check out #54099

@trop trop Bot added in-flight/43-x-y in-flight/42-x-y in-flight/44-x-y and removed target/43-x-y PR should also be added to the "43-x-y" branch. labels Sep 18, 2026
@trop trop Bot added merged/42-x-y PR was merged to the "42-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. merged/43-x-y PR was merged to the "43-x-y" branch. merged/45-x-y PR was merged to the "45-x-y" branch. and removed target/42-x-y PR should also be added to the "42-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. in-flight/42-x-y in-flight/44-x-y in-flight/43-x-y in-flight/45-x-y labels Sep 18, 2026
m-tabaza added a commit to opencx-labs/catamorphic that referenced this pull request Oct 9, 2026
* Electron 45 beta so Google's sign-in accepts Work again

Chrome 156 is stable and Google's sign-in now refuses Work ("This browser
or app may not be secure"). Every Electron 44 release, 44.7.0 included,
carries Chromium 152; Electron 45.0.0-beta.1 carries Chromium
156.0.8078.12. The app already presents as plain Chrome, so the engine
version was the gap. The beta is pinned exactly.

- Screen sharing: Electron 45 reports getDisplayMedia to the permission
  handler as display-capture instead of media with no media types. The
  share picker now runs on display-capture, a granted share keeps the
  page awake as before, and media maps only to camera and microphone.
- Electron 45.0.0-beta.1 carries the Invalid guestInstanceId fix
  (electron/electron#54089, backport #54096), so the renderer guard and
  the e2e harness filter are gone (ADR 0150, TODO.md).
- node-abi 4.37.0 in the lockfile so @electron/rebuild maps Electron 45
  to its ABI (150); 4.33.0 reported 149.
- ADR 0150 records the upgrade and why; DESIGN.md entry for 2026-10-09.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Present Chrome's reduced user agent, and check what a page sees

Chrome's user agent names only its major version (Chrome/156.0.0.0);
Electron's carries the full one, which no Chrome sends. The fallback UA now
reduces it, and the full-version client hint takes the engine's real
version from process.versions.chrome instead of the UA.

browser-identity.e2e.ts checks a page's view: the request's User-Agent,
and in JavaScript the user agent, its brands and the full version list.
TODO.md records the stable pin and the async safeStorage follow-up.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Build Chrome's brand list the way Chromium does, and record the gaps

The placeholder brand was Chrome 150's ("Not;A=Brand") in a fixed order.
shared/chrome-brands.ts builds the list as Chromium's
GetGreasedUserAgentBrandVersion does, seeded by the major version, so
Chrome 156 is "Not:A-Brand";v="8", "Chromium";v="156",
"Google Chrome";v="156" in the header, navigator.userAgentData.brands
and its toJSON() alike (toJSON read Chromium's own list). Main and the
preload share it, from process.versions.chrome.

ADR 0150 and DESIGN.md record the reduced user agent and that headers are
not a full match (page loads carry no client hints). TODO.md: the
safeStorage entry covers isEncryptionAvailable and Electron 46's removal;
new follow-ups for page-load client hints and the legacy chromeMediaSource
capture path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

46-x-y merged/42-x-y PR was merged to the "42-x-y" branch. merged/43-x-y PR was merged to the "43-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. merged/45-x-y PR was merged to the "45-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

removing a loaded webview throws uncaught Invalid guestInstanceId in disconnectedCallback

2 participants