From 692605e64ffc8429adcc26ad565e024caaa2470d Mon Sep 17 00:00:00 2001 From: Ben Adida <ben@adida.net> Date: Wed, 16 Nov 2011 15:09:43 -0800 Subject: [PATCH] condition on the unbind handler, otherwise double complete call, part of figuring out issue #589 --- resources/static/dialog/controllers/dialog_controller.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/resources/static/dialog/controllers/dialog_controller.js b/resources/static/dialog/controllers/dialog_controller.js index daf337755..e2c7f3b97 100644 --- a/resources/static/dialog/controllers/dialog_controller.js +++ b/resources/static/dialog/controllers/dialog_controller.js @@ -118,8 +118,12 @@ self.doCheckAuth(); dom.bindEvent(win, "unload", function() { - bid.Storage.setStagedOnBehalfOf(""); - self.doCancel(); + // do this only if something else hasn't + // declared success + if (!self.success) { + bid.Storage.setStagedOnBehalfOf(""); + self.doCancel(); + } }); }, @@ -277,6 +281,7 @@ // calls window.close, which would trigger the onerror callback if we // tried this afterwards. self.onerror = null; + self.success = true; self.onsuccess(assertion); }, -- GitLab