Closed Bug 1660752 Opened 11 months ago Closed 8 months ago

Make test_bug238987.html pass with cross-origin and Fission enabled

Categories

(Core :: DOM: UI Events & Focus Handling, task, P2)

task

Tracking

()

RESOLVED FIXED
85 Branch
Fission Milestone M6c
Tracking Status
firefox-esr68 --- disabled
firefox-esr78 --- disabled
firefox79 --- disabled
firefox80 --- disabled
firefox81 --- disabled
firefox82 --- disabled
firefox85 --- fixed

People

(Reporter: edgar, Assigned: edgar)

References

Details

Attachments

(2 files)

Test got unexpected focus events before the first tab navigation. Look like there are timing changes in focus event.

Attached file test.html

(In reply to Edgar Chen [:edgar] from comment #0)

Test got unexpected focus events before the first tab navigation. Look like there are timing changes in focus event.

Here is the test page that shows the differences:

Fission

With fission enabled, the focus event is dispatched asynchronously.

onload
before calling window.focus()
after calling window.focus()
window.onfocus: target: [object HTMLDocument], eventPhase: 1
window.onfocus: target: [object Window], eventPhase: 2
window.onfocus: target: [object Window], eventPhase: 2

non-Fission

The focus event used to be dispatched synchronously while calling window.focus() of the iframe.

onload
before calling window.focus()
window.onfocus: target: [object HTMLDocument], eventPhase: 1
window.onfocus: target: [object Window], eventPhase: 2
window.onfocus: target: [object Window], eventPhase: 2
after calling window.focus()

Henri, is this something expected? If so, I will modify the test to make it compatible with fission.

Flags: needinfo?(hsivonen)

.contentWindow.focus() on an OOP iframe is known broken in general: Bug 1613054.

As for sync vs. async, I'm not yet sure where that part will settle.

Flags: needinfo?(hsivonen)

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

.contentWindow.focus() on an OOP iframe is known broken in general: Bug 1613054.

As for sync vs. async, I'm not yet sure where that part will settle.

Thanks!

Depends on: 1613054
Fission Milestone: --- → ?
Summary: Make test_bug238987.html pass with cross-origin and Fission enabled → Re-enable test_bug238987.html pass with cross-origin and Fission enabled
Summary: Re-enable test_bug238987.html pass with cross-origin and Fission enabled → Make test_bug238987.html pass with cross-origin and Fission enabled

Tracking for Fission Nightly M6c

Fission Milestone: ? → M6c
Priority: -- → P2

Hi Chris, does M6c here mean, it should no longer block bug 1653457 (marked M6b) ?

Flags: needinfo?(cpeterson)

(In reply to Jens Stutte [:jstutte] (REO for FF 81) from comment #5)

Hi Chris, does M6c here mean, it should no longer block bug 1653457 (marked M6b) ?

M6c means fixing the bug soon (in September, ideally) is important, but it doesn't block our Fission Nightly experiment (October 6).

Neha moved bug 1653457 from M6b to M6c. This bug can stay in M6c.

Flags: needinfo?(cpeterson)

(In reply to Chris Peterson [:cpeterson] from comment #6)

Neha moved bug 1653457 from M6b to M6c. This bug can stay in M6c.

Correction: Neha had moved a different xorigin meta bug (bug 1652554) from M6b to M6c.

I will move bug 1653457 from M6b to M6c now.

Bug 1613054 wasn't sufficient for fixing this. The backout of bug 1649099 shows that the events being tested here don't fire deterministically. (I don't know why.)

I guess there might be some timing changes due to now parent window need to bounce an IPC message to the OOP iframe. I will take a look.

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

As for sync vs. async, I'm not yet sure where that part will settle.

window.focus() on a non-OOP iframe would call nsContentUtils::RequestFrameFocus synchronously, https://searchfox.org/mozilla-central/rev/7b07725fe9dc5d59a525990fc1dba78bc8b82af1/dom/base/nsGlobalWindowOuter.cpp#5143, and then dispatch focus event synchronously.

But window.focus() on an OOP iframe sends an IPC message to its parent frame instead, https://searchfox.org/mozilla-central/rev/7b07725fe9dc5d59a525990fc1dba78bc8b82af1/dom/base/nsGlobalWindowOuter.cpp#5131-5136, then wait for parent to send IPC back, the focus event is fired asynchronously due to the bounce of the IPC.

I also notice bug 1674702 that there is additional pair of blur and focus event gets fired while calling window.focus() on OOP iframe.

(In reply to Edgar Chen [:edgar] from comment #10)

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

As for sync vs. async, I'm not yet sure where that part will settle.

window.focus() on a non-OOP iframe would call nsContentUtils::RequestFrameFocus synchronously, https://searchfox.org/mozilla-central/rev/7b07725fe9dc5d59a525990fc1dba78bc8b82af1/dom/base/nsGlobalWindowOuter.cpp#5143, and then dispatch focus event synchronously.

But window.focus() on an OOP iframe sends an IPC message to its parent frame instead, https://searchfox.org/mozilla-central/rev/7b07725fe9dc5d59a525990fc1dba78bc8b82af1/dom/base/nsGlobalWindowOuter.cpp#5131-5136, then wait for parent to send IPC back, the focus event is fired asynchronously due to the bounce of the IPC.

Split this to bug 1674743.

Depends on: 1674743, 1674702
Assignee: nobody → echen
Pushed by echen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6d5a7637d34f
Enable dom/events/test_bug238987.html on fission and cross-origin; r=hsivonen
Duplicate of this bug: 1677919
Status: NEW → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 85 Branch
You need to log in before you can comment on or make changes to this bug.