Bug 633711. (Cv1) browser_394759.js: Port FF changeset cd888c5d77f0 and changeset a6fe7bb368a9, Add browserWindowsCount() calls, Do 3 s/gBrowser/getBrowser()/. r=neil.
authorSerge Gautherie <sgautherie.bz@free.fr>
Mon, 12 Mar 2012 02:18:40 +0100
changeset 11054 5d0e20c979050cbb43db085867b0b0ed77bcec15
parent 11053 862863b8547f88c84be3d8dbf5d330562388b2ee
child 11055 594a1c24f23fcebae8f16d6bf1e55c6e0d53bdc3
push id463
push userbugzilla@standard8.plus.com
push dateTue, 24 Apr 2012 17:34:51 +0000
treeherdercomm-beta@e53588e8f7b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersneil
bugs633711
Bug 633711. (Cv1) browser_394759.js: Port FF changeset cd888c5d77f0 and changeset a6fe7bb368a9, Add browserWindowsCount() calls, Do 3 s/gBrowser/getBrowser()/. r=neil.
suite/common/tests/browser/browser_394759.js
--- a/suite/common/tests/browser/browser_394759.js
+++ b/suite/common/tests/browser/browser_394759.js
@@ -154,29 +154,29 @@ function test() {
         executeSoon(recCallback);
         return;
       }
       // 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;
-      let window = openDialog(location, "_blank", settings, url);
-      window.addEventListener("load", function loadListener5(aEvent) {
-        window.removeEventListener("load", loadListener5, false);
+      let win = openDialog(location, "", settings, url);
+      win.addEventListener("load", function loadListener5(aEvent) {
+        win.removeEventListener("load", loadListener5, false);
 
-        window.gBrowser.addEventListener("load", function loadListener6(aEvent) {
-          window.gBrowser.removeEventListener("load", loadListener6, true);
+        win.getBrowser().selectedBrowser.addEventListener("DOMContentLoaded", function loadListener6(aEvent) {
+          win.getBrowser().selectedBrowser.removeEventListener("DOMContentLoaded", loadListener6, true);
           // the window _should_ have state with a tab of url, but it doesn't
           // always happend before window.close(). addTab ensure we don't treat
           // this window as a stateless window
-          window.gBrowser.addTab();
+          win.getBrowser().addTab();
 
           executeSoon(function() {
-            window.close();
+            win.close();
             executeSoon(function() {
               openWindowRec(windowsToOpen, expectedResults, recCallback);
             });
           });
         }, true);
       }, false);
     }
 
@@ -194,14 +194,17 @@ function test() {
                           {isPopup: false}];
     let expectedResults2 = {mac: {popup: 0, normal: 3},
                             other: {popup: 0, normal: 3}};
     openWindowRec(windowsToOpen, expectedResults, function() {
       openWindowRec(windowsToOpen2, expectedResults2, callback);
     });
   }
 
+  is(browserWindowsCount(), 1, "Only one browser window should be open initially");
   test_basic(function() {
+    is(browserWindowsCount(), 1, "number of browser windows after test_basic");
     test_behavior(function() {
+      is(browserWindowsCount(), 1, "number of browser windows after test_behavior");
         finish();
     });
   });
 }