commit 013fbbbcfae6ab9b84e5a779dcca987be6ea0a76
parent 05983f9b8d523636f7c0cfb0bc6634550eea6608
Author: Mark Banner <standard8@mozilla.com>
Date: Tue, 9 Dec 2025 15:33:53 +0000
Bug 2004684 - Add BrowserTestUtils.loadURIString to load a URL and wait for it to complete. r=firefox-desktop-core-reviewers ,Gijs
Differential Revision: https://phabricator.services.mozilla.com/D275430
Diffstat:
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.sys.mjs b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.sys.mjs
@@ -965,6 +965,23 @@ export var BrowserTestUtils = {
},
/**
+ * Loads a given URI in the specified tab and waits for the load to complete.
+ *
+ * @param {object} options
+ * @param {xul:browser} options.browser
+ * The browser to load the URI into.
+ * @param {string} options.uriString
+ * The string URI to load.
+ * @param {string} [options.finalURI]
+ * The expected final URI to wait for, e.g. if the load is automatically
+ * redirected.
+ */
+ loadURIString({ browser, uriString, finalURI = uriString }) {
+ this.startLoadingURIString(browser, uriString);
+ return this.browserLoaded(browser, { wantLoad: finalURI });
+ },
+
+ /**
* Maybe create a preloaded browser and ensure it's finished loading.
*
* @param gBrowser (<xul:tabbrowser>)