Bug 806708 - Remove the global private browsing checks from browser_tabMatchesInAwesomebar.js in per-window PB mode; r=jdm
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 05 Dec 2012 09:03:38 -0500
changeset 115040 545107c3b807cce9b1a95e7d03776b314e858af5
parent 115039 2812c6500aed86af4edc7479476f53fce7e3970f
child 115041 dc706e0d5c1c694283ed50df1a75eccd70125743
push id23953
push usereakhgari@mozilla.com
push dateWed, 05 Dec 2012 16:32:26 +0000
treeherdermozilla-central@dc706e0d5c1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs806708
milestone20.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 806708 - Remove the global private browsing checks from browser_tabMatchesInAwesomebar.js in per-window PB mode; r=jdm
browser/base/content/test/Makefile.in
browser/base/content/test/browser_tabMatchesInAwesomebar_perwindowpb.js
--- a/browser/base/content/test/Makefile.in
+++ b/browser/base/content/test/Makefile.in
@@ -246,17 +246,16 @@ endif
                  plugin_clickToPlayDeny.html \
                  plugin_bug749455.html \
                  plugin_bug797677.html \
                  plugin_hidden_to_visible.html \
                  plugin_two_types.html \
                  alltabslistener.html \
                  zoom_test.html \
                  dummy_page.html \
-                 browser_tabMatchesInAwesomebar.js \
                  file_bug550565_popup.html \
                  file_bug550565_favicon.ico \
                  browser_aboutHome.js \
                  app_bug575561.html \
                  app_subframe_bug575561.html \
                  browser_contentAreaClick.js \
                  browser_addon_bar_close_button.js \
                  browser_addon_bar_shortcut.js \
@@ -313,22 +312,24 @@ endif
 ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
 _BROWSER_FILES += \
                 browser_bug763468_perwindowpb.js \
                 browser_bug767836_perwindowpb.js \
                 browser_bug816527.js \
                 browser_private_browsing_window.js \
                 browser_save_link-perwindowpb.js \
                 browser_save_private_link_perwindowpb.js \
+                browser_tabMatchesInAwesomebar_perwindowpb.js \
                 $(NULL)
 else
 _BROWSER_FILES += \
                 browser_bug763468.js \
                 browser_bug767836.js \
                 browser_save_link.js \
                 browser_save_private_link.js \
+                browser_tabMatchesInAwesomebar.js \
                 $(NULL)
 endif
 
 include $(topsrcdir)/config/rules.mk
 
 libs::	$(_BROWSER_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
copy from browser/base/content/test/browser_tabMatchesInAwesomebar.js
copy to browser/base/content/test/browser_tabMatchesInAwesomebar_perwindowpb.js
--- a/browser/base/content/test/browser_tabMatchesInAwesomebar.js
+++ b/browser/base/content/test/browser_tabMatchesInAwesomebar_perwindowpb.js
@@ -4,18 +4,16 @@
  * 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/. */
 
 const TEST_URL_BASES = [
   "http://example.org/browser/browser/base/content/test/dummy_page.html#tabmatch",
   "http://example.org/browser/browser/base/content/test/moz.png#tabmatch"
 ];
 
-var gPrivateBrowsing = Cc["@mozilla.org/privatebrowsing;1"].
-                         getService(Ci.nsIPrivateBrowsingService);
 var gController = Cc["@mozilla.org/autocomplete/controller;1"].
                   getService(Ci.nsIAutoCompleteController);
 
 var gTabWaitCount = 0;
 var gTabCounter = 0;
 
 var gTestSteps = [
   function() {
@@ -35,126 +33,53 @@ var gTestSteps = [
       loadTab(gBrowser.tabs[i], TEST_URL_BASES[1] + (++gTabCounter));
   },
   function() {
     info("Running step 3");
     for (let i = 1; i < gBrowser.tabs.length; i++)
       loadTab(gBrowser.tabs[i], TEST_URL_BASES[0] + gTabCounter);
   },
   function() {
-    info("Running step 4");
-    let ps = Services.prefs;
-    ps.setBoolPref("browser.privatebrowsing.keep_current_session", true);
-    ps.setBoolPref("browser.tabs.warnOnClose", false);
-
-    // Make sure that all restored tabs are loaded without waiting for the user
-    // to bring them to the foreground. We ensure this by resetting the
-    // related preference (see the "firefox.js" defaults file for details).
-    ps.setBoolPref("browser.sessionstore.restore_on_demand", false);
-
-    gPrivateBrowsing.privateBrowsingEnabled = true;
-
-    executeSoon(function() {
-      ensure_opentabs_match_db(nextStep);
-    });
-  },
-  function() {
-    info("Running step 5");
-    gPrivateBrowsing.privateBrowsingEnabled = false;
-
-    executeSoon(function() {
-      let ps = Services.prefs;
-      ps.clearUserPref("browser.privatebrowsing.keep_current_session");
-      ps.clearUserPref("browser.tabs.warnOnClose");
-
-      ensure_opentabs_match_db(nextStep);
-    });
-  },
-  function() {
-    info("Running step 6 - ensure we don't register subframes as open pages");
+    info("Running step 4 - ensure we don't register subframes as open pages");
     let tab = gBrowser.addTab();
     tab.linkedBrowser.addEventListener("load", function () {
       tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
       // Start the sub-document load.
       executeSoon(function () {
         tab.linkedBrowser.addEventListener("load", function (e) {
           tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
             ensure_opentabs_match_db(nextStep);
         }, true);
         tab.linkedBrowser.contentDocument.querySelector("iframe").src = "http://test2.example.org/";
       });
     }, true);
     tab.linkedBrowser.loadURI('data:text/html,<body><iframe src=""></iframe></body>');
   },
   function() {
-    info("Running step 7 - remove tab immediately");
+    info("Running step 5 - remove tab immediately");
     let tab = gBrowser.addTab("about:logo");
     gBrowser.removeTab(tab);
     ensure_opentabs_match_db(nextStep);
   },
   function() {
-    info("Running step 8 - check swapBrowsersAndCloseOther preserves registered switch-to-tab result");
+    info("Running step 6 - check swapBrowsersAndCloseOther preserves registered switch-to-tab result");
     let tabToKeep = gBrowser.addTab();
     let tab = gBrowser.addTab();
     tab.linkedBrowser.addEventListener("load", function () {
       tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
       gBrowser.swapBrowsersAndCloseOther(tabToKeep, tab);
       ensure_opentabs_match_db(function () {
         gBrowser.removeTab(tabToKeep);
         ensure_opentabs_match_db(nextStep);
       });
     }, true);
     tab.linkedBrowser.loadURI("about:mozilla");
   },
   function() {
-    info("Running step 9 - enter private browsing mode, without keeping session");
-    let ps = Services.prefs;
-    ps.setBoolPref("browser.privatebrowsing.keep_current_session", false);
-    ps.setBoolPref("browser.tabs.warnOnClose", false);
-
-    Services.obs.addObserver(function(aSubject, aTopic, aData) {
-      Services.obs.removeObserver(arguments.callee, "private-browsing-transition-complete");
-
-      for (let i = 0; i < gBrowser.tabs.length; i++)
-        waitForRestoredTab(gBrowser.tabs[i]);
-    }, "private-browsing-transition-complete", false);
-
-    gPrivateBrowsing.privateBrowsingEnabled = true;
-  },
-  function() {
-    info("Running step 10 - open tabs in private browsing mode");
-    for (let i = 0; i < 3; i++) {
-      let tab = gBrowser.addTab();
-      loadTab(tab, TEST_URL_BASES[0] + (++gTabCounter));
-    }
-  },
-  function() {
-    info("Running step 11 - close tabs in private browsing mode");
-    gBrowser.removeCurrentTab();
-    ensure_opentabs_match_db(nextStep);
-  },
-  function() {
-    info("Running step 12 - leave private browsing mode");
-
-    Services.obs.addObserver(function(aSubject, aTopic, aData) {
-      Services.obs.removeObserver(arguments.callee, "private-browsing-transition-complete");
-
-      let ps = Services.prefs;
-      ps.clearUserPref("browser.privatebrowsing.keep_current_session");
-      ps.clearUserPref("browser.tabs.warnOnClose");
-
-      for (let i = 1; i < gBrowser.tabs.length; i++)
-        waitForRestoredTab(gBrowser.tabs[i]);
-
-    }, "private-browsing-transition-complete", false);
-
-    gPrivateBrowsing.privateBrowsingEnabled = false;
-  },
-  function() {
-    info("Running step 13 - close all tabs");
+    info("Running step 7 - close all tabs");
 
     Services.prefs.clearUserPref("browser.sessionstore.restore_on_demand");
 
     gBrowser.addTab("about:blank", {skipAnimation: true});
     while (gBrowser.tabs.length > 1) {
       info("Removing tab: " + gBrowser.tabs[0].linkedBrowser.currentURI.spec);
       gBrowser.selectTabAtIndex(0);
       gBrowser.removeCurrentTab();
@@ -167,17 +92,17 @@ var gTestSteps = [
 
 function test() {
   waitForExplicitFinish();
   nextStep();
 }
 
 function loadTab(tab, url) {
   // Because adding visits is async, we will not be notified immediately.
-  let visited = gPrivateBrowsing.privateBrowsingEnabled;
+  let visited = false;
   let loaded = false;
 
   function maybeCheckResults() {
     if (visited && loaded && --gTabWaitCount == 0) {
       ensure_opentabs_match_db(nextStep);
     }
   }