From 33776481fdeeef92615dc043d2bd8cb72b98a2e6 Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Tue, 20 Aug 2019 06:21:22 +0000 Subject: [PATCH] Bug 1539979 - Fix HTML Tooltip test for content frames r=gl Depends on D40989 I though I fixed this a few months ago, but there are still timing issues with the current test when using a frame with type=content. Differential Revision: https://phabricator.services.mozilla.com/D40990 --HG-- extra : moz-landing-system : lando --- .../shared/test/browser_html_tooltip-02.js | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/devtools/client/shared/test/browser_html_tooltip-02.js b/devtools/client/shared/test/browser_html_tooltip-02.js index d58138ceeff0..c818428fc592 100644 --- a/devtools/client/shared/test/browser_html_tooltip-02.js +++ b/devtools/client/shared/test/browser_html_tooltip-02.js @@ -167,24 +167,24 @@ async function testClickInInnerIframe(doc) { tooltip.panel.appendChild(iframe); - const onFrameLoad = new Promise(r => { - iframe.addEventListener("load", r, true); - }); - iframe.srcdoc = "
"; - await onFrameLoad; - tooltip.setContentSize({ width: 100, height: 50 }); await showTooltip(tooltip, doc.getElementById("box1")); - const target = iframe.contentWindow.document.documentElement; - const onTooltipContainerClick = once(target, "click"); + iframe.srcdoc = "
"; + await new Promise(r => { + const domHelper = new DOMHelpers(iframe.contentWindow); + const frameLoad = () => { + r(); + }; + domHelper.onceDOMReady(frameLoad); + }); - EventUtils.synthesizeMouseAtCenter( - target, - {}, - target.ownerDocument.defaultView - ); - await onTooltipContainerClick; + await waitUntil(() => iframe.contentWindow.document.getElementById("test")); + + const target = iframe.contentWindow.document.getElementById("test"); + const onTooltipClick = once(target, "click"); + EventUtils.synthesizeMouseAtCenter(target, {}, target.ownerGlobal); + await onTooltipClick; is(tooltip.isVisible(), true, "Tooltip is still visible");