Fix GetInProcessParentDocshell usage in DocShell::GetVisibility
Categories
(Core :: DOM: Navigation, defect, P2)
Tracking
()
Fission Milestone | M7a |
People
(Reporter: kmag, Assigned: edgar)
References
(Blocks 2 open bugs)
Details
Attachments
(7 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
1.38 KB,
text/html
|
Details | |
1.40 KB,
text/html
|
Details |
It doesn't handle OOP ancestors, which it probably should. Though it's possible that we propagate visibility information to OOP docshells in some other way.
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Comment 1•4 years ago
|
||
Emilio, what happens if this code is wrong for Fission OOP iframes? Do we need to fix this before we enable Fission?
See also IsVisibleConsideringAncestors bug 1646486.
Comment 2•4 years ago
|
||
I'm not particularly familiar with this API... It seems there are a bunch of callers, some from devtools, other from ESM, etc... Most of them look not too terrible, but I haven't checked in detail so beware.
The function of course is completely broken in both fission and e10s... Maybe we should either assert we only call it from the parent process, or try to remove it somehow, it doesn't seem like there are too many callers.
Comment 3•4 years ago
|
||
We should also check nsIFrame::IsVisibleConsideringAncestors
and make sure that's OK, as it's also broken with fission due to using GetCrossDocParentFrame
: https://searchfox.org/mozilla-central/rev/c6676771df58c6e0098574bc6b11517acbf264cf/layout/generic/nsIFrame.cpp#409
Updated•4 years ago
|
Comment 5•3 years ago
|
||
I think this might be working somewhat now thanks to the other changes you've been doing for visibility etc. with Fission :emilio. Is there more work we need to do here, or can we resolve this?
Comment 6•3 years ago
|
||
GetVisibility
right now seems completely independent from IsActive
right now, but probably shouldn't. I think effectively most of the callers could be changed to check BrowsingContext::IsActive
without changing behavior, but there are some which do seem to care about activeness vs. actually-in-viewport.
Updated•3 years ago
|
Comment 7•3 years ago
|
||
Comment 8•3 years ago
|
||
Depends on D108238
Comment 9•3 years ago
|
||
Depends on D108239
Updated•3 years ago
|
Comment 10•3 years ago
|
||
Pushed by smacleod@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7ab33e9d46a4 Stop using DocShell::GetVisibility in PresShell. r=emilio https://hg.mozilla.org/integration/autoland/rev/39dc65fb7714 Stop using DocShell::GetVisibility in nsRefreshDriver. r=emilio
Comment 11•3 years ago
|
||
We stop checking for the tab state to be STATE_LOADED
since it
messes up initial focus. Instead, we directly check if the tab
is warming, since that was the intention of this check, AFAICT.
See Bug 1397426 for where this was introduced.
Depends on D108240
Comment 12•3 years ago
|
||
Pushed by smacleod@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/708a20e04616 Stop using DocShell::GetVisibility in nsXULPopupManager. r=emilio
Comment 13•3 years ago
|
||
bugherder |
Comment 14•3 years ago
|
||
Pushed by smacleod@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ab94b17b8da3 Stop using DocShell::GetVisibility in nsFocusManager. r=emilio,mconley
Comment 15•3 years ago
|
||
Backed out for failures on browser_abort_visibility.js
backout: https://hg.mozilla.org/integration/autoland/rev/7f3f32624f0707d56f7bdb4606205227aafcbe30
failure log: https://treeherder.mozilla.org/logviewer?job_id=333415847&repo=autoland&lineNumber=5948
[task 2021-03-16T18:01:47.838Z] 18:01:47 INFO - TEST-PASS | dom/webauthn/tests/browser/browser_abort_visibility.js | webauthn request pending -
[task 2021-03-16T18:01:47.838Z] 18:01:47 INFO - must wait for focus
[task 2021-03-16T18:01:47.838Z] 18:01:47 INFO - Buffered messages logged at 18:01:47
[task 2021-03-16T18:01:47.838Z] 18:01:47 INFO - visbility state: visible
[task 2021-03-16T18:01:47.838Z] 18:01:47 INFO - active: true
[task 2021-03-16T18:01:47.838Z] 18:01:47 INFO - Buffered messages finished
[task 2021-03-16T18:01:47.838Z] 18:01:47 INFO - TEST-UNEXPECTED-FAIL | dom/webauthn/tests/browser/browser_abort_visibility.js | webauthn request pending - Got "aborted", expected "pending"
[task 2021-03-16T18:01:47.838Z] 18:01:47 INFO - Stack trace:
[task 2021-03-16T18:01:47.838Z] 18:01:47 INFO - chrome://mochikit/content/browser-test.js:test_is:1359
[task 2021-03-16T18:01:47.838Z] 18:01:47 INFO - chrome://mochitests/content/browser/dom/webauthn/tests/browser/browser_abort_visibility.js:assertStatus:20
[task 2021-03-16T18:01:47.933Z] 18:01:47 INFO - Leaving test bound test_minimize_make
[task 2021-03-16T18:01:47.933Z] 18:01:47 INFO - Entering test bound test_minimize_get
[task 2021-03-16T18:01:48.567Z] 18:01:48 INFO - Attempting to get credential for origin: https://example.com
[task 2021-03-16T18:01:48.567Z] 18:01:48 INFO - visbility state: visible
[task 2021-03-16T18:01:48.567Z] 18:01:48 INFO - active: true
[task 2021-03-16T18:01:48.567Z] 18:01:48 INFO - TEST-PASS | dom/webauthn/tests/browser/browser_abort_visibility.js | webauthn request pending -
Comment 16•3 years ago
•
|
||
Comment 17•3 years ago
|
||
Updated•3 years ago
|
Comment 18•3 years ago
|
||
Edgar, can you please take over this one? The remaining work is:
Patch D108452 - Fix the Mac test failure to fix the backout.
Patch D108781 - Discuss with smaug as he needed something additionally fixed in the patch.
Updated•3 years ago
|
Assignee | ||
Updated•3 years ago
|
Updated•3 years ago
|
Assignee | ||
Comment 19•3 years ago
|
||
Assignee | ||
Comment 20•3 years ago
|
||
(In reply to Edgar Chen [:edgar] from comment #19)
https://treeherder.mozilla.org/#/jobs?repo=try&revision=e2e8a33b57ac4a29137e9232bfc94c7d599f9159
Okay, so the test failure on Mac are also caused by occlusion state updating.
Assignee | ||
Comment 21•3 years ago
•
|
||
Assignee | ||
Comment 22•3 years ago
|
||
Assignee | ||
Comment 23•3 years ago
•
|
||
I tested the behavior of trying to focus element in a hidden cross-origin iframe on fission, non-fission and other browsers,
-- | display: none | visibility: hidden |
---|---|---|
Gecko (Fission) | YES | |
Gecko (non-Fission) | NO | NO |
Blink | NO | YES |
Webkit | YES* | YES* |
YES: focus could move into hidden iframe.
NO: focus could not move into hidden iframe.
*: Webkit requires user to interact with iframe first, e.g. click it, to allow iframe the get the focus.
--
Update:
Correct the result of Fission for visibility: hidden
.
Assignee | ||
Comment 24•3 years ago
|
||
Assignee | ||
Comment 25•3 years ago
|
||
Assignee | ||
Comment 26•3 years ago
|
||
(In reply to Edgar Chen [:edgar] (away ~ 7/4) from comment #23)
I tested the behavior of trying to focus element in a hidden cross-origin iframe on fission, non-fission and other browsers,
-- display: none visibility: hidden Gecko (Fission) YES NO Gecko (non-Fission) NO NO Blink NO YES Webkit YES* YES* YES: focus could move into hidden iframe.
NO: focus could not move into hidden iframe.
*: Webkit requires user to interact with iframe first, e.g. click it, to allow iframe the get the focus.
So each browser has different behavior and as we don't allow to focus element in in-process iframe that is not visible in the viewport, so I would like just make oop iframe behave the same as in-process iframe. We have fixed the visibility: hidden
case for remote iframe in bug 1541253, so I would also make the display: none
case for oop iframe behave the same as in-process iframe.
Assignee | ||
Comment 27•3 years ago
|
||
For the scrolling behavior, I testes various cases with in-process iframe, but I could not find a case that we try to scroll the view to the hidden iframe. So yes, we have kinda different focus behaviour on hidden/background tab and hidden iframe. But since this is what we have now, I am not sure how risky to change it. I would like to keep the behaviour, i.e. not allow focus the element in hidden iframe, please let me know if you have any concern, emilio.
Comment 28•3 years ago
|
||
With "hidden", I meant "scrolled out of view". Obviously frames inside visibility: hidden
or display: none
shouldn't be focusable. So I was misunderstanding what you said with IsVisible
. Anyhow, I think the issue is that we don't propagate the "under hidden embedder element" bit correctly to OOP iframes, which is what makes the visibility: hidden
case behave inconsistently on fission.
Assignee | ||
Comment 29•3 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #28)
With "hidden", I meant "scrolled out of view". Obviously frames inside
visibility: hidden
ordisplay: none
shouldn't be focusable.
Thanks, I filed bug 1716762 for this.
Comment 30•3 years ago
|
||
I don't quite understand the switch from visibility check to active check. Those used to be quite different things, especially in the parent process.
Assignee | ||
Comment 31•3 years ago
•
|
||
With bug 1716762, the display: none
information will be propagated to OOP iframe through PresShell along with the information of visibility: hidden
. The DocShell::GetVisibility will check nsIFrame::IsVisibleConsideringAncestors which checks PresShell::IsUnderHiddenEmbedderElement. I also write some test and didn't find issue. So I think the remaining usage in nsFocusManager and EventStateManager should be fine.
Assignee | ||
Comment 32•3 years ago
|
||
Close per comment #31.
Updated•3 years ago
|
Description
•