Bug 1810995 - update BrowserTestUtils.loadURI consumers to use loadURIString (automated) - other directories - r=Standard8,webdriver-reviewers,whimboo

Differential Revision: https://phabricator.services.mozilla.com/D167154
This commit is contained in:
Gijs Kruitbosch 2023-01-19 20:16:43 +00:00
parent 9946c4fcbb
commit 8be066753c
32 changed files with 56 additions and 56 deletions

View File

@ -43,7 +43,7 @@ async function runTests(browser, accDoc) {
],
});
BrowserTestUtils.loadURI(
BrowserTestUtils.loadURIString(
browser,
`data:text/html;charset=utf-8,
<html><body id="body2">
@ -59,7 +59,7 @@ async function runTests(browser, accDoc) {
[EVENT_REORDER, getAccessible(browser)],
]);
BrowserTestUtils.loadURI(browser, "about:about");
BrowserTestUtils.loadURIString(browser, "about:about");
await onLoadEvents;
@ -79,7 +79,7 @@ async function runTests(browser, accDoc) {
[EVENT_REORDER, getAccessible(browser)],
]);
BrowserTestUtils.loadURI(browser, "about:mozilla");
BrowserTestUtils.loadURIString(browser, "about:mozilla");
await onLoadEvents;
@ -101,7 +101,7 @@ async function runTests(browser, accDoc) {
]);
// eslint-disable-next-line @microsoft/sdl/no-insecure-url
BrowserTestUtils.loadURI(browser, "http://www.wronguri.wronguri/");
BrowserTestUtils.loadURIString(browser, "http://www.wronguri.wronguri/");
await onLoadEvents;
@ -111,7 +111,7 @@ async function runTests(browser, accDoc) {
[EVENT_REORDER, getAccessible(browser)],
]);
BrowserTestUtils.loadURI(browser, "https://nocert.example.com:443/");
BrowserTestUtils.loadURIString(browser, "https://nocert.example.com:443/");
await onLoadEvents;
}

View File

@ -19,7 +19,7 @@ function caretMoveChecker(target, caretOffset) {
async function checkURLBarCaretEvents() {
const kURL = "about:mozilla";
let newWin = await BrowserTestUtils.openNewBrowserWindow();
BrowserTestUtils.loadURI(newWin.gBrowser.selectedBrowser, kURL);
BrowserTestUtils.loadURIString(newWin.gBrowser.selectedBrowser, kURL);
newWin.gBrowser.selectedBrowser.focus();
await waitForEvent(EVENT_DOCUMENT_LOAD_COMPLETE, event => {

View File

@ -30,7 +30,7 @@ add_task(async function() {
})
.catch(function() {});
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, URL);
BrowserTestUtils.loadURIString(gBrowser.selectedBrowser, URL);
// wait until the page and its iframe page is loaded
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, true, URL);

View File

@ -19,7 +19,7 @@ add_task(async function() {
true,
`${FOLDER}post.html`
);
BrowserTestUtils.loadURI(tab.linkedBrowser, `${FOLDER}post.html`);
BrowserTestUtils.loadURIString(tab.linkedBrowser, `${FOLDER}post.html`);
await browserLoadedPromise;
let finalLoadPromise = BrowserTestUtils.browserLoaded(

View File

@ -58,7 +58,7 @@ add_task(async function() {
true,
actionURI
);
BrowserTestUtils.loadURI(tab.linkedBrowser, postURI);
BrowserTestUtils.loadURIString(tab.linkedBrowser, postURI);
await browserLoadedPromise;
var actionFileContentAfter = await IOUtils.readUTF8(actionPath);

View File

@ -330,7 +330,7 @@ async function loadURL(url, expectedURL = undefined) {
const browser = gBrowser.selectedTab.linkedBrowser;
const loaded = BrowserTestUtils.browserLoaded(browser, true, expectedURL);
BrowserTestUtils.loadURI(browser, url);
BrowserTestUtils.loadURIString(browser, url);
await loaded;
}

View File

@ -199,7 +199,7 @@ async function assertOfflineNavigationFails() {
const browser = gBrowser.selectedTab.linkedBrowser;
let netErrorLoaded = BrowserTestUtils.waitForErrorPage(browser);
BrowserTestUtils.loadURI(browser, pageEmptyURL);
BrowserTestUtils.loadURIString(browser, pageEmptyURL);
await netErrorLoaded;
}

View File

@ -128,6 +128,6 @@ function navigateToAnchor(baseUrl, hash) {
gBrowser,
url
);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
BrowserTestUtils.loadURIString(gBrowser.selectedBrowser, url);
return onLocationChange;
}

View File

@ -75,7 +75,7 @@ add_task(async function testDefault({ Security }) {
for (const url of BAD_CERTS) {
info(`Navigating to ${url}`);
const loaded = BrowserTestUtils.waitForErrorPage(gBrowser.selectedBrowser);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
BrowserTestUtils.loadURIString(gBrowser.selectedBrowser, url);
await loaded;
is(
@ -94,7 +94,7 @@ add_task(async function testIgnore({ client }) {
for (const url of BAD_CERTS) {
info(`Navigating to ${url}`);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
BrowserTestUtils.loadURIString(gBrowser.selectedBrowser, url);
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
is(
@ -114,7 +114,7 @@ add_task(async function testUnignore({ client }) {
for (const url of BAD_CERTS) {
info(`Navigating to ${url}`);
const loaded = BrowserTestUtils.waitForErrorPage(gBrowser.selectedBrowser);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
BrowserTestUtils.loadURIString(gBrowser.selectedBrowser, url);
await loaded;
is(
@ -135,7 +135,7 @@ add_task(async function testToggle({ client }) {
await Security.setIgnoreCertificateErrors({ ignore: true });
info(`Navigating to ${UNTRUSTED} having set the override`);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, UNTRUSTED);
BrowserTestUtils.loadURIString(gBrowser.selectedBrowser, UNTRUSTED);
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
is(
@ -150,7 +150,7 @@ add_task(async function testToggle({ client }) {
info(`Navigating to ${UNTRUSTED} having unset the override`);
loaded = BrowserTestUtils.waitForErrorPage(gBrowser.selectedBrowser);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, UNTRUSTED);
BrowserTestUtils.loadURIString(gBrowser.selectedBrowser, UNTRUSTED);
await loaded;
is(

View File

@ -63,7 +63,7 @@ async function doGC() {
*/
async function loadURL(browser, url) {
const loaded = BrowserTestUtils.browserLoaded(browser);
BrowserTestUtils.loadURI(browser, url);
BrowserTestUtils.loadURIString(browser, url);
return loaded;
}

View File

@ -182,7 +182,7 @@ add_task(async function test_sessionDataRootOnlyModule() {
const rootMessageHandler = createRootMessageHandler(sessionId);
ok(rootMessageHandler, "Valid ROOT MessageHandler created");
await BrowserTestUtils.loadURI(
await BrowserTestUtils.loadURIString(
gBrowser,
"https://example.com/document-builder.sjs?html=tab"
);

View File

@ -30,7 +30,7 @@ function createRootMessageHandler(sessionId) {
*/
async function loadURL(browser, url) {
const loaded = BrowserTestUtils.browserLoaded(browser);
BrowserTestUtils.loadURI(browser, url);
BrowserTestUtils.loadURIString(browser, url);
return loaded;
}

View File

@ -22,7 +22,7 @@ add_task(async function test_getBrowsingContextById() {
info(`Navigate to ${TEST_URL}`);
const loaded = BrowserTestUtils.browserLoaded(browser);
BrowserTestUtils.loadURI(browser, TEST_URL);
BrowserTestUtils.loadURIString(browser, TEST_URL);
await loaded;
const contexts = browser.browsingContext.getAllBrowsingContextsInSubtree();
@ -135,7 +135,7 @@ add_task(async function test_getTabForBrowsingContext() {
info(`Navigate to ${TEST_URL}`);
const loaded = BrowserTestUtils.browserLoaded(browser);
BrowserTestUtils.loadURI(browser, TEST_URL);
BrowserTestUtils.loadURIString(browser, TEST_URL);
await loaded;
const contexts = browser.browsingContext.getAllBrowsingContextsInSubtree();

View File

@ -39,7 +39,7 @@ function test() {
certOverrideService.clearValidityOverride(INVALID_CERT_DOMAIN, -1, {});
});
BrowserTestUtils.loadURI(gBrowser, INVALID_CERT_LOCATION);
BrowserTestUtils.loadURIString(gBrowser, INVALID_CERT_LOCATION);
let loaded = await BrowserTestUtils.browserLoaded(
gBrowser,
false,

View File

@ -48,7 +48,7 @@ function test() {
}
);
BrowserTestUtils.loadURI(aWindow.gBrowser.selectedBrowser, testURI);
BrowserTestUtils.loadURIString(aWindow.gBrowser.selectedBrowser, testURI);
}
function testOnWindow(aOptions, aCallback) {

View File

@ -39,7 +39,7 @@ async function testHelper(connectURL, expectedURL) {
set: [["security.default_personal_cert", "Ask Every Time"]],
});
BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser, connectURL);
BrowserTestUtils.loadURIString(win.gBrowser.selectedBrowser, connectURL);
await BrowserTestUtils.browserLoaded(
win.gBrowser.selectedBrowser,

View File

@ -181,7 +181,7 @@ async function testHelper(
let win = await BrowserTestUtils.openNewBrowserWindow(options);
BrowserTestUtils.loadURI(
BrowserTestUtils.loadURIString(
win.gBrowser.selectedBrowser,
"https://requireclientcert.example.com:443"
);

View File

@ -29,7 +29,7 @@ add_setup(async function() {
async function testDeviceConnected(deviceName) {
info("testDeviceConnected with deviceName=" + deviceName);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:mozilla");
BrowserTestUtils.loadURIString(gBrowser.selectedBrowser, "about:mozilla");
await waitForDocLoadComplete();
let waitForTabPromise = BrowserTestUtils.waitForNewTab(gBrowser);

View File

@ -13,7 +13,7 @@ add_task(async function() {
};
info("testVerifyNewSignin");
setupMockAlertsService();
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:mozilla");
BrowserTestUtils.loadURIString(gBrowser.selectedBrowser, "about:mozilla");
await waitForDocLoadComplete();
let waitForTabPromise = BrowserTestUtils.waitForNewTab(gBrowser);

View File

@ -22,7 +22,7 @@ add_task(async function test_network_markers_early_cancel() {
const tab = await BrowserTestUtils.openNewForegroundTab(options);
const loadPromise = BrowserTestUtils.waitForDocLoadAndStopIt(url, tab);
BrowserTestUtils.loadURI(tab.linkedBrowser, url);
BrowserTestUtils.loadURIString(tab.linkedBrowser, url);
const contentPid = await SpecialPowers.spawn(
tab.linkedBrowser,
[],

View File

@ -20,7 +20,7 @@ add_task(async function test_network_markers() {
try {
const url = BASE_URL_HTTPS + "simple.html?cacheBust=" + Math.random();
const contentBrowser = win.gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(contentBrowser, url);
BrowserTestUtils.loadURIString(contentBrowser, url);
await BrowserTestUtils.browserLoaded(contentBrowser, false, url);
const contentPid = await SpecialPowers.spawn(
contentBrowser,

View File

@ -29,7 +29,7 @@ add_task(async function test_profile_fission_no_private_browsing() {
try {
const url = BASE_URL_HTTPS + "single_frame.html";
const contentBrowser = win.gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(contentBrowser, url);
BrowserTestUtils.loadURIString(contentBrowser, url);
await BrowserTestUtils.browserLoaded(contentBrowser, false, url);
const parentPid = Services.appinfo.processID;
@ -142,7 +142,7 @@ add_task(async function test_profile_fission_private_browsing() {
try {
const url = BASE_URL_HTTPS + "single_frame.html";
const contentBrowser = win.gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(contentBrowser, url);
BrowserTestUtils.loadURIString(contentBrowser, url);
await BrowserTestUtils.browserLoaded(contentBrowser, false, url);
const contentPid = await SpecialPowers.spawn(contentBrowser, [], () => {

View File

@ -79,7 +79,7 @@ add_task(async function test_profile_private_browsing() {
try {
const url = BASE_URL_HTTPS + "single_frame.html";
const contentBrowser = win.gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(contentBrowser, url);
BrowserTestUtils.loadURIString(contentBrowser, url);
await BrowserTestUtils.browserLoaded(contentBrowser, false, url);
const contentPid = await SpecialPowers.spawn(contentBrowser, [], () => {

View File

@ -46,7 +46,7 @@ async function waitForPdfJS(browser, url) {
null,
true
);
BrowserTestUtils.loadURI(browser, url);
BrowserTestUtils.loadURIString(browser, url);
return loadPromise;
}
@ -179,7 +179,7 @@ add_task(async function test_check_open_with_internal_handler() {
let subdialogPromise = BrowserTestUtils.domWindowOpenedAndLoaded();
// Current tab has file: URI and TEST_PATH is http uri, so uri will be different
BrowserTestUtils.loadURI(newTab.linkedBrowser, TEST_PATH + file);
BrowserTestUtils.loadURIString(newTab.linkedBrowser, TEST_PATH + file);
let subDialogWindow = await subdialogPromise;
let subDoc = subDialogWindow.document;

View File

@ -157,7 +157,7 @@ async function createDownloadTest(
let downloadFinishedPromise = skipDownload
? null
: promiseDownloadFinished(downloadList);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, file.url);
BrowserTestUtils.loadURIString(gBrowser.selectedBrowser, file.url);
if (action.id === Ci.nsIHandlerInfo.alwaysAsk) {
info("Check Always Ask dialog.");
let dialogWindow = await dialogWindowPromise;
@ -249,7 +249,7 @@ add_task(async function test_download_preferred_action() {
Services.prefs.clearUserPref(
"browser.download.always_ask_before_handling_new_types"
);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:home");
BrowserTestUtils.loadURIString(gBrowser.selectedBrowser, "about:home");
for (const index in FILE_TYPES_TO_TEST) {
let file = FILE_TYPES_TO_TEST[index];
let mimeSettings = gMIMEService.getFromTypeAndExtension(

View File

@ -26,7 +26,7 @@ add_task(async function test_open_without_user_interaction() {
true
);
BrowserTestUtils.loadURI(
BrowserTestUtils.loadURIString(
tab.linkedBrowser,
TEST_PATH + "file_external_protocol_iframe.html"
);

View File

@ -14,7 +14,7 @@ add_task(async function() {
// Load a page registering a protocol handler.
let browser = gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(browser, testURL);
BrowserTestUtils.loadURIString(browser, testURL);
await BrowserTestUtils.browserLoaded(browser, false, testURL);
// Register the protocol handler by clicking the notificationbar button.

View File

@ -95,7 +95,7 @@ add_task(async function test_closed_by_tab_navigation() {
});
info("Navigating tab to a different but same origin page.");
BrowserTestUtils.loadURI(tab.linkedBrowser, TEST_PATH);
BrowserTestUtils.loadURIString(tab.linkedBrowser, TEST_PATH);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, TEST_PATH);
ok(dialog._frame.contentWindow, "Dialog should stay open.");
@ -111,7 +111,7 @@ add_task(async function test_closed_by_tab_navigation() {
info("Now navigate to a cross-origin page.");
const CROSS_ORIGIN_TEST_PATH = TEST_PATH.replace(".com", ".org");
BrowserTestUtils.loadURI(tab.linkedBrowser, CROSS_ORIGIN_TEST_PATH);
BrowserTestUtils.loadURIString(tab.linkedBrowser, CROSS_ORIGIN_TEST_PATH);
let loadPromise = BrowserTestUtils.browserLoaded(
tab.linkedBrowser,
false,

View File

@ -131,7 +131,7 @@ function useServerRedirect(serverRedirect) {
ROOT_PATH +
"redirect_helper.sjs?" +
params.toString();
BrowserTestUtils.loadURI(browser, uri);
BrowserTestUtils.loadURIString(browser, uri);
};
}
@ -1299,7 +1299,7 @@ add_task(async function test_redirect_principal_js() {
ROOT_PATH +
"script_redirect.html?" +
params.toString();
BrowserTestUtils.loadURI(browser, uri);
BrowserTestUtils.loadURIString(browser, uri);
},
permDialogOptions: {
checkboxOrigin: ORIGIN1,

View File

@ -59,7 +59,7 @@ add_task(async function test_helperapp() {
let askedUserPromise = waitForProtocolAppChooserDialog(browser, true);
BrowserTestUtils.loadURI(browser, kProt + ":test");
BrowserTestUtils.loadURIString(browser, kProt + ":test");
let dialog = await Promise.race([
wrongThingHappenedPromise,
askedUserPromise,

View File

@ -9,7 +9,7 @@ add_task(async function() {
// Load a page registering a protocol handler.
let browser = gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(browser, testURL);
BrowserTestUtils.loadURIString(browser, testURL);
await BrowserTestUtils.browserLoaded(browser, false, testURL);
// Register the protocol handler by clicking the notificationbar button.

View File

@ -49,7 +49,7 @@ add_task(async () => {
true /* waitForLoad */
);
BrowserTestUtils.loadURI(tab.linkedBrowser, secondPage);
BrowserTestUtils.loadURIString(tab.linkedBrowser, secondPage);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, secondPage);
// Make sure we can go back to the previous page.
@ -176,7 +176,7 @@ add_task(async () => {
true /* waitForLoad */
);
BrowserTestUtils.loadURI(tab.linkedBrowser, secondPage);
BrowserTestUtils.loadURIString(tab.linkedBrowser, secondPage);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, secondPage);
// Make sure we can go back to the previous page.
@ -279,7 +279,7 @@ add_task(async () => {
true /* waitForLoad */
);
BrowserTestUtils.loadURI(tab.linkedBrowser, secondPage);
BrowserTestUtils.loadURIString(tab.linkedBrowser, secondPage);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, secondPage);
// Make sure we can go back to the previous page.
@ -378,7 +378,7 @@ add_task(async () => {
true /* waitForLoad */
);
BrowserTestUtils.loadURI(tab.linkedBrowser, secondPage);
BrowserTestUtils.loadURIString(tab.linkedBrowser, secondPage);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, secondPage);
// Make sure we can go back to the previous page.
@ -463,7 +463,7 @@ add_task(async () => {
true /* waitForLoad */
);
BrowserTestUtils.loadURI(tab.linkedBrowser, secondPage);
BrowserTestUtils.loadURIString(tab.linkedBrowser, secondPage);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, secondPage);
// Make sure we can go back to the previous page.
@ -562,7 +562,7 @@ add_task(async () => {
true /* waitForLoad */
);
BrowserTestUtils.loadURI(tab.linkedBrowser, secondPage);
BrowserTestUtils.loadURIString(tab.linkedBrowser, secondPage);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, secondPage);
// Make sure we can go back to the previous page.
@ -635,7 +635,7 @@ add_task(async () => {
true /* waitForLoad */
);
BrowserTestUtils.loadURI(tab.linkedBrowser, secondPage);
BrowserTestUtils.loadURIString(tab.linkedBrowser, secondPage);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, secondPage);
// Make sure we can go back to the previous page.
@ -704,7 +704,7 @@ add_task(async () => {
"chrome://mochitests/content/",
"http://mochi.test:8888/"
);
BrowserTestUtils.loadURI(
BrowserTestUtils.loadURIString(
tab.linkedBrowser,
URL_ROOT + "helper_swipe_gesture.html"
);
@ -788,7 +788,7 @@ add_task(async () => {
"chrome://mochitests/content/",
"http://mochi.test:8888/"
);
BrowserTestUtils.loadURI(
BrowserTestUtils.loadURIString(
tab.linkedBrowser,
URL_ROOT + "helper_swipe_gesture.html"
);
@ -853,7 +853,7 @@ add_task(async () => {
"chrome://mochitests/content/",
"http://mochi.test:8888/"
);
BrowserTestUtils.loadURI(
BrowserTestUtils.loadURIString(
tab.linkedBrowser,
URL_ROOT + "helper_swipe_gesture.html"
);
@ -918,7 +918,7 @@ add_task(async () => {
true /* waitForLoad */
);
BrowserTestUtils.loadURI(tab.linkedBrowser, secondPage);
BrowserTestUtils.loadURIString(tab.linkedBrowser, secondPage);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, secondPage);
// Make sure we can go back to the previous page.