Bug 1541706 - fix linux intermittent xpinstall/browser_privatebrowsing.js, r=aswan
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 04 Apr 2019 16:30:13 +0000
changeset 468031 50d64901b71fe8e6ed7d9730467bf4b4d6060f01
parent 468030 33510bccced0c4691cfbe8214a1ca404bb401271
child 468032 f0fb97a222ff28f72a3f3e334854dd23462d1ab2
child 468037 0cf838d61cdd13c9d2b6eefa0e75ebb2202a0934
push id112673
push userccoroiu@mozilla.com
push dateThu, 04 Apr 2019 22:20:03 +0000
treeherdermozilla-inbound@f0fb97a222ff [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan
bugs1541706
milestone68.0a1
first release with
nightly linux32
50d64901b71f / 68.0a1 / 20190404215521 / files
nightly linux64
50d64901b71f / 68.0a1 / 20190404215521 / files
nightly mac
50d64901b71f / 68.0a1 / 20190404215521 / files
nightly win32
50d64901b71f / 68.0a1 / 20190404215521 / files
nightly win64
50d64901b71f / 68.0a1 / 20190404215521 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1541706 - fix linux intermittent xpinstall/browser_privatebrowsing.js, r=aswan Differential Revision: https://phabricator.services.mozilla.com/D26186
toolkit/mozapps/extensions/test/xpinstall/browser_privatebrowsing.js
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_privatebrowsing.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_privatebrowsing.js
@@ -13,16 +13,17 @@ function check_channel(subject) {
   ok(true, "Got request for " + uri.spec);
 
   let loadInfo = channel.loadInfo;
   is(loadInfo.originAttributes.privateBrowsingId, 1, "Request should have happened using private browsing");
 }
 // ----------------------------------------------------------------------------
 // Tests we send the right cookies when installing through an InstallTrigger call
 let gPrivateWin;
+let gPopupShown;
 async function test() {
   waitForExplicitFinish(); // have to call this ourselves because we're async.
   Harness.installConfirmCallback = confirm_install;
   Harness.installEndedCallback = install_ended;
   Harness.installsCompletedCallback = finish_test;
   Harness.finalContentEvent = "InstallComplete";
   gPrivateWin = await BrowserTestUtils.openNewBrowserWindow({private: true});
   Harness.setup(gPrivateWin);
@@ -35,16 +36,17 @@ async function test() {
       URL: TESTROOT + "amosigned.xpi",
       IconURL: TESTROOT + "icon.png",
       toString() { return this.URL; },
     },
   }));
   gPrivateWin.gBrowser.selectedTab = BrowserTestUtils.addTab(gPrivateWin.gBrowser);
   Services.obs.addObserver(check_channel, "http-on-before-connect");
   BrowserTestUtils.loadURI(gPrivateWin.gBrowser, TESTROOT + "installtrigger.html?" + triggers);
+  gPopupShown = BrowserTestUtils.waitForEvent(gPrivateWin.PanelUI.notificationPanel, "popupshown");
 }
 
 function confirm_install(panel) {
   is(panel.getAttribute("name"), "XPI Test", "Should have seen the name");
   return true;
 }
 
 function install_ended(install, addon) {
@@ -68,18 +70,19 @@ const finish_test = async function(count
     };
   });
 
   is(results.return, "true", "installTrigger should have claimed success");
   is(results.status, "0", "Callback should have seen a success");
 
   // Explicitly click the "OK" button to avoid the panel reopening in the other window once this
   // window closes (see also bug 1535069):
-  await BrowserTestUtils.waitForEvent(gPrivateWin.PanelUI.notificationPanel, "popupshown");
+  await gPopupShown;
   gPrivateWin.PanelUI.notificationPanel.querySelector("popupnotification[popupid=addon-installed]").button.click();
 
   // Now finish the test:
   await BrowserTestUtils.closeWindow(gPrivateWin);
   Harness.finish(gPrivateWin);
   gPrivateWin = null;
+  gPopupShown = null;
 };