-
Notifications
You must be signed in to change notification settings - Fork 193
Only register one FxA message handler (bug 1080347) #732
Only register one FxA message handler (bug 1080347) #732
Conversation
@@ -105,6 +105,13 @@ define('login', | |||
} | |||
})); | |||
|
|||
window.addEventListener('message', function (msg) { | |||
if (!msg.data || !msg.data.auth_code || msg.origin !== settings.api_url) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we check capabilities.fallbackFxA()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably a good idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should never get called if that's the case so I guess we can skip registering this then. We'll need to wait for site_config
to load first though.
r+ if you add a check for fallback fxa to add the handler |
@@ -306,6 +309,7 @@ define('login', | |||
// This lets us change the cursor for the "Sign in" link. | |||
persona_def.reject(); | |||
z.body.addClass('persona-loaded'); | |||
registerFxAPostMessageHandler(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why can this not happen in startLogin
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it will register a callback each time startLogin
is called and we'll send the token to zamboni as many times as you've clicked "Sign In" this session.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would probably help if you indicated what you want the comment to say :-)
https://bugzilla.mozilla.org/show_bug.cgi?id=1080347
Register the FxA message handler when
login.js
is loaded instead of when the "Sign In" button is clicked so we only ever register one handler.