Bug 1416628 - Wait for the "popupshown" event when opening the Site Identity panel. r=johannh
MozReview-Commit-ID: D6JW4h32O5T
--- a/browser/base/content/test/siteIdentity/browser_insecureLoginForms.js
+++ b/browser/base/content/test/siteIdentity/browser_insecureLoginForms.js
@@ -32,17 +32,19 @@ add_task(async function test_simple() {
await Promise.all([
BrowserTestUtils.switchTab(gBrowser, tab),
BrowserTestUtils.browserLoaded(browser),
// One event is triggered by pageshow and one by DOMFormHasPassword.
waitForInsecureLoginFormsStateChange(browser, 2),
]);
let { gIdentityHandler } = gBrowser.ownerGlobal;
+ let promisePanelOpen = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popupshown");
gIdentityHandler._identityBox.click();
+ await promisePanelOpen;
// Messages should be visible when the scheme is HTTP, and invisible when
// the scheme is HTTPS.
is(Array.every(document.getElementById("identity-popup-mainView")
.querySelectorAll("[when-loginforms=insecure]"),
element => !is_hidden(element)),
expectWarning,
"The relevant messages should be visible or hidden in the main view.");
@@ -141,17 +143,19 @@ add_task(async function test_ignoring_wi
content.document.getElementById("link").click();
});
let tab = await loaded;
browser = tab.linkedBrowser;
await waitForInsecureLoginFormsStateChange(browser, 2);
// Open the identity popup.
let { gIdentityHandler } = gBrowser.ownerGlobal;
+ let promisePanelOpen = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popupshown");
gIdentityHandler._identityBox.click();
+ await promisePanelOpen;
ok(Array.every(document.getElementById("identity-popup-mainView")
.querySelectorAll("[when-loginforms=insecure]"),
element => is_hidden(element)),
"All messages should be hidden in the main view.");
let promiseViewShown = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "ViewShown");
document.getElementById("identity-popup-security-expander").click();