Bug 1595923 - Try to rewrite browser_privatebrowsing_localStorage_before_after.js using more moden (and hopefully less prone to intermittent failures) primitives; r=nhnt11
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 15 Nov 2019 15:18:36 +0000
changeset 502213 8a8024c8caf0674a3c9509323e2a587e53c416be
parent 502212 ec8cad6891215a6db48cf2bc927ef6c77838035f
child 502214 0ece9bc4cec274c87d92469c2b145621f4704cfd
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnhnt11
bugs1595923
milestone72.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 1595923 - Try to rewrite browser_privatebrowsing_localStorage_before_after.js using more moden (and hopefully less prone to intermittent failures) primitives; r=nhnt11 Differential Revision: https://phabricator.services.mozilla.com/D52757
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after.js
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after.js
@@ -13,30 +13,34 @@
 add_task(async function test() {
   let prefix =
     "http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/";
 
   // Step 1.
   let privateWin = await BrowserTestUtils.openNewBrowserWindow({
     private: true,
   });
-  let privateBrowser = BrowserTestUtils.addTab(
-    privateWin.gBrowser,
-    prefix + "browser_privatebrowsing_localStorage_before_after_page.html"
-  ).linkedBrowser;
-  await BrowserTestUtils.browserLoaded(privateBrowser);
+  let testURL =
+    prefix + "browser_privatebrowsing_localStorage_before_after_page.html";
+  await BrowserTestUtils.openNewForegroundTab(privateWin.gBrowser, testURL);
 
-  is(privateBrowser.contentTitle, "1", "localStorage should contain 1 item");
+  is(
+    privateWin.gBrowser.selectedBrowser.contentTitle,
+    "1",
+    "localStorage should contain 1 item"
+  );
 
   // Step 2.
   let win = await BrowserTestUtils.openNewBrowserWindow();
-  let browser = BrowserTestUtils.addTab(
-    win.gBrowser,
-    prefix + "browser_privatebrowsing_localStorage_before_after_page2.html"
-  ).linkedBrowser;
-  await BrowserTestUtils.browserLoaded(browser);
+  testURL =
+    prefix + "browser_privatebrowsing_localStorage_before_after_page2.html";
+  await BrowserTestUtils.openNewForegroundTab(win.gBrowser, testURL);
 
-  is(browser.contentTitle, "null|0", "localStorage should contain 0 items");
+  is(
+    win.gBrowser.selectedBrowser.contentTitle,
+    "null|0",
+    "localStorage should contain 0 items"
+  );
 
   // Cleanup
   await BrowserTestUtils.closeWindow(privateWin);
   await BrowserTestUtils.closeWindow(win);
 });