diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /toolkit/components/reader/test/head.js | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/reader/test/head.js')
-rw-r--r-- | toolkit/components/reader/test/head.js | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/toolkit/components/reader/test/head.js b/toolkit/components/reader/test/head.js deleted file mode 100644 index 5f9baf8fcd..0000000000 --- a/toolkit/components/reader/test/head.js +++ /dev/null @@ -1,59 +0,0 @@ -/* exported promiseTabLoadEvent, is_element_visible, is_element_hidden */ - -/** - * Waits for a load (or custom) event to finish in a given tab. If provided - * load an uri into the tab. - * - * @param tab - * The tab to load into. - * @param [optional] url - * The url to load, or the current url. - * @return {Promise} resolved when the event is handled. - * @resolves to the received event - * @rejects if a valid load event is not received within a meaningful interval - */ -function promiseTabLoadEvent(tab, url) { - let deferred = Promise.withResolvers(); - info("Wait tab event: load"); - - function handle(loadedUrl) { - if (loadedUrl === "about:blank" || (url && loadedUrl !== url)) { - info(`Skipping spurious load event for ${loadedUrl}`); - return false; - } - - info("Tab event received: load"); - return true; - } - - // Create two promises: one resolved from the content process when the page - // loads and one that is rejected if we take too long to load the url. - let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, handle); - - let timeout = setTimeout(() => { - deferred.reject(new Error("Timed out while waiting for a 'load' event")); - }, 30000); - - loaded.then(() => { - clearTimeout(timeout); - deferred.resolve(); - }); - - if (url) { - BrowserTestUtils.startLoadingURIString(tab.linkedBrowser, url); - } - - // Promise.all rejects if either promise rejects (i.e. if we time out) and - // if our loaded promise resolves before the timeout, then we resolve the - // timeout promise as well, causing the all promise to resolve. - return Promise.all([deferred.promise, loaded]); -} - -function is_element_visible(element, msg) { - isnot(element, null, "Element should not be null, when checking visibility"); - ok(BrowserTestUtils.isVisible(element), msg || "Element should be visible"); -} -function is_element_hidden(element, msg) { - isnot(element, null, "Element should not be null, when checking visibility"); - ok(BrowserTestUtils.isHidden(element), msg || "Element should be hidden"); -} |