Closed Bug 1892411 Opened 2 years ago Closed 1 year ago

Debugger doesn't break in late breakpoint for destroyed iframes

Categories

(DevTools :: Debugger, defect, P2)

defect

Tracking

(firefox141 fixed)

RESOLVED FIXED
141 Branch
Tracking Status
firefox141 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

(Depends on 1 open bug, Blocks 2 open bugs)

Details

Attachments

(2 external files, 2 obsolete files)

Nicolas highlighted various cases of breakpoints being not functional when setting them on late event fired while the iframe is being destroyed.
See bug 1887852 comment 5.

STR:

None of them are pausing the debugger, while these listeners actually run.

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 destroying the target actor too early and was redundant with the code
managing WindowGlobal target actor lifecycle in the WindowGlobal Target Watcher class.

Also, in WindowGlobalTargetActor.window getter, we shouldn't ignore docshell that are being destroyed,
they are still valid when hitting a late breakpoint.

Severity: -- → S3
Priority: -- → P2

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)

See Also: → 1898490
Assignee: nobody → poirot.alex
Status: NEW → ASSIGNED
Depends on: 1903980

Comment on attachment 9398388 [details]
Bug 1892411 - [devtools] Use a fixed innerWindowId for WindowGlobal Target Actor.

Revision D208497 was moved to bug 1903980. Setting attachment 9398388 [details] to obsolete.

Attachment #9398388 - Attachment is obsolete: true

Comment on attachment 9397535 [details]
Bug 1892411 - [devtools] Only observe children docshell in browser toolbox and web extension targets.

Revision D207801 was moved to bug 1903980. Setting attachment 9397535 [details] to obsolete.

Attachment #9397535 - Attachment is obsolete: true

The webnavigation-destroy / DocShell destruction was too early as it fired before the iframe unload listener are fired.

See Also: 1898490 →
Depends on: 1904788
Attachment #9408835 - Attachment description: Bug 1892411 - [devtools] Destroy WindowGlobalTarget actor late at inner-window-destroyed to support late unload breakpoint in iframes. → Bug 1892411 - [devtools] Prevent listening to all docshells events unless the window global target is the parent process one.
Attachment #9408835 - Attachment description: Bug 1892411 - [devtools] Prevent listening to all docshells events unless the window global target is the parent process one. → WIP: Bug 1892411 - [devtools] Prevent listening to all docshells events unless the window global target is the parent process one.

I rebased this old patch, this is actually a non trivial task. Delaying the WindowGlobal Target destruction actually cause various race conditions.
The worst I'm still struggling with is the fact that some late resources are being lost on navigation as they are now bound to the WindowGlobal we navigate away which is destroyed slightly later on navigation. It looks like such later resource are currently attached to the new WindowGlobal we navigate to.

Blocks: 1831186
Attachment #9408835 - Attachment description: WIP: Bug 1892411 - [devtools] Prevent listening to all docshells events unless the window global target is the parent process one. → Bug 1892411 - [devtools] Prevent listening to all docshells events unless the window global target is the parent process one. r=#devtools

Cross platform try looks green enough, but we have quite a few intermittents:
https://treeherder.allizom.org/jobs?repo=try&revision=a862ab8b9072b15222d38e11be9444c422199ca0

Pushed by apoirot@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/c5c108a58fcf https://hg.mozilla.org/integration/autoland/rev/7e3925807d9e [devtools] Prevent listening to all docshells events unless the window global target is the parent process one. r=devtools-reviewers,bomsy https://github.com/mozilla-firefox/firefox/commit/ca0f36b9594f https://hg.mozilla.org/integration/autoland/rev/4e2da99404ac [devtools] Remove now unused Web extension related workaround. r=devtools-reviewers,bomsy
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 141 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: