Closed Bug 1115455 Opened 6 years ago Closed 6 years ago

[Stingray][System] focus app window while the app window is fully loaded

Categories

(Firefox OS Graveyard :: General, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
2.2 S3 (9jan)

People

(Reporter: johnhu, Assigned: johnhu)

References

Details

Attachments

(1 file)

According to the finding of bug 1113592, smart system app tries to focus an app window while the iframe is not loaded. This behavior doesn't set the focus to iframe correctly.

We set focus when the app window is opened, currently. The `opened` state means that: 
1. the iframe is created
2. the DOM elements and iframe is resized to correct size
3. the animation is end.

I will make a patch to set focus only when 1. the iframe is loaded, 2. app window is opened and 3. app window is the active one.
Rex,

Please review this patch.

Sean,

Please apply this patch and validate if we focus the app only when it is loaded at your environment.
Attachment #8541383 - Flags: review?(rexboy)
Attachment #8541383 - Flags: feedback?(selin)
Comment on attachment 8541383 [details] [review]
focus app window when it is active and loaded

It works at my environment (B2G desktop build on Ubuntu).
Attachment #8541383 - Flags: feedback?(selin) → feedback+
Assignee: nobody → im
Some technical details about this issue FYI:

1. |nsFocusManager| checks if the content is focusable before actually setting focus on it. [1]
2. "Frames are never directly focused; instead focusing a frame means focus what is inside the frame. To do this, the descendant content within the frame is retrieved and that will be focused instead." [2]
3. There appears a sub-document and app-deck frame is visible, so the content node is used to determine focusability. [3]
4. While |nsFocusManager| determines focusability of the content node, the correspondent document hasn't been focusable since its docshell is still busy loading the page. (So it has one zombie content viewer and the new content structure hasn't been ready yet.)

[1] http://dxr.mozilla.org/mozilla-central/source/dom/base/nsFocusManager.cpp#1164
[2] http://dxr.mozilla.org/mozilla-central/source/dom/base/nsFocusManager.cpp#1168-1171
[3] http://dxr.mozilla.org/mozilla-central/source/dom/base/nsFocusManager.cpp#1562-1572
[4] http://dxr.mozilla.org/mozilla-central/source/dom/base/nsContentUtils.cpp#6175-6192
Assignee: im → nobody
Assignee: nobody → im
Looks reasonable to me but I don't have the environment to reproduce the problem.
I didn't found any problem while testing so r+ for Sean has already tested it.
Attachment #8541383 - Flags: review?(rexboy) → review+
Target Milestone: --- → 2.2 S3 (9jan)
You need to log in before you can comment on or make changes to this bug.