Bug 1342298 - Synchronize with the loaded event for the newly added tab then start the test. draft
authorHenry Chang <hchang@mozilla.com>
Mon, 21 Aug 2017 10:49:15 +0800
changeset 649742 e4132d21a7cc48c7037e3ac30d889e1615c4b206
parent 647136 9b101cdb3935c224f97a4f1e6de642c0ca5c3c5e
child 727173 20787c1593395303895cbef56c7932fde8b558db
push id75133
push userhchang@mozilla.com
push dateMon, 21 Aug 2017 07:55:20 +0000
bugs1342298
milestone57.0a1
Bug 1342298 - Synchronize with the loaded event for the newly added tab then start the test. MozReview-Commit-ID: J6SqlfaOKGz
dom/base/test/browser_bug902350.js
--- a/dom/base/test/browser_bug902350.js
+++ b/dom/base/test/browser_bug902350.js
@@ -24,21 +24,23 @@ function test() {
 
   origBlockActive = Services.prefs.getBoolPref(PREF_ACTIVE);
 
   Services.prefs.setBoolPref(PREF_ACTIVE, true);
 
   var newTab = BrowserTestUtils.addTab(gBrowser);
   gBrowser.selectedTab = newTab;
   gTestBrowser = gBrowser.selectedBrowser;
-  newTab.linkedBrowser.stop()
 
-  BrowserTestUtils.browserLoaded(gTestBrowser, true /*includeSubFrames*/).then(MixedTest1A);
-  var url = gHttpTestRoot + "file_bug902350.html";
-  gTestBrowser.loadURI(url);
+  BrowserTestUtils.browserLoaded(gTestBrowser).then(() => {
+    // about:blank is expected to be loaded here.
+    var url = gHttpTestRoot + "file_bug902350.html";
+    BrowserTestUtils.browserLoaded(gTestBrowser, true /*includeSubFrames*/).then(MixedTest1A);
+    gTestBrowser.loadURI(url);
+  });
 }
 
 // Need to capture 2 loads, one for the main page and one for the iframe
 function MixedTest1A() {
   BrowserTestUtils.browserLoaded(gTestBrowser, true /*includeSubFrames*/).then(MixedTest1B);
 }
 
 // Find the iframe and click the link in it