From 0acc68dadfc1d74a94dd6e50f94ce3dd15eb578c Mon Sep 17 00:00:00 2001 From: Lloyd Hilaiel <lloyd@hilaiel.com> Date: Fri, 23 Sep 2011 14:23:20 -0600 Subject: [PATCH] fix issue where hash changes during dialog interaction would break things. extract relay frame id from hash at load time. closes #295 --- browserid/static/dialog/resources/channel.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/browserid/static/dialog/resources/channel.js b/browserid/static/dialog/resources/channel.js index 7c71c2d1d..88d019c83 100644 --- a/browserid/static/dialog/resources/channel.js +++ b/browserid/static/dialog/resources/channel.js @@ -113,18 +113,22 @@ // (has window.opener) as well as whether the relay function exists. // If these conditions are not met, then print an appropriate message. + // get the relay here at the time the channel is setup before any navigation has + // occured. if we wait the window hash might change as a side effect to user + // navigation, which would cause us to not find our parent window. + // issue #295 + var relay = getRPRelay(); + function onsuccess(rv) { // Get the relay here so that we ensure that the calling window is still // open and we aren't causing a problem. - var relay = getRPRelay(); - if(relay) { + if (relay) { relay(rv, null); } } function onerror(error) { - var relay = getRPRelay(); - if(relay) { + if (relay) { relay(null, error); } } -- GitLab