From 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:33 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../web-platform/tests/close-watcher/resources/helpers.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'testing/web-platform/tests/close-watcher/resources') diff --git a/testing/web-platform/tests/close-watcher/resources/helpers.js b/testing/web-platform/tests/close-watcher/resources/helpers.js index 97a62309cd..dd9e191c4d 100644 --- a/testing/web-platform/tests/close-watcher/resources/helpers.js +++ b/testing/web-platform/tests/close-watcher/resources/helpers.js @@ -38,6 +38,14 @@ window.createBlessedRecordingCloseWatcher = async (t, events, name, type, parent return createRecordingCloseWatcher(t, events, name, type, parentWatcher); }; +window.destroyCloseWatcher = (watcher) => { + if (watcher instanceof HTMLElement) { + watcher.remove(); + } else { + watcher.destroy(); + } +}; + window.sendEscKey = () => { // Esc is \uE00C, *not* \uu001B; see https://w3c.github.io/webdriver/#keyboard-actions. // @@ -59,3 +67,9 @@ window.maybeTopLayerBless = (watcher) => { } return test_driver.bless(); }; + +window.waitForPotentialCloseEvent = () => { + // CloseWatchers fire close events synchronously, but dialog elements wait + // for a rAF before firing them. + return new Promise(requestAnimationFrame); +}; -- cgit v1.2.3