MarshallOfSound

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

Merged
Created: Sep 18, 2026, 8:20:51 AM
Merged: Sep 18, 2026, 11:04:55 AM
6 comments
Target: main

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.

Backports

42-x-y
Merged
PR Number
#54098
Merged At
Sep 18, 2026, 12:06:55 PM
Released In
Not yet
Release Date
Not yet
43-x-y
Merged
PR Number
#54097
Merged At
Sep 18, 2026, 12:08:53 PM
Released In
Not yet
Release Date
Not yet
44-x-y
Merged
PR Number
#54099
Merged At
Sep 18, 2026, 12:07:48 PM
Released In
Not yet
Release Date
Not yet
45-x-y
Merged
PR Number
#54096
Merged At
Sep 18, 2026, 12:11:13 PM
Released In
Not yet
Release Date
Not yet

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

Semantic Versioning helps users understand the impact of updates:

  • Major (X.y.z): Breaking changes that may require code modifications
  • Minor (x.Y.z): New features that maintain backward compatibility
  • Patch (x.y.Z): Bug fixes that don't change the API
  • None: Changes that don't affect using facing parts of Electron