Closed Bug 1646498 Opened 4 years ago Closed 3 years ago

Fix GetInProcessTop usage in nsAutoSyncOperation

Categories

(Core :: DOM: Core & HTML, defect, P2)

defect

Tracking

()

RESOLVED FIXED
87 Branch
Fission Milestone M6c
Tracking Status
firefox87 --- fixed

People

(Reporter: kmag, Assigned: u608768)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [2/8] In autoland)

Attachments

(1 file, 5 obsolete files)

It's possible that we only need to in-process windows when we're blocking for a sync operation, but we definitely need to correctly handle the case where the top window is not in the same process as the window that enters the sync operation, and when there are OOP interstitials with in-process descendants.

Severity: -- → S3

assign to kmag for M6c

Assignee: nobody → kmaglione+bmo
Fission Milestone: --- → M6c
Assignee: kmaglione+bmo → kmadan
Status: NEW → ASSIGNED

As kmag is expecting here, we probably don't need to do any cross-process work here, as we're only working with the in-process documents. We can possibly get away with grabbing our BrowsingContextGroup, and recursively iterating over every BrowsingContext, setting them as in a sync operation if they're in-process.

Attached file a1.html (obsolete) —
Attached file a2.html (obsolete) —
Attached file b.html (obsolete) —

The document at https://bugzilla.mozilla.org/attachment.cgi?id=9168619 has two processes. The toplevel document and double-nested frame are in the same process. In Firefox, both with and without fission, opening an alert in any of the three frames suspends all intervals. Chrome only suspends intervals for the process that the alert was opened for (eg., opening the alert in either the toplevel or double-nested frame will not pause the middle frame's counter, and opening the alert in the middle frame will not pause the interval in the other two frames).

I'm still seeing comment 6 with the changes from comment 2. It appears someone else is suspending the timeout:

  • The toplevel browser element sends a "EnterModalState" to all process roots here.

  • The middle frame receives that message and calls nsDOMWindowUtils::EnterModalState(), and we eventually suspend the timeout in that process:

    #0  mozilla::dom::TimeoutManager::Suspend() at /home/kashav/src/hg.mozilla.org/mozilla-central/dom/base/TimeoutManager.cpp:1145
    #1  nsGlobalWindowInner::Suspend() at /home/kashav/src/hg.mozilla.org/mozilla-central/dom/base/nsGlobalWindowInner.cpp:5272
    #2  nsGlobalWindowOuter::EnterModalState() at /home/kashav/src/hg.mozilla.org/mozilla-central/dom/base/nsGlobalWindowOuter.cpp:6280
    #3  nsDOMWindowUtils::EnterModalState() at /home/kashav/src/hg.mozilla.org/mozilla-central/dom/base/nsDOMWindowUtils.cpp:2111
    ...
    

I should probably find something that will actually be fixed by making nsAutoSyncOperation work with fission...

