From f3905cbf49baa95995d1743f054448bf0b8295a8 Mon Sep 17 00:00:00 2001 From: vladikoff Date: Tue, 23 Sep 2014 17:57:00 -0700 Subject: [PATCH] Bug 1071225 - Fix closing the FxAccountsOAuthClient tab with e10s. r=MattN --HG-- extra : rebase_source : 5ffdd51c674dfc22ac301ab54b317b9219d8e07f --- browser/base/content/test/general/browser.ini | 1 - services/fxaccounts/FxAccountsOAuthClient.jsm | 18 ++++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/browser/base/content/test/general/browser.ini b/browser/base/content/test/general/browser.ini index 974ac8dcf8c1..b659c5739382 100644 --- a/browser/base/content/test/general/browser.ini +++ b/browser/base/content/test/general/browser.ini @@ -316,7 +316,6 @@ skip-if = e10s # Bug ?????? - test directly manipulates content (tries to grab a [browser_fullscreen-window-open.js] skip-if = buildapp == 'mulet' || e10s || os == "linux" # Bug 933103 - mochitest's EventUtils.synthesizeMouse functions not e10s friendly. Linux: Intermittent failures - bug 941575. [browser_fxa_oauth.js] -skip-if = e10s [browser_gestureSupport.js] skip-if = e10s # Bug 863514 - no gesture support. [browser_getshortcutoruri.js] diff --git a/services/fxaccounts/FxAccountsOAuthClient.jsm b/services/fxaccounts/FxAccountsOAuthClient.jsm index 0ef832776151..6ff42d866df7 100644 --- a/services/fxaccounts/FxAccountsOAuthClient.jsm +++ b/services/fxaccounts/FxAccountsOAuthClient.jsm @@ -180,8 +180,22 @@ this.FxAccountsOAuthClient.prototype = { this.tearDown(); // if the message asked to close the tab - if (data.closeWindow && target && target.contentWindow) { - target.contentWindow.close(); + if (data.closeWindow && target) { + // for e10s reasons the best way is to use the TabBrowser to close the tab. + let tabbrowser = target.getTabBrowser(); + + if (tabbrowser) { + let tab = tabbrowser._getTabForBrowser(target); + + if (tab) { + tabbrowser.removeTab(tab); + log.debug("OAuth flow closed the tab."); + } else { + log.debug("OAuth flow failed to close the tab. Tab not found in TabBrowser."); + } + } else { + log.debug("OAuth flow failed to close the tab. TabBrowser not found."); + } } break; }