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

RESOLVED FIXED in 2.2 S3 (9jan)


Firefox OS
3 years ago
3 years ago


(Reporter: johnhu, Assigned: johnhu)


2.2 S3 (9jan)
Mac OS X
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)



(1 attachment)

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.
Blocks: 1113592
Created attachment 8541383 [details] [review]
focus app window when it is active and loaded


Please review this patch.


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+
merged to master:
gaia try is all green:
Last Resolved: 3 years ago
Resolution: --- → FIXED
Blocks: 1115648
No longer blocks: 1115648
Target Milestone: --- → 2.2 S3 (9jan)
You need to log in before you can comment on or make changes to this bug.