(In reply to :kashav from comment #7)

I should probably find something that will actually be fixed by making nsAutoSyncOperation work with fission...

I was able to get this to work using MutationObservers. While in an nsAutoSyncOperation, we block mutation notifications for toplevel documents, but don't block them for in-process descendants which have out-of-process ancestors.

This makes it so we that correctly set nsIGlobalObject::IsInSyncOperation for
in-process descendant frames that have out-of-process ancestors.

Attachment #9168619 - Attachment is obsolete: true
Attachment #9168621 - Attachment is obsolete: true

Comment on attachment 9168622 [details]
b.html

Will file a followup for the timeout compat bugs.

Attachment #9168622 - Attachment is obsolete: true
See Also: → 1660507

Steven said he can finish up Kashav's patches - thanks Steven!

Assignee: kmadan → smacleod
Assignee: smacleod → kmadan
Priority: -- → P2

This makes it so that we correctly set nsIGlobalObject::IsInSyncOperation
for in-process descendant frames that have out-of-process ancestors.

Attachment #9169697 - Attachment is obsolete: true
Attachment #9170786 - Attachment is obsolete: true
Pushed by kmadan@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a911e7cbb478
Fix GetInProcessTop usage in nsAutoSyncOperation, r=kmag
Backout by btara@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b4768398204a
Backed out changeset a911e7cbb478 for open-features-negative-innerwidth-innerheight.html failures CLOSED TREE

Backed out changeset a911e7cbb478 (bug 1646498) for open-features-negative-innerwidth-innerheight.html failures.

Push with failure: https://treeherder.mozilla.org/jobs?repo=autoland&group_state=expanded&selectedTaskRun=f6_9O6IfRL-GfEUgUIQ3vg.0&fromchange=792443abbd75d869593eb9d915a564f8ccf9f24d&searchStr=windows%2C10%2Cx64%2Copt%2Cweb%2Cplatform%2Ctests%2Ctest-windows10-64%2Fopt-web-platform-tests-e10s%2Cwpt3&tochange=b4768398204a406b9847f6a83f6404f1e03827fb

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

Failure log: https://treeherder.mozilla.org/logviewer?job_id=327860748&repo=autoland&lineNumber=4263

...
[task 2021-01-26T19:53:34.872Z] 19:53:34     INFO - TEST-START | /intersection-observer/multiple-targets.html
[task 2021-01-26T19:53:34.873Z] 19:53:34     INFO - Closing window 79
[task 2021-01-26T19:53:35.137Z] 19:53:35     INFO - .....
[task 2021-01-26T19:53:35.137Z] 19:53:35     INFO - TEST-OK | /intersection-observer/multiple-targets.html | took 266ms
[task 2021-01-26T19:53:35.138Z] 19:53:35     INFO - TEST-START | /intersection-observer/multiple-thresholds.html
[task 2021-01-26T19:53:35.139Z] 19:53:35     INFO - Closing window 81
[task 2021-01-26T19:53:35.543Z] 19:53:35     INFO - 
[task 2021-01-26T19:53:35.543Z] 19:53:35     INFO - TEST-UNEXPECTED-TIMEOUT | /html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-negative-innerwidth-innerheight.html | features "innerwidth=-404" should NOT set "width=404" - Test timed out
[task 2021-01-26T19:53:35.544Z] 19:53:35     INFO - 
[task 2021-01-26T19:53:35.544Z] 19:53:35     INFO - TEST-UNEXPECTED-TIMEOUT | /html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-negative-innerwidth-innerheight.html | features "innerwidth=-404.5" should NOT set "width=404" - Test timed out
[task 2021-01-26T19:53:35.546Z] 19:53:35     INFO - 
[task 2021-01-26T19:53:35.546Z] 19:53:35     INFO - TEST-UNEXPECTED-TIMEOUT | /html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-negative-innerwidth-innerheight.html | features "innerwidth=-404e1" should NOT set "width=404" - Test timed out
[task 2021-01-26T19:53:35.548Z] 19:53:35     INFO - 
[task 2021-01-26T19:53:35.548Z] 19:53:35     INFO - TEST-UNEXPECTED-TIMEOUT | /html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-negative-innerwidth-innerheight.html | features "innerheight=-404" should NOT set "height=404" - Test timed out
[task 2021-01-26T19:53:35.550Z] 19:53:35     INFO - 
[task 2021-01-26T19:53:35.550Z] 19:53:35     INFO - TEST-UNEXPECTED-TIMEOUT | /html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-negative-innerwidth-innerheight.html | features "innerheight=-404.5" should NOT set "height=404" - Test timed out
[task 2021-01-26T19:53:35.552Z] 19:53:35     INFO - TEST-UNEXPECTED-TIMEOUT | /html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-negative-innerwidth-innerheight.html | expected OK
[task 2021-01-26T19:53:35.552Z] 19:53:35     INFO - TEST-INFO took 60551ms
[task 2021-01-26T19:53:35.555Z] 19:53:35     INFO - PID 5864 | 1611690815555	Marionette	INFO	Stopped listening on port 51296
Flags: needinfo?(kmadan)

Could you, please, also take a look at these intermittent crashes? Could them be caused by the backed out changes?
https://treeherder.mozilla.org/logviewer?job_id=327864078&repo=autoland&lineNumber=4725

(In reply to Bogdan Tara[:bogdan_tara | bogdant] from comment #17)

Could you, please, also take a look at these intermittent crashes? Could them be caused by the backed out changes?
https://treeherder.mozilla.org/logviewer?job_id=327864078&repo=autoland&lineNumber=4725

They were, sorry for the noise. Looking at the failures.

Flags: needinfo?(kmadan)

Failing WPTs appear to be fixed: https://treeherder.mozilla.org/jobs?repo=try&revision=8f4fa4d773cfbb9e034e877808c40c8a9a6bde91.

The intermittent crashes should be fixed too, but still have to verify.

Whiteboard: [2/1] patch in review
Whiteboard: [2/1] patch in review → [2/3] patch needs revision
Whiteboard: [2/3] patch needs revision → [2/5] waiting for review
Pushed by kmadan@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/90879d7de4f5
Fix GetInProcessTop usage in nsAutoSyncOperation, r=kmag
Whiteboard: [2/5] waiting for review → [2/8] In autoland
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 87 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: