Bug 1115076 - Wait for about:privatebrowsing to load in test_sts_privatebrowsing_perwindowpb.html; r=jdm
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 30 Dec 2014 15:39:53 -0500
changeset 247609 2aabdc20a0da04a6bd420c782a865a15c669fb08
parent 247608 feb16b98a8256d9d50a7402e4a285ec21a3b3eb9
child 247610 178d18db618daed2b2b2b01c45d05a9c86785370
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs1115076
milestone37.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 1115076 - Wait for about:privatebrowsing to load in test_sts_privatebrowsing_perwindowpb.html; r=jdm
security/manager/ssl/tests/mochitest/stricttransportsecurity/test_sts_privatebrowsing_perwindowpb.html
--- a/security/manager/ssl/tests/mochitest/stricttransportsecurity/test_sts_privatebrowsing_perwindowpb.html
+++ b/security/manager/ssl/tests/mochitest/stricttransportsecurity/test_sts_privatebrowsing_perwindowpb.html
@@ -49,30 +49,38 @@
                      'nosts': 'INSECURE'}},
     'alreadysecure':
       {'url':     "https://test2.example.com" + STSPATH + "/verify.sjs",
         'expected': {'plain': 'SECURE',
                      'subdom': 'SECURE',
                      'nosts': 'SECURE'}},
   };
 
+  function whenDelayedStartupFinished(aWindow, aCallback) {
+    SpecialPowers.Services.obs.addObserver(function observer(aSubject, aTopic) {
+      if (aWindow == aSubject) {
+        SpecialPowers.Services.obs.removeObserver(observer, aTopic);
+        SimpleTest.executeSoon(aCallback);
+      }
+    }, "browser-delayed-startup-finished", false);
+  }
+
   function testOnWindow(aIsPrivate, aCallback) {
     var win = mainWindow.OpenBrowserWindow({private: aIsPrivate});
-    win.addEventListener("load", function onLoad() {
-      win.removeEventListener("load", onLoad, false);
+    whenDelayedStartupFinished(win, function () {
       win.gBrowser.addEventListener("DOMContentLoaded", function onInnerLoad() {
         if (win.content.location.href != CONTENT_PAGE) {
           win.gBrowser.loadURI(CONTENT_PAGE);
           return;
         }
         win.gBrowser.removeEventListener("DOMContentLoaded", onInnerLoad, true);
         SimpleTest.executeSoon(function() { aCallback(win); });
       }, true);
       win.gBrowser.loadURI(CONTENT_PAGE);
-    }, true);
+    });
   }
 
   function startRound(win, isPrivate, round) {
     currentround = round;
     testsleftinround = NUM_TEST_FRAMES;
     SimpleTest.info("TESTS LEFT IN ROUND " + currentround + ": " + testsleftinround);
     var frame = win.content.document.createElement("iframe");
     frame.setAttribute('id', 'ifr_bootstrap');