Bug 529922 - Make sure that delayedStartup has run, therefore the test is valid; r=gavin
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 03 Jun 2010 21:31:07 -0400
changeset 43414 4e6e91e0a42b2161a05776cdf4860afc55a9c352
parent 43413 769defc70de5334923e2c11e94459dbe8c57fcab
child 43415 41b7a6acaa16e24550d9e9748e39ad7170577e25
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin
bugs529922
milestone1.9.3a5pre
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 529922 - Make sure that delayedStartup has run, therefore the test is valid; r=gavin
browser/base/content/browser.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_newwindow_stopcmd.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1398,16 +1398,18 @@ function delayedStartup(isLoadingBlank, 
   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();
 
   TabsOnTop.syncCommand();
+
+  Services.obs.notifyObservers(window, "browser-delayed-startup-finished", "");
 }
 
 function BrowserShutdown()
 {
   if (Win7Features)
     Win7Features.onCloseWindow();
 
   gPrefService.removeObserver(ctrlTab.prefName, ctrlTab);
--- 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();
-  win.addEventListener("load", function() {
-    executeSoon(function() {
-      executeSoon(function() {
-        let cmd = win.document.getElementById("Tools:PrivateBrowsing");
-        ok(!cmd.hasAttribute("disabled"),
-           "The Private Browsing command in a new window should be enabled");
+  Services.obs.addObserver(function(subject, topic, data) {
+    Services.obs.removeObserver(arguments.callee, "browser-delayed-startup-finished");
+    var win = subject.QueryInterface(Ci.nsIDOMWindow);
 
-        win.close();
-        pb.privateBrowsingEnabled = false;
-        finish();
-      });
-    });
-  }, false);
+    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);
 }