Closed Bug 1634363 Opened 4 years ago Closed 4 years ago

Focus events fire in both parent and child frames when raising windows with fission enabled.

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

defect

Tracking

()

RESOLVED FIXED
mozilla79
Fission Milestone M6a
Tracking Status
firefox78 --- disabled
firefox79 --- disabled

People

(Reporter: enndeakin, Assigned: hsivonen)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

  1. Enable fission preference. (fission.autostart)
  2. Have a page with a child frame in another process. The child frame should contain an input element.
  3. Focus the input element.
  4. Lower the window and raise it again.
  5. The input should be focused (once 1617788 is complete), however focus events fire on both the parent frame and child frame.

I will try to create a test case soon.

The issue I think occurs in WindowRaised:

https://searchfox.org/mozilla-central/rev/7fd1c1c34923ece7ad8c822bee062dd0491d64dc/dom/base/nsFocusManager.cpp#716-727

The call to GetFocusedDescendant wants to get the lowest most frame and then call Focus() on it. However when a descendant is out of process, the focus attempt occurs in a parent frame. But also, the descendant process does the same, resulting in two focus attempts.

Perhaps it is sufficient to simply skip this part in the ancestor process when we know a child process will handle focusing.

Henri, what is the expected behavior in this case? Do we want to fire focus events in both parent and child frames?

Severity: -- → normal
Flags: needinfo?(hsivonen)
Severity: normal → S3

I added console.log calls to https://hsivonen.fi/fission-host.html , and the results with the patch are indeed very wrong. Curiously, despite the OOP iframe restoring focus for the purpose of focus ring and text insertion point, the Web-visible events fire only in the wrong place as opposed to both the right and the wrong place as comment 0 says.

Flags: needinfo?(hsivonen)
Assignee: nobody → hsivonen
Status: NEW → ASSIGNED

Tracking for Fission Nightly milestone (M6a)

Fission Milestone: --- → M6a

The attached patch avoids firing the events at top-level Web content. Pernosco suggests that there is an attempt to fire the events within the OOP iframe, but I don't see them in the Web Console.

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

The attached patch avoids firing the events at top-level Web content. Pernosco suggests that there is an attempt to fire the events within the OOP iframe, but I don't see them in the Web Console.

Looks like console.log from OOP iframes is broken. I think this patch now fixes the bug. The new test fails without the patch in Fission and succeeds in Fission with the patch and succeeds in Chrome.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=c9647a9b398f45214fc623e15c9c7c58cb20b066

Weird. The above try run had a failure related to the harness processing a task I didn't even request.

Let's try again:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=8a34221cc9f8c59b69b3ae82dca47676d4407d17

It appears that the patch itself now works and the test works locally, but on try, debug builds run so slowly that the test doesn't wait for long enough. Trying even longer wait times even though such long waits are not nice to have in CI:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=7fd46436876959d2b897324f3b5e6336eae550b1

(One option would be looking into making the test run for opt builds only.)

Blocks: 1616805
Blocks: 1642889

The test I'm adding here works for me locally on Linux (I wrote the test on Linux). However, it fails in CI on Linux but works on Mac and Windows in CI.

To make progress, I'm disabling the test on Linux in CI:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=e49a8375e73b46a6addb7bddc5e8ab62d9e48aa8

Filed bug 1642889 as a follow-up.

Pushed by hsivonen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/01418842d5c7
Avoid firing focus on iframe when raising window if actual focus out-of-process. r=NeilDeakin
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/24007 for changes under testing/web-platform/tests

(In reply to Web Platform Test Sync Bot (Matrix: #interop:mozilla.org) from comment #17)

Can't merge web-platform-tests PR due to failing upstream checks:
Github PR https://github.com/web-platform-tests/wpt/pull/24007

Commented in the GitHub PR.

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79

The patch landed in nightly and beta is affected.
:hsivonen, is this bug important enough to require an uplift?
If not please set status_beta to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(hsivonen)

(In reply to Release mgmt bot [:sylvestre / :calixte / :marco for bugbug] from comment #20)

The patch landed in nightly and beta is affected.
:hsivonen, is this bug important enough to require an uplift?
If not please set status_beta to wontfix.

For more information, please visit auto_nag documentation.

Setting wontfix, because this bug is Fission-specific and Fission isn't enabled in beta.

Flags: needinfo?(hsivonen)

Corrected to disabled instead of wontfix.

Upstream PR merged by jgraham
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: