Bug 1342298 - Synchronize with the loaded event for the newly added tab then start the test.
MozReview-Commit-ID: J6SqlfaOKGz
--- 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