Bug 1132566 - Make test e10s compatible: browser_privatebrowsing_aboutSessionRestore.js; r=mconley
authorSteven MacLeod <smacleod@mozilla.com>
Wed, 11 Feb 2015 20:21:37 -0500
changeset 233817 b6d4485350048d715e8586fe23a77413ca70ee5d
parent 233816 8c349714246d33d6179544822298f150f6c55d85
child 233818 f92f9ce023370e0a19596246a94dd87c58ad68db
push id28425
push usercbook@mozilla.com
push dateTue, 17 Mar 2015 10:33:06 +0000
treeherdermozilla-central@a194e8023090 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1132566
milestone39.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 1132566 - Make test e10s compatible: browser_privatebrowsing_aboutSessionRestore.js; r=mconley
browser/components/privatebrowsing/test/browser/browser.ini
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_aboutSessionRestore.js
--- a/browser/components/privatebrowsing/test/browser/browser.ini
+++ b/browser/components/privatebrowsing/test/browser/browser.ini
@@ -17,17 +17,16 @@ support-files =
 
 [browser_privatebrowsing_DownloadLastDirWithCPS.js]
 skip-if = e10s
 [browser_privatebrowsing_aboutHomeButtonAfterWindowClose.js]
 skip-if = true # Bug 1142678 - Loading a message sending frame script into a private about:home tab causes leaks
 [browser_privatebrowsing_aboutHomeButtonAfterWindowClose_old.js]
 skip-if = e10s
 [browser_privatebrowsing_aboutSessionRestore.js]
-skip-if = e10s
 [browser_privatebrowsing_cache.js]
 skip-if = e10s
 [browser_privatebrowsing_certexceptionsui.js]
 skip-if = e10s
 [browser_privatebrowsing_concurrent.js]
 skip-if = e10s
 [browser_privatebrowsing_cookieacceptdialog.js]
 skip-if = e10s
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_aboutSessionRestore.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_aboutSessionRestore.js
@@ -1,49 +1,24 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // This test checks that the session restore button from about:sessionrestore
 // is disabled in private mode
+add_task(function* testNoSessionRestoreButton() {
+  // Opening, then closing, a private window shouldn't create session data.
+  (yield BrowserTestUtils.openNewBrowserWindow({private: true})).close();
 
-function test() {
-  waitForExplicitFinish();
+  let win = yield BrowserTestUtils.openNewBrowserWindow({private: true});
+  let tab = win.gBrowser.addTab("about:sessionrestore");
+  let browser = tab.linkedBrowser;
 
-  function testNoSessionRestoreButton() {
-    let win = OpenBrowserWindow({private: true});
-    win.addEventListener("load", function onLoad() {
-      win.removeEventListener("load", onLoad, false);
-      executeSoon(function() {
-        info("The second private window got loaded");
-        let newTab = win.gBrowser.addTab("about:sessionrestore");
-        win.gBrowser.selectedTab = newTab;
-        let tabBrowser = win.gBrowser.getBrowserForTab(newTab);
-        tabBrowser.addEventListener("load", function tabLoadListener() {
-          if (win.gBrowser.contentWindow.location != "about:sessionrestore") {
-            win.gBrowser.selectedBrowser.loadURI("about:sessionrestore");
-            return;
-          }
-          tabBrowser.removeEventListener("load", tabLoadListener, true);
-          executeSoon(function() {
-            info("about:sessionrestore got loaded");
-            let restoreButton = win.gBrowser.contentDocument
-                                            .getElementById("errorTryAgain");
-            ok(restoreButton.disabled,
-               "The Restore about:sessionrestore button should be disabled");
-            win.close();
-            finish();
-          });
-        }, true);
-      });
-    }, false);
-  }
+  yield BrowserTestUtils.browserLoaded(browser);
 
-  let win = OpenBrowserWindow({private: true});
-  win.addEventListener("load", function onload() {
-    win.removeEventListener("load", onload, false);
-    executeSoon(function() {
-      info("The first private window got loaded");
-      win.close();
-      testNoSessionRestoreButton();
-    });
-  }, false);
-}
+  let disabled = yield ContentTask.spawn(browser, {}, function* (){
+    return content.document.getElementById("errorTryAgain").disabled;
+  });
+
+  ok(disabled, "The Restore about:sessionrestore button should be disabled");
+
+  win.close();
+});