forked from mirrors/gecko-dev
Bug 1775855 - Wait for tooltip shown before in browser_protectionUI.js to fix race condition. r=bvandersloot
Differential Revision: https://phabricator.services.mozilla.com/D198015
This commit is contained in:
parent
ae2443b884
commit
aaa4bbff2a
1 changed files with 14 additions and 1 deletions
|
|
@ -30,7 +30,10 @@ async function waitForProtectionsPanelToast() {
|
||||||
gProtectionsHandler._protectionsPopup,
|
gProtectionsHandler._protectionsPopup,
|
||||||
"popupshown"
|
"popupshown"
|
||||||
);
|
);
|
||||||
Assert.ok(gProtectionsHandler._protectionsPopup.hasAttribute("toast"), "Protections panel toast is shown.");
|
Assert.ok(
|
||||||
|
gProtectionsHandler._protectionsPopup.hasAttribute("toast"),
|
||||||
|
"Protections panel toast is shown."
|
||||||
|
);
|
||||||
|
|
||||||
await BrowserTestUtils.waitForEvent(
|
await BrowserTestUtils.waitForEvent(
|
||||||
gProtectionsHandler._protectionsPopup,
|
gProtectionsHandler._protectionsPopup,
|
||||||
|
|
@ -49,6 +52,13 @@ async function openProtectionsPanel(toast, win = window) {
|
||||||
"tracking-protection-icon-container"
|
"tracking-protection-icon-container"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Register a promise to wait for the tooltip to be shown.
|
||||||
|
let tooltip = win.document.getElementById("tracking-protection-icon-tooltip");
|
||||||
|
let tooltipShownPromise = BrowserTestUtils.waitForPopupEvent(
|
||||||
|
tooltip,
|
||||||
|
"shown"
|
||||||
|
);
|
||||||
|
|
||||||
// Move out than move over the shield icon to trigger the hover event in
|
// Move out than move over the shield icon to trigger the hover event in
|
||||||
// order to fetch tracker count.
|
// order to fetch tracker count.
|
||||||
EventUtils.synthesizeMouseAtCenter(
|
EventUtils.synthesizeMouseAtCenter(
|
||||||
|
|
@ -66,6 +76,9 @@ async function openProtectionsPanel(toast, win = window) {
|
||||||
win
|
win
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Wait for the tooltip to be shown.
|
||||||
|
await tooltipShownPromise;
|
||||||
|
|
||||||
if (!toast) {
|
if (!toast) {
|
||||||
EventUtils.synthesizeMouseAtCenter(shieldIconContainer, {}, win);
|
EventUtils.synthesizeMouseAtCenter(shieldIconContainer, {}, win);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue