Bug 1261842 - Tests in browser_windowStateContainer.js should wait for new browser windows to completely load. r=baku
☠☠ backed out by ad32bf1994e9 ☠ ☠
authorMike Conley <mconley@mozilla.com>
Wed, 08 Jun 2016 10:48:15 -0400
changeset 330729 d6ffc9db53461550f8965e3587244b5b9d68eab6
parent 330728 2a1acfd17baf3a269719c70cdd5b273e8b344b41
child 330730 c14ccfac7b4b635cad9f728b85767deef68078be
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1261842
milestone50.0a1
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);