Files
tubestation/browser/base/content/test/trackingUI/head.js
Johann Hofmann 7e69e0da0a Bug 1462470 - Part 6 - Add tests for the updated tracking protection UI in the identity popup. r=Paolo
This adds tests and moves the browser_trackingUI_1 test to the more general
trackingUI directory. The remaining TP tests will be moved in bug 1451307.

MozReview-Commit-ID: FHP4ULX0OQG
2018-05-31 22:54:26 +02:00

33 lines
894 B
JavaScript

/**
* 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) {
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;
}
let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, handle);
if (url)
BrowserTestUtils.loadURI(tab.linkedBrowser, url);
return loaded;
}