Bug 1261842 - Tests in browser_windowStateContainer.js should wait for new browser windows to completely load. r=baku
authorMike Conley <mconley@mozilla.com>
Wed, 08 Jun 2016 10:48:15 -0400
changeset 346298 cf6ffd4bc0227f3dc8e7c8a66988c1be710cf3f1
parent 346297 402b6b26d2ebd5ee554adae42b9ec4279372b175
child 346299 cb6168f1e8410d7beb56757f007297094e14a713
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1261842
milestone50.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 1261842 - Tests in browser_windowStateContainer.js should wait for new browser windows to completely load. r=baku MozReview-Commit-ID: 8SyED1dQbM5
browser/components/sessionstore/test/browser_windowStateContainer.js
--- a/browser/components/sessionstore/test/browser_windowStateContainer.js
+++ b/browser/components/sessionstore/test/browser_windowStateContainer.js
@@ -1,15 +1,14 @@
 "use strict";
 
 requestLongerTimeout(2);
 
 add_task(function* () {
-  let win = window.openDialog(location, "_blank", "chrome,all,dialog=no");
-  yield promiseWindowLoaded(win);
+  let win = yield BrowserTestUtils.openNewBrowserWindow();
 
   // Create 4 tabs with different userContextId.
   for (let userContextId = 1; userContextId < 5; userContextId++) {
     let tab = win.gBrowser.addTab("http://example.com/", {userContextId});
     yield promiseBrowserLoaded(tab.linkedBrowser);
     yield TabStateFlusher.flush(tab.linkedBrowser);
   }
 
@@ -21,18 +20,17 @@ add_task(function* () {
 
   let winState = JSON.parse(ss.getWindowState(win));
 
   for (let i = 0; i < 4; i++) {
     Assert.equal(winState.windows[0].tabs[i].userContextId, i + 1,
                  "1st Window: tabs[" + i + "].userContextId should exist.");
   }
 
-  let win2 = window.openDialog(location, "_blank", "chrome,all,dialog=no");
-  yield promiseWindowLoaded(win2);
+  let win2 = yield BrowserTestUtils.openNewBrowserWindow();
 
   // Create tabs with different userContextId, but this time we create them with
   // fewer tabs and with different order with win.
   for (let userContextId = 3; userContextId > 0; userContextId--) {
     let tab = win2.gBrowser.addTab("http://example.com/", {userContextId});
     yield promiseBrowserLoaded(tab.linkedBrowser);
     yield TabStateFlusher.flush(tab.linkedBrowser);
   }
@@ -64,35 +62,34 @@ add_task(function* () {
                  "The document has the correct userContextId");
   });
 
   yield BrowserTestUtils.closeWindow(win);
   yield BrowserTestUtils.closeWindow(win2);
 });
 
 add_task(function* () {
-  let win = window.openDialog(location, "_blank", "chrome,all,dialog=no");
-  yield promiseWindowLoaded(win);
+  let win = yield BrowserTestUtils.openNewBrowserWindow();
+  yield TabStateFlusher.flush(win.gBrowser.selectedBrowser);
 
   let tab = win.gBrowser.addTab("http://example.com/", { userContextId: 1 });
   yield promiseBrowserLoaded(tab.linkedBrowser);
   yield TabStateFlusher.flush(tab.linkedBrowser);
 
   // win should have 1 default tab, and 1 container tab.
   Assert.equal(win.gBrowser.tabs.length, 2, "win should have 2 tabs");
 
   let winState = JSON.parse(ss.getWindowState(win));
 
   for (let i = 0; i < 2; i++) {
     Assert.equal(winState.windows[0].tabs[i].userContextId, i,
                  "1st Window: tabs[" + i + "].userContextId should be " + i);
   }
 
-  let win2 = window.openDialog(location, "_blank", "chrome,all,dialog=no");
-  yield promiseWindowLoaded(win2);
+  let win2 = yield BrowserTestUtils.openNewBrowserWindow();
 
   let tab2 = win2.gBrowser.addTab("http://example.com/", { userContextId : 1 });
   yield promiseBrowserLoaded(tab2.linkedBrowser);
   yield TabStateFlusher.flush(tab2.linkedBrowser);
 
   // Move the first normal tab to end, so the first tab of win2 will be a
   // container tab.
   win2.gBrowser.moveTabTo(win2.gBrowser.tabs[0], win2.gBrowser.tabs.length - 1);