Bug 1416628 - Wait for the "popupshown" event when opening the Site Identity panel. r=johannh, a=test-only
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Mon, 13 Nov 2017 13:27:54 +0000
changeset 444765 e8f0d29cabecc5f6c83573329bbe736cbd6481e6
parent 444764 ac34dc4fa2d40a3756fb1d4ade0527340ff2fe37
child 444766 d37f4f80965b7ea351dbf4c859a6d784bded62b5
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)
reviewersjohannh, test-only
bugs1416628
milestone58.0
Bug 1416628 - Wait for the "popupshown" event when opening the Site Identity panel. r=johannh, a=test-only MozReview-Commit-ID: D6JW4h32O5T
browser/base/content/test/siteIdentity/browser_insecureLoginForms.js
--- 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();