Bug 1541706 - attempt to fix intermittent browser_privatebrowsing.js, r=mixedpuppy

Differential Revision: https://phabricator.services.mozilla.com/D42663

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Gijs Kruitbosch 2019-08-20 16:05:26 +00:00
parent dd5a04bc1d
commit e5baa47643
2 changed files with 9 additions and 12 deletions

View File

@ -22,7 +22,6 @@ function check_channel(subject) {
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Tests we send the right cookies when installing through an InstallTrigger call // Tests we send the right cookies when installing through an InstallTrigger call
let gPrivateWin; let gPrivateWin;
let gPopupShown;
async function test() { async function test() {
waitForExplicitFinish(); // have to call this ourselves because we're async. waitForExplicitFinish(); // have to call this ourselves because we're async.
Harness.installConfirmCallback = confirm_install; Harness.installConfirmCallback = confirm_install;
@ -57,10 +56,6 @@ async function test() {
gPrivateWin.gBrowser, gPrivateWin.gBrowser,
TESTROOT + "installtrigger.html?" + triggers TESTROOT + "installtrigger.html?" + triggers
); );
gPopupShown = BrowserTestUtils.waitForEvent(
gPrivateWin.PanelUI.notificationPanel,
"popupshown"
);
} }
function confirm_install(panel) { function confirm_install(panel) {
@ -102,16 +97,17 @@ const finish_test = async function(count) {
is(results.return, "true", "installTrigger should have claimed success"); is(results.return, "true", "installTrigger should have claimed success");
is(results.status, "0", "Callback should have seen a 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 await TestUtils.waitForCondition(() =>
// window closes (see also bug 1535069): gPrivateWin.AppMenuNotifications._notifications.some(
await gPopupShown; n => n.id == "addon-installed"
gPrivateWin.PanelUI.notificationPanel )
.querySelector("popupnotification[popupid=addon-installed]") );
.button.click(); // Explicitly remove the notification to avoid the panel reopening in the
// other window once this window closes (see also bug 1535069):
gPrivateWin.AppMenuNotifications.removeNotification("addon-installed");
// Now finish the test: // Now finish the test:
await BrowserTestUtils.closeWindow(gPrivateWin); await BrowserTestUtils.closeWindow(gPrivateWin);
Harness.finish(gPrivateWin); Harness.finish(gPrivateWin);
gPrivateWin = null; gPrivateWin = null;
gPopupShown = null;
}; };

View File

@ -179,6 +179,7 @@ var Harness = {
// that which fixes the rest of the tests. Since no test // that which fixes the rest of the tests. Since no test
// here cares about this panel, we just need it to close. // here cares about this panel, we just need it to close.
win.PanelUI.notificationPanel.hidePopup(); win.PanelUI.notificationPanel.hidePopup();
win.AppMenuNotifications.removeNotification("addon-installed");
delete this._boundWin; delete this._boundWin;
finish(); finish();
}, },