Bug 1047603 - Fix browser_394759_behaviour.js test. r=ttaubert.
authorMike Conley <mconley@mozilla.com>
Mon, 26 Jan 2015 15:21:34 -0500
changeset 242189 be43b4de674dac19ea48a5ed23d7bb64fca734fd
parent 242188 573126edf2c8e851dc44bc2348af056994537f43
child 242190 179ab8bb80aeb209b9c7ce2565defa1395ed9e02
push id649
push userwcosta@mozilla.com
push dateWed, 11 Feb 2015 16:57:44 +0000
reviewersttaubert
bugs1047603
milestone38.0a1
Bug 1047603 - Fix browser_394759_behaviour.js test. r=ttaubert. Turns out this test wasn't accustomed to newly created windows having initially non-remote browsers, and that we need to wait for them to redirect and restore in the content process before we can properly serialize the window.
browser/components/sessionstore/test/browser_394759_behavior.js
--- a/browser/components/sessionstore/test/browser_394759_behavior.js
+++ b/browser/components/sessionstore/test/browser_394759_behavior.js
@@ -34,21 +34,33 @@ function test() {
 
     // hack to force window to be considered a popup (toolbar=no didn't work)
     let winData = windowsToOpen.shift();
     let settings = "chrome,dialog=no," +
                    (winData.isPopup ? "all=no" : "all");
     let url = "http://example.com/?window=" + windowsToOpen.length;
 
     provideWindow(function onTestURLLoaded(win) {
-      win.close();
-      // Give it time to close
-      executeSoon(function() {
-        openWindowRec(windowsToOpen, expectedResults, recCallback);
-      });
+      let tabReady = () => {
+        win.close();
+        // Give it time to close
+        executeSoon(function() {
+          openWindowRec(windowsToOpen, expectedResults, recCallback);
+        });
+      };
+
+      if (win.gMultiProcessBrowser) {
+        let tab = win.gBrowser.selectedTab;
+        tab.addEventListener("SSTabRestored", function onTabRestored() {
+          tab.removeEventListener("SSTabRestored", onTabRestored);
+          tabReady();
+        });
+      } else {
+        tabReady();
+      }
     }, url, settings);
   }
 
   let windowsToOpen = [{isPopup: false},
                        {isPopup: false},
                        {isPopup: true},
                        {isPopup: true},
                        {isPopup: true}];