Closed Bug 1662772 Opened 4 years ago Closed 4 years ago

Investigate calling .contentWindow.focus() on an OOP iframe that has presently-unfocused ancestor iframes

Categories

(Core :: DOM: Window and Location, task, P3)

task

Tracking

()

RESOLVED FIXED
85 Branch
Fission Milestone M7
Tracking Status
firefox85 --- fixed

People

(Reporter: hsivonen, Assigned: hsivonen)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Investigate if https://phabricator.services.mozilla.com/D70800 is sufficient with complex frame hierarchies.

Probably not a common use case.

M7 unless someone reports a broken website.

Severity: -- → N/A
Fission Milestone: --- → M7
Priority: -- → P3
Assignee: nobody → hsivonen
Status: NEW → ASSIGNED

Locally, it looks like we're doing OK in the OOP case, but I filed bug 1675484 about a missing (relative to Chrome and Fission case) event.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=66487d67087f0c627314d7f45c888157c26f624e

See Also: → 1675484

Hmm. I guess I should also test exactly what the bug summary says, i.e. test iframe.contentWindow.focus() in addition to iframe.focus().

(In reply to Henri Sivonen (:hsivonen) from comment #4)

Hmm. I guess I should also test exactly what the bug summary says, i.e. test iframe.contentWindow.focus() in addition to iframe.focus().

Sigh. Chrome differs for iframe.contentWindow.focus() and iframe.focus(). Our non-Fission matches Chrome iframe.contentWindow.focus() and Fission matches Chrome iframe.focus().

I will need to get a setup that allows me to run WPT in Safari.

I tried https://codepen.io/edgarchen-the-decoder/pen/GRqGNmo on Safari a bit.
Calling iframe.contentWindow.focus() on framer won't move focus to different-site iframe, calling iframe.focus() would.

In Safari I get the following for the entire focus directory:

Unexpected Results
------------------
/focus/activeelement-after-focusing-different-site-iframe-contentwindow.html
  FAIL Check trailing events - assert_false: Should have gotten innerbodyfocus after willspineventloop expected false got true
http://web-platform.test:8000/focus/activeelement-after-focusing-different-site-iframe-contentwindow.html:18:21
http://web-platform.test:8000/resources/testharness.js:2044:30
test@http://web-platform.test:8000/resources/testharness.js:572:34
http://web-platform.test:8000/focus/activeelement-after-focusing-different-site-iframe-contentwindow.html:10:9
  FAIL Check result - assert_equals: Check log expected "outeronload,activeElement:BODY,willfocusiframe,didfocusiframe,activeElement:IFRAME,willbluriframe,didbluriframe,activeElement:IFRAME,willspineventloop,innerbodyfocus,innerbodyblur,innerbodyfocus," but got "outeronload,activeElement:BODY,willfocusiframe,didfocusiframe,activeElement:BODY,willbluriframe,didbluriframe,activeElement:BODY,willspineventloop,innerbodyfocus,innerbodyblur,innerbodyfocus,"
http://web-platform.test:8000/focus/activeelement-after-focusing-different-site-iframe-contentwindow.html:30:22
http://web-platform.test:8000/resources/testharness.js:2044:30
test@http://web-platform.test:8000/resources/testharness.js:572:34
http://web-platform.test:8000/focus/activeelement-after-focusing-different-site-iframe-contentwindow.html:29:9
/focus/activeelement-after-focusing-different-site-iframe.html
  FAIL Check result - assert_equals: Check log expected "outeronload,activeElement:BODY,willfocusiframe,didfocusiframe,activeElement:IFRAME,willbluriframe,didbluriframe,activeElement:BODY,willspineventloop,innerbodyfocus,innerbodyblur," but got "outeronload,activeElement:BODY,willfocusiframe,didfocusiframe,activeElement:IFRAME,willbluriframe,didbluriframe,activeElement:IFRAME,willspineventloop,innerbodyfocus,"
http://web-platform.test:8000/focus/activeelement-after-focusing-different-site-iframe.html:21:22
http://web-platform.test:8000/resources/testharness.js:2044:30
test@http://web-platform.test:8000/resources/testharness.js:572:34
http://web-platform.test:8000/focus/activeelement-after-focusing-different-site-iframe.html:20:9
/focus/activeelement-after-focusing-same-site-iframe.html
  FAIL Check result - assert_equals: Check log expected "outeronload,activeElement:BODY,willfocusiframe,didfocusiframe,activeElement:IFRAME,willbluriframe,didbluriframe,activeElement:BODY,willspineventloop,innerbodyfocus,innerbodyblur," but got "outeronload,activeElement:BODY,willfocusiframe,didfocusiframe,activeElement:IFRAME,willbluriframe,didbluriframe,activeElement:IFRAME,willspineventloop,innerbodyfocus,"
http://web-platform.test:8000/focus/activeelement-after-focusing-same-site-iframe.html:21:22
http://web-platform.test:8000/resources/testharness.js:2044:30
test@http://web-platform.test:8000/resources/testharness.js:572:34
http://web-platform.test:8000/focus/activeelement-after-focusing-same-site-iframe.html:20:9
/focus/activeelement-after-immediately-focusing-different-site-iframe.html
  FAIL Check result - assert_equals: Check log expected "outerparser,activeElement:BODY,willfocusiframe,didfocusiframe,activeElement:IFRAME,willbluriframe,didbluriframe,activeElement:BODY,willspineventloop," but got "outerparser,activeElement:BODY,willfocusiframe,didfocusiframe,activeElement:IFRAME,willbluriframe,didbluriframe,activeElement:IFRAME,willspineventloop,"
http://web-platform.test:8000/focus/activeelement-after-immediately-focusing-different-site-iframe.html:10:22
http://web-platform.test:8000/resources/testharness.js:2044:30
test@http://web-platform.test:8000/resources/testharness.js:572:34
http://web-platform.test:8000/focus/activeelement-after-immediately-focusing-different-site-iframe.html:9:9
/focus/activeelement-after-immediately-focusing-same-site-iframe.html
  FAIL Check result - assert_equals: Check log expected "outerparse,activeElement:BODY,willfocusiframe,didfocusiframe,activeElement:IFRAME,willbluriframe,didbluriframe,activeElement:BODY,willspineventloop," but got "outerparse,activeElement:BODY,willfocusiframe,didfocusiframe,activeElement:IFRAME,willbluriframe,didbluriframe,activeElement:IFRAME,willspineventloop,"
http://web-platform.test:8000/focus/activeelement-after-immediately-focusing-same-site-iframe.html:10:22
http://web-platform.test:8000/resources/testharness.js:2044:30
test@http://web-platform.test:8000/resources/testharness.js:572:34
http://web-platform.test:8000/focus/activeelement-after-immediately-focusing-same-site-iframe.html:9:9
/focus/focus-restoration-in-different-site-iframes-window.html
  FAIL Check result - assert_equals: Check log expected "outerlog:log:willfocuswindow,windowfocus,didfocuswindow," but got "outerlog:log:willfocuswindow,didfocuswindow,"
http://web-platform.test:8000/focus/focus-restoration-in-different-site-iframes-window.html:10:22
http://web-platform.test:8000/resources/testharness.js:2044:30
test@http://web-platform.test:8000/resources/testharness.js:572:34
http://web-platform.test:8000/focus/focus-restoration-in-different-site-iframes-window.html:9:9
/focus/focus-restoration-in-different-site-iframes.html
  FAIL Check result - assert_equals: Check log expected "outerlog:log:willfocusinput,bodyfocus,inputfocus,didfocusinput,inputblur,bodyblur,bodyfocus,inputfocus," but got "outerlog:bodyblur,bodyfocus,log:willfocusinput,didfocusinput,"
http://web-platform.test:8000/focus/focus-restoration-in-different-site-iframes.html:10:22
http://web-platform.test:8000/resources/testharness.js:2044:30
test@http://web-platform.test:8000/resources/testharness.js:572:34
http://web-platform.test:8000/focus/focus-restoration-in-different-site-iframes.html:9:9
/focus/iframe-contentwindow-focus-with-different-site-intermediate-frame.html
  FAIL Check result - assert_equals: Check log expected "outeronload;outeractivelement:body;starttest;middleactivelement:body;callfocus;middleactivelement:iframe;innerfocus;middletimer;middleactivelement:iframe;outeractivelement:iframe;" but got "outeronload;outeractivelement:body;starttest;middleactivelement:body;callfocus;middleactivelement:body;middletimer;middleactivelement:body;outeractivelement:body;"
http://web-platform.test:8000/focus/iframe-contentwindow-focus-with-different-site-intermediate-frame.html:11:22
http://web-platform.test:8000/resources/testharness.js:2044:30
test@http://web-platform.test:8000/resources/testharness.js:572:34
http://web-platform.test:8000/focus/iframe-contentwindow-focus-with-different-site-intermediate-frame.html:10:9
/focus/iframe-contentwindow-focus-with-same-as-top-intermediate-frame.html
  FAIL Check result - assert_equals: Check log expected "outeronload;outeractivelement:body;starttest;middleactivelement:body;callfocus;middleactivelement:iframe;innerfocus;middletimer;middleactivelement:iframe;outeractivelement:iframe;" but got "outeronload;outeractivelement:body;starttest;middleactivelement:body;callfocus;middleactivelement:body;middletimer;middleactivelement:body;outeractivelement:body;"
http://web-platform.test:8000/focus/iframe-contentwindow-focus-with-same-as-top-intermediate-frame.html:11:22
http://web-platform.test:8000/resources/testharness.js:2044:30
test@http://web-platform.test:8000/resources/testharness.js:572:34
http://web-platform.test:8000/focus/iframe-contentwindow-focus-with-same-as-top-intermediate-frame.html:10:9
/focus/iframe-focus-with-different-site-intermediate-frame.html
  FAIL Check result - assert_equals: Check log expected "outeronload;outeractivelement:body;starttest;middleactivelement:body;callfocus;middlefocus;middleactivelement:iframe;innerfocus;middletimer;middleactivelement:iframe;outeractivelement:iframe;" but got "outeronload;outeractivelement:body;starttest;middleactivelement:body;callfocus;middleactivelement:body;middletimer;middleactivelement:body;outeractivelement:body;"
http://web-platform.test:8000/focus/iframe-focus-with-different-site-intermediate-frame.html:11:22
http://web-platform.test:8000/resources/testharness.js:2044:30
test@http://web-platform.test:8000/resources/testharness.js:572:34
http://web-platform.test:8000/focus/iframe-focus-with-different-site-intermediate-frame.html:10:9

The activeElement tests are not introduced in this patch, but differ from Gecko/Blink. Also, the new tests that involve iframe.contentWindow.focus() differ.

I think the main conclusion to draw is that this general area has differences between Blink and WebKit, so maybe we shouldn't be too worried about our differences from Blink when WebKit differs more.

Upstreaming stuff to the WPT repo should have better spec backing than just codifying what I happen to see Chrome doing, though.

Still, looking at what's happening, Firefox and Blink are so much closer to each other than WebKit, that it's probably fair to call it quorum.

(In reply to Henri Sivonen (:hsivonen) from comment #8)

Still, looking at what's happening, Firefox and Blink are so much closer to each other than WebKit, that it's probably fair to call it quorum.

I'm pretty confident that we can call the expectations left in the test appropriate per quorum (and I'm unaware of the spec saying otherwise).

Pushed by hsivonen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6bb0014ba6d3
Test focusing an iframe whose framer does not have focus. r=jgraham
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/26676 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 85 Branch
Upstream PR was closed without merging
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: