Bug 607482 - When in Private Mode, opening a new window causes FF button to flash orange and then turn purple; r=dao a=dietrich
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 29 Oct 2010 12:30:52 -0400
changeset 58613 8515f6bd4306c6e7cd5c9df44e0618598215d80c
parent 58612 4da141a1fbffea2d362a41e1b6b2a1392e855eb5
child 58614 23262313e08b2b7c2dd9ff8bff0c9515b9a73923
push id17381
push usereakhgari@mozilla.com
push dateSat, 04 Dec 2010 16:50:16 +0000
treeherdermozilla-central@23262313e08b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao, dietrich
bugs607482
milestone2.0b8pre
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 607482 - When in Private Mode, opening a new window causes FF button to flash orange and then turn purple; r=dao a=dietrich
browser/base/content/browser.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_newwindow_stopcmd.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_windowtitle.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1223,16 +1223,19 @@ function BrowserStartup() {
   CombinedStopReload.init();
 
   allTabs.readPref();
 
   TabsOnTop.syncCommand();
 
   BookmarksMenuButton.init();
 
+  // initialize the private browsing UI
+  gPrivateBrowsingUI.init();
+
   setTimeout(delayedStartup, 0, isLoadingBlank, mustLoadSidebar);
 }
 
 function HandleAppCommandEvent(evt) {
   evt.stopPropagation();
   switch (evt.command) {
   case "Back":
     BrowserBack();
@@ -1510,19 +1513,16 @@ function delayedStartup(isLoadingBlank, 
 
 #ifndef XP_MACOSX
   updateEditUIVisibility();
   let placesContext = document.getElementById("placesContext");
   placesContext.addEventListener("popupshowing", updateEditUIVisibility, false);
   placesContext.addEventListener("popuphiding", updateEditUIVisibility, false);
 #endif
 
-  // initialize the private browsing UI
-  gPrivateBrowsingUI.init();
-
   gBrowser.mPanelContainer.addEventListener("InstallBrowserTheme", LightWeightThemeWebInstaller, false, true);
   gBrowser.mPanelContainer.addEventListener("PreviewBrowserTheme", LightWeightThemeWebInstaller, false, true);
   gBrowser.mPanelContainer.addEventListener("ResetBrowserThemePreview", LightWeightThemeWebInstaller, false, true);
 
   if (Win7Features)
     Win7Features.onOpenWindow();
 
   // called when we go into full screen, even if it is
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_newwindow_stopcmd.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_newwindow_stopcmd.js
@@ -42,22 +42,21 @@ function test() {
   // initialization
   let pb = Cc["@mozilla.org/privatebrowsing;1"].
            getService(Ci.nsIPrivateBrowsingService);
   waitForExplicitFinish();
 
   pb.privateBrowsingEnabled = true;
 
   let win = OpenBrowserWindow();
-  Services.obs.addObserver(function(subject, topic, data) {
-    Services.obs.removeObserver(arguments.callee, "browser-delayed-startup-finished");
-    var notifiedWin = subject.QueryInterface(Ci.nsIDOMWindow);
-    is(win, notifiedWin, "sanity check");
+  win.addEventListener("load", function() {
+    win.removeEventListener("load", arguments.callee, false);
+    executeSoon(function() {
+      let cmd = win.document.getElementById("Tools:PrivateBrowsing");
+      ok(!cmd.hasAttribute("disabled"),
+         "The Private Browsing command in a new window should be enabled");
 
-    let cmd = win.document.getElementById("Tools:PrivateBrowsing");
-    ok(!cmd.hasAttribute("disabled"),
-       "The Private Browsing command in a new window should be enabled");
-
-    win.close();
-    pb.privateBrowsingEnabled = false;
-    finish();
-  }, "browser-delayed-startup-finished", false);
+      win.close();
+      pb.privateBrowsingEnabled = false;
+      finish();
+    });
+  }, false);
 }
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_windowtitle.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_windowtitle.js
@@ -88,29 +88,24 @@ function test() {
         is(document.title, expected_title, "The window title for " + url +
            " is correct (" + (insidePB ? "inside" : "outside") +
            " private browsing mode)");
 
         let win = gBrowser.replaceTabWithWindow(tab);
         win.addEventListener("load", function() {
           win.removeEventListener("load", arguments.callee, false);
 
-          // ensure that the test is run after delayedStartup
-          let _delayedStartup = win.delayedStartup;
-          win.delayedStartup = function() {
-            _delayedStartup.apply(win, arguments);
-            win.delayedStartup = _delayedStartup;
-
+          executeSoon(function() {
             is(win.document.title, expected_title, "The window title for " + url +
                " detached tab is correct (" + (insidePB ? "inside" : "outside") +
                " private browsing mode)");
             win.close();
 
             setTimeout(funcNext, 0);
-          };
+          });
         }, false);
       });
     }, false);
 
     browser.loadURI(url);
   }
 
   function cleanup() {