Closed Bug 1810009 Opened 1 year ago Closed 1 year ago

Navigating a tab breaks the Browser Toolbox in Parent Process mode

Categories

(DevTools :: Framework, defect, P2)

defect

Tracking

(firefox-esr102 unaffected, firefox108 unaffected, firefox109 unaffected, firefox110 verified, firefox111 verified)

VERIFIED FIXED
111 Branch
Tracking Status
firefox-esr102 --- unaffected
firefox108 --- unaffected
firefox109 --- unaffected
firefox110 --- verified
firefox111 --- verified

People

(Reporter: jdescottes, Assigned: ochameau)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files, 1 obsolete file)

STRs:

  • open the Browser Toolbox
  • select Parent Process mode
  • navigate or reload any tab in Firefox

ER: Browser Toolbox should not be severely affected
AR: Inspector becomes blank, debugger sources disappear etc...

Set release status flags based on info from the regressing bug 1772823

:ochameau, since you are the author of the regressor, bug 1772823, could you take a look? Also, could you set the severity field?

For more information, please visit auto_nag documentation.

Flags: needinfo?(poirot.alex)
Keywords: regression

It seems that the will-navigate resources emitted by tabs are associated with a top-level target.

I think the issue is that we emit will-navigate as a parent process resource, from the watcher.

We trust resource-command to find which "target" this will-navigate corresponds to based on the browsingContextId in the resource.
However, in "parent-process" mode, we don't have a target created for individual window globals, so we fallback on the only available target: the parent process one.

In the long run I think this would be addressed by switching back to targetAvailable instead of will-navigate.

Edit: Specifically, we are retrieving the wrong target at https://searchfox.org/mozilla-central/rev/b19830c6b22f73758862d34d2c64f57735890e90/devtools/client/fronts/watcher.js#159-167. This fallback mechanism might not make sense with EFT enabled? With EFT, if we can't get a target for a given browsing context id, it means it is out of scope. But maybe here we should rather fix the server to avoid emitting will-navigate at all in this configuration

The legacy listener was explicitely avoiding emitting this event for non top-level targets.
It seems like all frontend code listening to will-navigate ignore the event is targetFront.isTopLevel is false,
so it looks like no code would expect these event.
So let's try to avoid emitting them if they aren't used by anyone.
(and can be confusing/buggy in the context of the browser toolbox)

Assignee: nobody → poirot.alex
Status: NEW → ASSIGNED

