Closed Bug 1092549 Opened 7 years ago Closed 7 years ago

Sometimes, the new inputcontext is broken if input focus moved from chrome back to app process

Categories

(Core :: DOM: Device Interfaces, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla36
tracking-b2g backlog

People

(Reporter: alive, Assigned: timdream)

References

(Depends on 1 open bug)

Details

(Whiteboard: [FT:System-Platform])

Attachments

(1 file, 1 obsolete file)

STR
0. Apply patch of bug 1079748
1. Open message app and write a new message, focus the contact input. Keyboard will show up.
2. Open rocketbar from the left side of title area.
3. Type something.
4. Click close button of rocketbar.

Actual
The keyboard will stay when rocketbar is closed,
but when you click keyboard nothing is shown in the input.
Flags: needinfo?(timdream)
Let me take a look on Monday then.
Blocks: keyboard-api
blocking-b2g: --- → backlog
Component: Gaia::System::Input Mgmt → DOM: Device Interfaces
Flags: needinfo?(timdream)
Product: Firefox OS → Core
Whiteboard: [FT:System-Platform]
Assignee: nobody → timdream
Status: NEW → ASSIGNED
I can verify this is an API issue; the keyboard was given an inputcontext pointing to the right textarea but all methods (sendKey() etc) rejects with "InputContext has expired" error.
Here is the log I collected. The root cause of this bug is because formMM was being reset to the previous focused element when focus changed. The fix required will be very similar to bug 1083617.

I/Gecko   ( 6713): XXXXX MozKeyboard.js inputcontext {"contextId":15,"type":"search","choices":null,"value":"","inputmode":"verbatim","selectionStart":0,"selectionEnd":0,"max":"","min":"","lang":"","textBeforeCursor":"","textAfterCursor":""}
I/Gecko   ( 6375): XXXXX 703 fa_unhandleFocusSync
I/Gecko   ( 6375): XXXXX 710 blur
I/Gecko   ( 6713): XXXXX MozKeyboard.js inputcontext null
I/Gecko   ( 6828): XXXXX 685 fa_handleFocusSync
I/Gecko   ( 6828): XXXXX 690 focus true
I/Gecko   ( 6375): XXXXX 476 SequenceError
I/Gecko   ( 6375): XXXXX forwardEvent w/ new MM: Keyboard:FocusChange{"target":{},"name":"Forms:Input","sync":false,"json":{"contextId":25,"type":"textarea","choices":null,"value":"cfnn","inputmode":"verbatim","selectionStart":4,"selectionEnd":4,"max":"","min":"","lang":"","textBeforeCursor":"cfnn","textAfterCursor":""},"data":{"contextId":25,"type":"textarea","choices":null,"value":"cfnn","inputmode":"verbatim","selectionStart":4,"selectionEnd":4,"max":"","min":"","lang":"","textBeforeCursor":"cfnn","textAfterCursor":""},"objects":{}}
I/Gecko   ( 6713): XXXXX MozKeyboard.js inputcontext {"contextId":25,"type":"textarea","choices":null,"value":"cfnn","inputmode":"verbatim","selectionStart":4,"selectionEnd":4,"max":"","min":"","lang":"","textBeforeCursor":"cfnn","textAfterCursor":""}
I/Gecko   ( 6375): XXXXX forwardEvent w/ new MM: Keyboard:SequenceError{"target":{},"name":"Forms:SequenceError","sync":false,"json":{"requestId":"id{89258bd5-5411-4dff-ba22-ec5aa4a37642}","error":"Expected contextId 16 but was 15"},"data":{"requestId":"id{89258bd5-5411-4dff-ba22-ec5aa4a37642}","error":"Expected contextId 16 but was 15"},"objects":{}}
I/Gecko   ( 6375): XXXXX 476 SequenceError
I/Gecko   ( 6713): XXXXX SequenceError: Expected contextId 16 but was 25
I/Gecko   ( 6375): XXXXX 476 SequenceError
I/Gecko   ( 6713): XXXXX SequenceError: Expected contextId 16 but was 25
I/Gecko   ( 6375): XXXXX 476 SequenceError
I/Gecko   ( 6713): XXXXX SequenceError: Expected contextId 16 but was 25
Attached patch Patch v1.0 (obsolete) — Splinter Review
This patch further limit the message capable of changing the formMM to the real focus message only. Again because of bug 1090032 I can't write any test for this.

https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=415c534deb57
Attachment #8515802 - Flags: review?(xyuan)
Summary: After applying bug 1079748, when switching focus, the input failed to get keys → Sometimes, the new inputcontext is broken if input focus moved from chrome back to app process
Attachment #8515802 - Flags: review?(xyuan) → review+
Comment on attachment 8515802 [details] [diff] [review]
Patch v1.0

Review of attachment 8515802 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/inputmethod/Keyboard.jsm
@@ +257,5 @@
> +        // message gets to the right form now on.
> +        this.formMM = mm;
> +      } else { // input is blurred
> +        // A blur message can't be sent to the keyboard if the focus has
> +        // already taken away at first place.

nit: been taken away
Attached patch Patch for commitSplinter Review
Let's wait for try to finish before checkin-needed.
Attachment #8515802 - Attachment is obsolete: true
Attachment #8515838 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/fd0146aeb963
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
blocking-b2g: backlog → ---
You need to log in before you can comment on or make changes to this bug.