Closed Bug 982479 Opened 11 years ago Closed 11 years ago

InternalErrorWrongContentEvent when signing in for first time through DOM API

Categories

(Firefox OS Graveyard :: FxA, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jedp, Assigned: spenrose)

References

Details

Attachments

(1 file)

46 bytes, text/x-github-pull-request
jedp
: review+
Details | Review
STR: Using some DOM API client (like the test app submitted in bug 929917 attachment 8389549 [details]): - Invoke navigator.mozId.request() - Go through UI steps (either to sign up or sign in, it doesn't matter) Expected: onlogin() fires with assertion Actual: onerror() fires with {"error":"UI_ERROR","details":"InternalErrorWrongContentEvent"} Further notes: You are actually signed into the device at this point. If you call request() for a second time, onlogin() will be fired with an assertion as expected.
Assignee: nobody → spenrose
If it helps, this error is emitted from b2g/components/FxAccountsUIGlue.js, so that might be a good place to start digging.
gaia: apps/system/js/fxa_manager.js doing this: var event = new CustomEvent('mozFxAccountsRPContentEvent', msg) // msg is NEVER empty window.dispatchEvent(event); gecko: b2g/components/FxAccountsUIGlue.js is doing this: _browser = Services.wm.getMostRecentWindow("navigator:browser"); content = this._browser.getContentWindow(); content.addEventListener("mozFxAccountsRPContentEvent", function(result) { // result is an empty object }); Going to learn about CustomEvent.
The fix is a one-liner. PR coming; I have to set up a Gaia fork. diff --git a/apps/system/js/fxa_manager.js b/apps/system/js/fxa_manager.js index 358fce6..a3718f1 100644 --- a/apps/system/js/fxa_manager.js +++ b/apps/system/js/fxa_manager.js @@ -116,7 +116,7 @@ var FxAccountsManager = { }, _sendContentEvent: function fxa_mgmt_sendContentEvent(msg) { - var event = new CustomEvent('mozFxAccountsRPContentEvent', msg); + var event = new CustomEvent('mozFxAccountsRPContentEvent', {detail: msg}); window.dispatchEvent(event); },
Attached file Uses correct parameter
Attachment #8390174 - Flags: review?(jparsons)
Beautiful. This fixes the problem I reported in Comment 0. Merged! Thanks, Sam, j
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Attachment #8390174 - Flags: review?(jparsons) → review+
Thanks for the fix Sam! Just a friendly reminder for following bugs: make sure that we get a review from a system peer [1] and the commit message contains the bug number and the reviewer's name on it as described in [2], please :) [1] https://wiki.mozilla.org/Modules/FirefoxOS#System [2] https://developer.mozilla.org/en-US/Firefox_OS/Platform/Gaia/Hacking#Submitting_a_patch
Component: Identity → FxA
Product: Core → Firefox OS
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: