Bug 1403365 - Fix intermittent in browser_pageinfo_firstPartyIsolation.js. r=baku, a=test-only
☠☠ backed out by ab58ba2c32b8 ☠ ☠
authorYoshi Huang <allstars.chh@mozilla.com>
Thu, 04 Jan 2018 16:45:18 +0800
changeset 445618 41f57230d558923a843e825da94e0146f3888b13
parent 445617 218cfb44a3f44cb3e5b72a5c7c4032817becd664
child 445619 c77dd415d31f115d24335e3573fd087a3f3705cd
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku, test-only
bugs1403365
milestone58.0
Bug 1403365 - Fix intermittent in browser_pageinfo_firstPartyIsolation.js. r=baku, a=test-only When we try to load https://example.com/browser/browser/base/content/test/pageinfo/image.html, sometimes BrowserTestUtils will return early even the page doesn't load yet, for example, the browser.currentURI is still about:blank. And loading about:blank will cause error in pageInfo.js, hence caused the timeout. So I add more parameters to browserLoaded to make sure browwserLoaded is returned with the correct url.
browser/base/content/test/pageinfo/browser_pageinfo_firstPartyIsolation.js
--- a/browser/base/content/test/pageinfo/browser_pageinfo_firstPartyIsolation.js
+++ b/browser/base/content/test/pageinfo/browser_pageinfo_firstPartyIsolation.js
@@ -66,26 +66,24 @@ function testFirstPartyDomain(pageInfo) 
 async function test() {
   waitForExplicitFinish();
 
   Services.prefs.setBoolPref("privacy.firstparty.isolate", true);
   registerCleanupFunction(function() {
     Services.prefs.clearUserPref("privacy.firstparty.isolate");
   });
 
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  content.location = "https://example.com/browser/browser/base/content/test/pageinfo/image.html";
-  await waitForEvent(gBrowser.selectedBrowser, "load");
-
-  let spec = gBrowser.selectedBrowser.currentURI.spec;
+  let url = "https://example.com/browser/browser/base/content/test/pageinfo/image.html";
+  gBrowser.selectedBrowser.loadURI(url);
+  await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, url);
 
   // Pass a dummy imageElement, if there isn't an imageElement, pageInfo.js
   // will do a preview, however this sometimes will cause intermittent failures,
   // see bug 1403365.
-  let pageInfo = BrowserPageInfo(spec, "mediaTab", {});
+  let pageInfo = BrowserPageInfo(url, "mediaTab", {});
   info("waitForEvent pageInfo");
   await waitForEvent(pageInfo, "load");
 
   info("calling testFirstPartyDomain");
   await testFirstPartyDomain(pageInfo);
 
   pageInfo.close();
   gBrowser.removeCurrentTab();