WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
324706
[WebDriver][BiDi] browsingContext.contextDestroyed should report the destroyed subtree in a single event with a spec-shaped payload
https://bugs.webkit.org/show_bug.cgi?id=324706
Summary
[WebDriver][BiDi] browsingContext.contextDestroyed should report the destroye...
Timothy Olusanya
Reported
2026-09-21 07:13:50 PDT
Split out of
bug 288336
(browsingContext.contextDestroyed). The event is already emitted, but its payload does not follow "get the navigable info": - `children` is always an empty array. The spec builds the payload with a null max depth, i.e. the whole child tree, and a destroyed navigable with descendants is reported once, with them inside. WPT: test_nested_iframes_delete_top_iframe and test_iframe_destroy_parent expect one event with children=1. - `parent` and `originalOpener` are sent as the string "null" instead of JSON null, so every assert_browsing_context() with parent=None or original_opener=None fails. - `clientWindow` differs from what browsingContext.getTree reports for the same context (covered separately by
bug 303210
). - A frame's handle is discarded when the main frame finishes loading, even for frames of the new document, so the id announced by contextCreated no longer matches later ids, and the destroy event is dropped unless the client called getTree in between. Cause of the missing subtree: WebCore detaches child frames before their parent (FrameLoader::detachFromParent() calls detachChildren() first), so by the time the UI process learns that a frame is gone, its subtree has already been torn down. Reporting the subtree needs a notification before the children are detached. Proposed change: 1. A LocalFrameLoaderClient::willDetachFromParent() hook called before detachChildren(); WebKit sends FrameWillBeDetached to the UI process for automation-controlled pages. 2. The automation session builds the event from the UI-process frame tree (full depth), records the descendants so they do not emit again, and reports a closed page once with its whole tree. 3. JSON null for parent/originalOpener. Interim: those two event parameters are typed "any" until the protocol generator supports nullable event parameters (
bug 310157
). 4. Keep the handles of frames that are still attached when the main frame finishes loading. Out of scope here, still tracked by
bug 288336
and its dependencies: delivery to subscriptions scoped by context or by user context (
bug 282981
,
bug 309502
), contexts created inside a user context (
bug 286790
), and originalOpener coverage, which needs window.open() to create a browsing context under WebKitGTK automation. Tests: imported/w3c/webdriver/tests/bidi/browsing_context/context_destroyed/context_destroyed.py Tools/TestWebKitAPI/Tests/WebKitGLib/TestAutomationSession.cpp Spec:
https://w3c.github.io/webdriver-bidi/#event-browsingContext-contextDestroyed
https://w3c.github.io/webdriver-bidi/#get-the-navigable-info
Attachments
Add attachment
proposed patch, testcase, etc.
Timothy Olusanya
Comment 1
2026-09-21 08:52:22 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/74498
Radar WebKit Bug Importer
Comment 2
2026-09-28 07:14:15 PDT
<
rdar://problem/188588833
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug