Skip to content

Commit

Permalink
Bug 792795 - Call "dibs" on installing persona handlers
Browse files Browse the repository at this point in the history
Unfortunately, both (MKT)login.js and (AMO)browserid_support.js files
are included on some templates. This can lead to bad behaviors as the
wrong handler may be called for certain events.

The patch has a handler set a 'pers-handle' data handle on the page body
to indicate that it is handling the persona transactions.

added ; after returns
  • Loading branch information
jrconlin committed Oct 22, 2012
1 parent f67efd2 commit 61abeb9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
9 changes: 8 additions & 1 deletion media/js/mkt/login.js
Expand Up @@ -70,7 +70,14 @@ function init_persona() {
// quite ready.
if(navigator.id) {
if ($('body').data('pers-timeout')) {
clearTimeout($('body').data('pers-timeout'));
clearInterval($('body').data('pers-timeout'));
}
if ($('body').data('pers-handle')) {
/// there is another handler already installed.
return;
} else {
// call DIBS on persona event handling
$('body').data('pers-handle', true);
}
$('.browserid').css('cursor', 'pointer');
var email = '';
Expand Down
8 changes: 7 additions & 1 deletion media/js/zamboni/browserid_support.js
Expand Up @@ -48,8 +48,15 @@ function gotVerifiedEmail(assertion, redirectTo, domContext) {
return null;
};
}

function initBrowserID(win, ctx) {
// Initialize BrowserID login.
if ($('body').data('pers-handle')) {
return;
} else {
// call DIBS on persona event handling.
$('body').data('pers-handle', true);
}
var toArg = win.location.href.split('?to=')[1],
to = "/";

Expand All @@ -61,7 +68,6 @@ function initBrowserID(win, ctx) {
// No 'to' and not a log in page; redirect to the current page
to = win.location.href;
}

$(ctx || win).delegate('.browserid-login', 'click', function(e) {
var $el = $(this),
// If there's a data-event on the login button, fire that event
Expand Down

0 comments on commit 61abeb9

Please sign in to comment.