diff --git a/resources/static/dialog/resources/channel.js b/resources/static/dialog/resources/channel.js index 859d641b8b266a4bb6a9c5719c1cc3af5b893030..04cdd2b7836a71248986c5f5162e4263174941f3 100644 --- a/resources/static/dialog/resources/channel.js +++ b/resources/static/dialog/resources/channel.js @@ -57,8 +57,7 @@ onCompleteCallback; function getRelayName() { - var relayID = win.location.href.slice(win.location.href.indexOf('#') + 1); - return "browserid_relay_" + relayID; + return window.localStorage.RELAYFRAME_NAME; } function getRelayWindow() { @@ -91,7 +90,6 @@ onCompleteCallback = onComplete; controller.getVerifiedEmail(origin, onsuccess, onerror); }); - win.location.hash = ''; } else { throw "relay frame not found"; diff --git a/resources/static/include.js b/resources/static/include.js index d9d07938c0ced8b7d3f93131dbd60b9681c1423c..5366ba8d9903ecf515102fbb23070d8ece4e8c20 100644 --- a/resources/static/include.js +++ b/resources/static/include.js @@ -757,25 +757,17 @@ var frameid = _get_relayframe_id(); var iframe = _open_relayframe("browserid_relay_" + frameid); - w = _open_window(); - - // if the RP window closes, close the dialog as well. - _attach_event(window, 'unload', cleanup); + // first we build the channel to the IFRAME + // and make the call. THEN we will open the window + // no need to wait for channel ready. + // clean up a previous channel that never was reaped if (chan) chan.destroy(); chan = Channel.build({ window: iframe.contentWindow, origin: ipServer, - scope: "mozid", - onReady: function() { - // We have to change the name of the relay frame every time or else Firefox - // has a problem re-attaching new iframes with the same name. Code inside - // of frames with the same name sometimes does not get run. - // See https://bugzilla.mozilla.org/show_bug.cgi?id=350023 - //w = _open_window(ipServer + "/sign_in#" + frameid); - w.location = ipServer + "/sign_in#" +frameid; - } + scope: "mozid" }); chan.call({ @@ -793,6 +785,12 @@ cleanup(); } }); + + // open the window now that all else is ready + w = _open_window(ipServer + "/sign_in"); + + // if the RP window closes, close the dialog as well. + _attach_event(window, 'unload', cleanup); } }; diff --git a/resources/static/relay/relay.js b/resources/static/relay/relay.js index d9c86f4c13d0b4122eb43610ae4662769ce1c06e..d919aa8ff2bd51110e6f76a3d82ec75ce9f52b57 100644 --- a/resources/static/relay/relay.js +++ b/resources/static/relay/relay.js @@ -39,6 +39,8 @@ (function() { "use strict"; + window.localStorage.RELAYFRAME_NAME = window.name; + window.console = window.console || { log: function() {} };