Bug 1071225 - Fix closing the FxAccountsOAuthClient tab with e10s. r=MattN
authorvladikoff <vlad.filippov@gmail.com>
Tue, 23 Sep 2014 17:57:00 -0700
changeset 206864 1105c83a13bf468a474eb3f78f2c572bfcbdf827
parent 206863 a3f673c67d31e46e1bdb89f096a3c63002f4e8a1
child 206865 56a690a7c1bc9904b608e5a27e8466bf1d701457
push id27543
push userryanvm@gmail.com
push dateWed, 24 Sep 2014 20:02:22 +0000
treeherdermozilla-central@435732392989 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1071225
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1071225 - Fix closing the FxAccountsOAuthClient tab with e10s. r=MattN
browser/base/content/test/general/browser.ini
services/fxaccounts/FxAccountsOAuthClient.jsm
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -311,17 +311,16 @@ skip-if = e10s # Bug 918663 - DOMLinkAdd
 skip-if = true # browser_drag.js is disabled, as it needs to be updated for the new behavior from bug 320638.
 [browser_favicon_change.js]
 skip-if = e10s
 [browser_findbarClose.js]
 skip-if = e10s # Bug ?????? - test directly manipulates content (tries to grab an iframe directly from content)
 [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]
 [browser_hide_removing.js]
 [browser_homeDrop.js]
 skip-if = buildapp == 'mulet'
 [browser_identity_UI.js]
 skip-if = e10s # Bug ?????? - this test fails for obscure reasons on non-windows builds only.
--- a/services/fxaccounts/FxAccountsOAuthClient.jsm
+++ b/services/fxaccounts/FxAccountsOAuthClient.jsm
@@ -175,18 +175,32 @@ this.FxAccountsOAuthClient.prototype = {
             if (this.onComplete) {
               this.onComplete(result);
             }
             // onComplete will be called for this client only once
             // calling onComplete again will result in a failure of the OAuth flow
             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;
         }
       }
     };
 
     this._channelCallback = listener.bind(this);
     this._channel = new WebChannel(this._webChannelId, this._webChannelOrigin);