(In reply to Julian Descottes [:jdescottes] from comment #3)

I think the issue is that we emit will-navigate as a parent process resource, from the watcher.

We trust resource-command to find which "target" this will-navigate corresponds to based on the browsingContextId in the resource.
However, in "parent-process" mode, we don't have a target created for individual window globals, so we fallback on the only available target: the parent process one.

In the long run I think this would be addressed by switching back to targetAvailable instead of will-navigate.

Edit: Specifically, we are retrieving the wrong target at https://searchfox.org/mozilla-central/rev/b19830c6b22f73758862d34d2c64f57735890e90/devtools/client/fronts/watcher.js#159-167. This fallback mechanism might not make sense with EFT enabled? With EFT, if we can't get a target for a given browsing context id, it means it is out of scope. But maybe here we should rather fix the server to avoid emitting will-navigate at all in this configuration

+1, hopefully making the browser toolbox use EFT will later fix all similar issues!

The legacy listener was filtering out events for non-top-level targets:
https://searchfox.org/mozilla-central/rev/b19830c6b22f73758862d34d2c64f57735890e90/devtools/shared/commands/resource/resource-command.js#1237-1240
Whereas the resource watcher isn't doing so, it emits will-navigate for all "process root" targets,
so tabs and top documents of cross origin iframes.
https://searchfox.org/mozilla-central/rev/b19830c6b22f73758862d34d2c64f57735890e90/devtools/server/actors/resources/parent-process-document-event.js#111,126
It isn't clear why I let it be emitted for non-top level target. I assume it is just a mistake?

Flags: needinfo?(poirot.alex)
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/57ac7060ddf0
[devtools] Avoid firing DOCUMENT_EVENT will-navigate for non-top-level targets. r=devtools-reviewers,jdescottes
https://hg.mozilla.org/integration/autoland/rev/8f4d3ce7f581
[devtools] Add test navigating a tab while BrowserToolbox is open r=devtools-reviewers,nchevobbe

Sorry, I had a typo in the last changeset.
Here is a new try run:
https://treeherder.mozilla.org/jobs?repo=try&revision=2c464bcf68d338a51a7cbab26ea71978f18958b6

Flags: needinfo?(poirot.alex)

(In reply to Julian Descottes [:jdescottes] from comment #10)

I think you meant https://treeherder.mozilla.org/jobs?repo=try&revision=e07cba3ec16b81b3855f6ba5ffb417c220285167

Yes, thanks, that other try is very orange!

Pushed by apoirot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d9bcb8862497
[devtools] Avoid firing DOCUMENT_EVENT will-navigate for non-top-level targets. r=devtools-reviewers,jdescottes
https://hg.mozilla.org/integration/autoland/rev/ee636c21fe18
[devtools] Add test navigating a tab while BrowserToolbox is open r=devtools-reviewers,nchevobbe

Odd I didn't have any failure for this platform on any of my try builds. This starts to be complicated to land, so let's split the test to another bug. I will reland the patch from Alex.

Flags: needinfo?(poirot.alex)
Blocks: 1810622

Comment on attachment 9312199 [details]
Bug 1810009 - [devtools] Add test navigating a tab while BrowserToolbox is open

Revision D166796 was moved to bug 1810622. Setting attachment 9312199 [details] to obsolete.

Attachment #9312199 - Attachment is obsolete: true
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6126dcd64f4f
[devtools] Avoid firing DOCUMENT_EVENT will-navigate for non-top-level targets. r=devtools-reviewers,jdescottes

Backed out for causing dt failures in browser_resources_document_events.js.

  • Backout link
  • Push with failures
  • Failure Log
  • Failure line: TEST-UNEXPECTED-FAIL | devtools/shared/commands/resource/tests/browser_resources_document_events.js | Uncaught exception in test - at chrome://mochitests/content/browser/devtools/client/shared/test/shared-head.js:1050 - Error: Failed waitFor():
Flags: needinfo?(poirot.alex)

(In reply to Julian Descottes [:jdescottes] from comment #17)

(In reply to Sandor Molnar from comment #13)

Backed out for causing dt failures in

devtools/client/framework/browser-toolbox/test/browser_browser_toolbox_navigate_tab.js

Backout link: https://hg.mozilla.org/integration/autoland/rev/2746049e45c5ffd3f3907aeb0a7013bcca616ef7

Push with failures

Failure log: TEST-UNEXPECTED-FAIL | devtools/client/framework/browser-toolbox/test/browser_browser_toolbox_navigate_tab.js | The remote debugger process died cleanly - Got 11, expected +0

That link was only showing failures, but there are also 3 green jobs on the same push/platform: https://treeherder.mozilla.org/jobs?repo=autoland&resultStatus=success%2Ctestfailed%2Cbusted%2Cexception%2Crunnable&searchStr=linux%2C18.04%2Cx64%2Cwebrender%2Copt%2Cdevtools%2Cmochitests%2Cwith%2Ceft%2Cwithout%2Cfission%2Cenabled%2Ctest-linux1804-64-qr%2Fopt-mochitest-devtools-chrome-dt-no-eft-nofis%2Cdt3&revision=ee636c21fe180e6c41a3061d1ce237042e011af2

The intermittent here "The remote debugger process died cleanly - Got 11, expected +0" already affects other tests from the same suite: eg https://bugzilla.mozilla.org/show_bug.cgi?id=1784636.

For reference, I had 0 failures on 10 retries over at https://treeherder.mozilla.org/jobs?repo=try&revision=5a825acafbdcb51646c3f70622e538050d8a4109 for the no eft no fis job

Now it's also perma failing ( it can be seen after backfills )

(In reply to sstanca from comment #19)

Now it's also perma failing ( it can be seen after backfills )

My comment was about the previous backout, for failures on browser_browser_toolbox_navigate_tab.js. I moved the test to another bug so I think your comment is rather about browser_resources_document_events.js.

(In reply to Julian Descottes [:jdescottes] from comment #20)

(In reply to sstanca from comment #19)

Now it's also perma failing ( it can be seen after backfills )

My comment was about the previous backout, for failures on browser_browser_toolbox_navigate_tab.js. I moved the test to another bug so I think your comment is rather about browser_resources_document_events.js.

Yes, sorry i didn't paid attention to that. Now it's permafailing on devtools/shared/commands/resource/tests/browser_resources_document_events.js

The failing test is only runnig on mac while I'm on linux and the try push I used was only running only linux tests.

Here is a new multiplatform try push:
https://treeherder.mozilla.org/jobs?repo=try&revision=366664760201d09498910684aa23f543c8d16000

Set release status flags based on info from the regressing bug 1772823

There is some intermittents, but they all look like known ones.
Trying to reland...

Flags: needinfo?(poirot.alex)
Pushed by apoirot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/002e6dd90553
[devtools] Avoid firing DOCUMENT_EVENT will-navigate for non-top-level targets. r=devtools-reviewers,jdescottes
Severity: -- → S3
Priority: -- → P2
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 111 Branch

The patch landed in nightly and beta is affected.
:ochameau, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox110 to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(poirot.alex)

Comment on attachment 9312130 [details]
Bug 1810009 - [devtools] Avoid firing DOCUMENT_EVENT will-navigate for non-top-level targets.

Beta/Release Uplift Approval Request

  • User impact if declined: The browser toolbox will clear all its content when any webpage navigates (unless the user manually changed it to be a multiprocess browser toolbox)

Requesting bug 1810622 to also be uplifted for test coverage.

  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: See comment 0
  • List of other uplifts needed: Bug 1810622
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): This should only impact the browser toolbox, which is an important tool to debug firefox, but shouldn't impact regular devtools.
  • String changes made/needed: no
  • Is Android affected?: No
Flags: needinfo?(poirot.alex)
Attachment #9312130 - Flags: approval-mozilla-beta?
Flags: qe-verify+
QA Whiteboard: [qa-triaged]
Attached image 1810009.gif

Reproduced the issue with Firefox 110.0a1 (2023-01-12) on Windows 10x64. Certain tabs inside the Browser Toolbox become blank after refreshing or navigating to a page while the Parent process is selected.
The issue is verified fixed with Firefox 111.0a1 (2023-01-18) on Windows 10x64, macOS 10.15, and Ubuntu 20.04. The tabs inside the Browser Toolbox are no longer becoming blank after refreshing or navigating to a page while the Parent process is selected.

However, while testing this I encountered two behaviors that still show a blank debugger tab after following certain steps. I cannot see the following issues with Firefox 109.0.

The first behavior will open an empty debugger after Firefox is opened with a new profile. STR:

  1. Open Firefox Nightly with a new profile.
  2. Open a new tab and a random webpage (e.g Wikipedia)
  3. Open Web developer tools and enable Browser Toolbox.
  4. Open the Browser toolbox and the Debugger tab.
    Actual result: Debbuger tab is empty on Firefox Nightly. The Debugger tab will be populated after closing and reopening the browser toolbox.

The second behavior will display an empty Debugger if the iframes are changed.

  1. Open the browser toolbox.
  2. Change between iframes.
    Actual result: Debugger content is erased until the browser toolbox is closed and reopened.

I have also attached a screen recording of the above-mentioned behaviors. Should we file new issues for this and close this one or this is expected? Thank you!

Flags: needinfo?(poirot.alex)

Thanks a lot Alexandru for the two reports, I opened bug 1811254 (recent regression) and bug 1811257 (not clear if that's a recent regression).

Flags: needinfo?(poirot.alex)

Setting this as verified on Firefox 111.0a1 based on comment 29 since the other issues are addressed in other tickets. Thank you!

Comment on attachment 9312130 [details]
Bug 1810009 - [devtools] Avoid firing DOCUMENT_EVENT will-navigate for non-top-level targets.

Approved for 110 beta 4, thanks.

Attachment #9312130 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Verified fixed with Firefox 110.0b5 on Windows 10x64, macOS 12 and Ubuntu 20.04. The content of the tabs inside the Browser Toolbox no longer becomes blank after refreshing or navigating to a page while the Parent process is selected.

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-triaged]
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: