Blank DevTools when closing them while iframe is being destroyed
Categories
(DevTools :: General, defect, P2)
Tracking
(firefox129 verified, firefox130 verified)
People
(Reporter: ochameau, Assigned: ochameau)
References
(Blocks 2 open bugs)
Details
Attachments
(4 files)
STR:
- open any Google Doc or this stress test page
data:text/html,<script>setInterval(()=>{document.body.innerHTML="";let iframe=document.createElement("iframe"); iframe.src="data:text/html,foo"; document.body.appendChild(iframe); },0);</script>
- close and reopen devtools during google doc loading, or any time with the stress test
You will see the devtools become blank on closing with NS_ERROR_NOT_AVAILABLE) [nsIDocShell.domWindow]
exception in stdout.
You then have to close the tab and reopen your debugged page in a new tab to be able to get functional devtools again.
Assignee | ||
Updated•8 months ago
|
Assignee | ||
Comment 1•8 months ago
|
||
The innerWindowId
is used as an identifier for frame targets.
It ought to be unique and stable for a given target actor as this is used
in Resource forms as identifier for targets.
Also, getting a live getter may throw when accessing the window object's innerWindowId
when the document starts being destroyed (on iframe unload), but there is still relevant debugging
to be done against the WindowGlobal.
The checks in WindowGlobal Target Watchers were brittle as they were relying on the fact that
the WindowGlobalTargetActor's innerWindowId would be updated to the new WindowGlobal ID
when the BrowsingContext navigated to a new document. The findTargetActor
method now uses
BrowsingContext ID to lookup for any existing Target Actor for the current BrowsingContext.
(this still uses WG innerWindowId for WG destruction codepath)
Assignee | ||
Comment 2•8 months ago
|
||
The docshell should be observed only when "EveryFrameTarget" is off for the WindowGlobal Target Actor.
i.e. when followWindowGlobalLifeCycle
is false and the target actor manages more than one WindowGlobal.
This docshell observing was redundant with the code managing WindowGlobal target actor lifecycle in the WindowGlobal Target Watcher class.
Make the watcher class use the same event, docshell destruction == webnavigation-destroy,
as that is fired earlier than inner-window-destroyed.
Bug 1892411 will followup to use back the late inner-window-destroyed event and fix late breakpoints.
Before this patch, inner-window-destroyed event listener wasn't useful as the WindowGlobalTargetActor was self destroying itself
via its internal webnavigation-destroy event.
Assignee | ||
Comment 3•8 months ago
|
||
Without the previous changeset, DevTools may become blank and require to close the tab to be functional again.
Assignee | ||
Comment 4•8 months ago
|
||
Assignee | ||
Comment 5•8 months ago
|
||
DAMP results (no particular impact):
https://treeherder.mozilla.org/perfherder/comparesubtest?originalProject=try&newProject=try&newRevision=abb597203ba167018be6317be1f4c6f8c3699480&originalSignature=4763542&newSignature=4763542&framework=12&application=firefox&originalRevision=2f8fa03dc10290e5cb7253b22c87bdacd5cfc19d&page=1&showOnlyConfident=1
Comment 7•8 months ago
|
||
Backed out for causing mochitests failures in browser_ext_devtools_inspectedWindow_targetSwitch.js.
- Backout link
- Push with failures
- Failure Log
- Failure line: TEST-UNEXPECTED-FAIL | browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow_targetSwitch.js | Test timed out -
Assignee | ||
Comment 8•8 months ago
|
||
WindowGlobalTarget actors are currently being destroyed via
the docshell listeners registered by the WindowGlobalTargetActor class (_watchDocShells).
This is a bit unexpected as the WindowGlobal Watcher Class is meant to
handle the lifecycle (creation and destruction) of these actors.
On top of that, this docshell listener code (_watchDocShells) isn't really
meant to be executed. It's main goal is to implement the non-EFT(EveryFrameTarget)
codepath, where the WindowGlobalTarget actor may be focusing on more than one
WindowGlobal/document instance.
The situation here is that this code throws on creation as well as destruction,
leading to a broken target actor still registered in TargetRegistry/ContentProcessWatcherRegistry.
Comment 10•8 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/1de44f760746
https://hg.mozilla.org/mozilla-central/rev/1ec92334e400
Updated•8 months ago
|
Comment 11•8 months ago
|
||
Reproducible on a 2024-06-21 Nightly build on Windows 10.
Verified as fixed on Firefox 129.0b2 and Firefox Nightly 130.0a1 on Windows 10, Ubuntu 22, macOS 14.
Assignee | ||
Updated•1 month ago
|
Description
•