Merge mozilla-central into mozilla-inbound
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 13 Nov 2012 18:40:56 -0800
changeset 113187 29c26199e717ab78a325ea51634c2ea34f5365bd
parent 113186 314b42bfc87c113347e6be257aff480dba388b7e (current diff)
parent 113131 4e9567eeb09e41d1b8c71c2ba275c2d7ee2dcec2 (diff)
child 113188 875aceabf236b75d5b6631d39d4a75d56d55a64d
push id23859
push useremorley@mozilla.com
push dateWed, 14 Nov 2012 14:36:31 +0000
treeherdermozilla-central@87928cd21b40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone19.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
Merge mozilla-central into mozilla-inbound
--- a/browser/components/privatebrowsing/test/browser/perwindow/Makefile.in
+++ b/browser/components/privatebrowsing/test/browser/perwindow/Makefile.in
@@ -24,11 +24,12 @@ MOCHITEST_BROWSER_FILES =  \
 		browser_privatebrowsing_geoprompt.js \
 		browser_privatebrowsing_geoprompt_page.html \
 		browser_privatebrowsing_lastpbcontextexited.js \
 		browser_privatebrowsing_localStorage.js \
 		browser_privatebrowsing_localStorage_page1.html \
 		browser_privatebrowsing_localStorage_page2.html \
 		browser_privatebrowsing_opendir.js \
 		browser_privatebrowsing_theming.js \
+		browser_privatebrowsing_zoomrestore.js \
 		$(NULL)
 
 include $(topsrcdir)/config/rules.mk
copy from browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_zoomrestore.js
copy to browser/components/privatebrowsing/test/browser/perwindow/browser_privatebrowsing_zoomrestore.js
--- a/browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_zoomrestore.js
+++ b/browser/components/privatebrowsing/test/browser/perwindow/browser_privatebrowsing_zoomrestore.js
@@ -2,54 +2,62 @@
  * 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 makes sure that about:privatebrowsing does not appear zoomed in
 // if there is already a zoom site pref for about:blank (bug 487656).
 
 function test() {
   // initialization
-  let pb = Cc["@mozilla.org/privatebrowsing;1"].
-           getService(Ci.nsIPrivateBrowsingService);
   waitForExplicitFinish();
-
-  let tabBlank = gBrowser.selectedTab;
-  let blankBrowser = gBrowser.getBrowserForTab(tabBlank);
-  blankBrowser.addEventListener("load", function() {
-    blankBrowser.removeEventListener("load", arguments.callee, true);
+  let windowsToClose = [];
+  let windowsToReset = [];
 
-    // change the zoom on the blank page
-    FullZoom.enlarge();
-    isnot(ZoomManager.zoom, 1, "Zoom level for about:blank should be changed");
-
-    // enter private browsing mode
-    pb.privateBrowsingEnabled = true;
-    let tabAboutPB = gBrowser.selectedTab;
-    let browserAboutPB = gBrowser.getBrowserForTab(tabAboutPB);
-    browserAboutPB.addEventListener("load", function() {
-      browserAboutPB.removeEventListener("load", arguments.callee, true);
-      setTimeout(function() {
+  function doTest(aIsZoomedWindow, aWindow, aCallback) {
+    aWindow.gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
+      aWindow.gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
+      if (aIsZoomedWindow) {
+        // change the zoom on the blank page
+        aWindow.FullZoom.enlarge();
+        isnot(aWindow.ZoomManager.zoom, 1, "Zoom level for about:blank should be changed");
+      } else {
         // make sure the zoom level is set to 1
-        is(ZoomManager.zoom, 1, "Zoom level for about:privatebrowsing should be reset");
-        finishTest();
-      }, 0);
+        is(aWindow.ZoomManager.zoom, 1, "Zoom level for about:privatebrowsing should be reset");
+      }
+
+      aCallback();
     }, true);
-  }, true);
-  blankBrowser.loadURI("about:blank");
-}
+
+    aWindow.gBrowser.selectedBrowser.loadURI("about:blank");
+  }
+
+  function finishTest() {
+    // cleanup
+    windowsToReset.forEach(function(win) {
+      win.FullZoom.reset();
+    });
+    finish();
+  }
 
-function finishTest() {
-  let pb = Cc["@mozilla.org/privatebrowsing;1"].
-           getService(Ci.nsIPrivateBrowsingService);
-  // leave private browsing mode
-  pb.privateBrowsingEnabled = false;
-  let tabBlank = gBrowser.selectedTab;
-  let blankBrowser = gBrowser.getBrowserForTab(tabBlank);
-  blankBrowser.addEventListener("load", function() {
-    blankBrowser.removeEventListener("load", arguments.callee, true);
+  function testOnWindow(options, callback) {
+    let win = OpenBrowserWindow(options);
+    win.addEventListener("load", function onLoad() {
+      win.removeEventListener("load", onLoad, false);
+      windowsToClose.push(win);
+      windowsToReset.push(win);
+      executeSoon(function() callback(win));
+    }, false);
+  };
 
-    executeSoon(function() {
-      // cleanup
-      FullZoom.reset();
-      finish();
+  registerCleanupFunction(function() {
+    windowsToClose.forEach(function(win) {
+      win.close();
     });
-  }, true);
+  });
+
+  testOnWindow({}, function(win) {
+    doTest(true, win, function() {
+      testOnWindow({private: true}, function(win) {
+        doTest(false, win, finishTest);
+      });
+    });
+  });
 }