diff --git a/browserid/static/include.js b/browserid/static/include.js index e899d6b475e1acfad4765b4121ef639c1cda28e7..00a924a8d692755225842b3cb79479cd416ee0b8 100644 --- a/browserid/static/include.js +++ b/browserid/static/include.js @@ -575,8 +575,8 @@ if (!navigator.id.getVerifiedEmail || navigator.id._getVerifiedEmailIsShimmed) function _open_relay_frame(doc) { var iframe = doc.createElement("iframe"); iframe.setAttribute('name', 'browserid_relay'); - iframe.setAttribute('src', ipServer + "/relay"); - iframe.style.display = "none"; + iframe.setAttribute('src', ipServer + "/relay.html"); + //iframe.style.display = "none"; doc.body.appendChild(iframe); return iframe; } diff --git a/browserid/views/relay.ejs b/browserid/views/relay.ejs index 0ffdfb21d5de4377d9ce55e73f13296c4fb45973..203d0c6c7854cd84ee1e0b430e214661882adffd 100644 --- a/browserid/views/relay.ejs +++ b/browserid/views/relay.ejs @@ -6,6 +6,39 @@ </head> <body> Relay iframe. Woohoo! - <script type='text/javascript' src='https://browserid.org/steal/steal<%= production ? ".production" : "" %>.js?relay'></script> + <script type="text/javascript" src="https://browserid.org/dialog/resources/jschannel.js"></script> + <script type="text/javascript"> + var ipServer = "https://browserid.org"; + + var chan = Channel.build( { + window: window.parent, + origin: "*", + scope: "mozid" + } ); + + var transaction; + + chan.bind("getVerifiedEmail", function(trans, s) { + trans.delayReturn(true); + + transaction = trans; + }); + + window.browserid_relay = function(status, error) { + if(error) { + errorOut(transaction, error); + } + else { + try { + transaction.complete(status); + } catch(e) { + // The relay function is called a second time after the + // initial success, when the window is closing. + } + } + } + + </script> + <!--script type='text/javascript' src='https://browserid.org/steal/steal<%= production ? ".production" : "" %>.js?relay'></script--> </body> </html>