Bug 1810141 - fix tests to deal with changes to loadURI, r=mossop,perftest-reviewers,geckoview-reviewers,extension-reviewers,sparky,owlish

Depends on D168396

Differential Revision: https://phabricator.services.mozilla.com/D168397
This commit is contained in:
Gijs Kruitbosch 2023-02-13 12:55:26 +00:00
parent 269159b655
commit ff1cc20bd7
42 changed files with 106 additions and 77 deletions

View File

@ -26,7 +26,7 @@ async function runTests(browser, accDoc) {
let url = snippetToURL(`<input id="input" type="button" value="button">`, {
contentDocBodyAttrs: { id: "buttonInputDoc" },
});
browser.loadURI(url, {
browser.loadURI(Services.io.newURI(url), {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
evt = await onFocus;

View File

@ -42,13 +42,13 @@
}
async function doTest() {
const URL = "http://mochi.test:8888/a11y/accessible/tests/mochitest/events/scroll.html#link1";
const kURL = "http://mochi.test:8888/a11y/accessible/tests/mochitest/events/scroll.html#link1";
let evtProm = waitForEvents([
[EVENT_DOCUMENT_LOAD_COMPLETE, currentTabDocument],
[EVENT_SCROLLING_START, matchesAnchorJumpInTabDocument()],
], "Load foreground tab then scroll to anchor");
tabBrowser().loadURI(URL, {
tabBrowser().loadURI(Services.io.newURI(kURL), {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
// Flush layout, so as to guarantee that the a11y tree is constructed.
@ -61,7 +61,7 @@
unexpected: [[EVENT_SCROLLING_START, matchesAnchorJumpInTabDocument(1)]],
}, "Load background tab, don't dispatch scroll to anchor event");
tabBrowser().addTab(URL, {
tabBrowser().addTab(kURL, {
referrerURI: null,
charset: "",
postData: null,

View File

@ -41,7 +41,7 @@
this.invoke = function loadTab_invoke()
{
tabBrowser().loadURI(aURL, {
tabBrowser().loadURI(Services.io.newURI(aURL), {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
}

View File

@ -31,7 +31,7 @@
{
this.invoke = function loadURI_invoke()
{
tabBrowser().loadURI(aURI, {
tabBrowser().loadURI(Services.io.newURI(aURI), {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
}

View File

@ -25,9 +25,12 @@ add_task(async function() {
);
resolve();
});
selectedBrowser.loadURI("data:text/html,<h1 id='h1'>Select Me</h1>", {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
selectedBrowser.loadURI(
Services.io.newURI("data:text/html,<h1 id='h1'>Select Me</h1>"),
{
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
}
);
});
await SimpleTest.promiseFocus(newwindow);

View File

@ -82,15 +82,18 @@ function clear_history() {
}
// Waits for a load and updates the known history
var waitForLoad = async function(uri) {
info("Loading " + uri);
var waitForLoad = async function(uriString) {
info("Loading " + uriString);
// Longwinded but this ensures we don't just shortcut to LoadInNewProcess
let loadURIOptions = {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
};
gBrowser.selectedBrowser.webNavigation.loadURI(uri, loadURIOptions);
gBrowser.selectedBrowser.webNavigation.loadURI(
Services.io.newURI(uriString),
loadURIOptions
);
await BrowserTestUtils.browserStopped(gBrowser, uri);
await BrowserTestUtils.browserStopped(gBrowser, uriString);
// Some of the documents we're using in this test use Fluent,
// and they may finish localization later.
@ -111,16 +114,16 @@ var waitForLoad = async function(uri) {
// Waits for a load and updates the known history
var waitForLoadWithFlags = async function(
uri,
uriString,
flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE
) {
info("Loading " + uri + " flags = " + flags);
gBrowser.selectedBrowser.loadURI(uri, {
info("Loading " + uriString + " flags = " + flags);
gBrowser.selectedBrowser.loadURI(Services.io.newURI(uriString), {
flags,
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
await BrowserTestUtils.browserStopped(gBrowser, uri);
await BrowserTestUtils.browserStopped(gBrowser, uriString);
if (!(flags & Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY)) {
if (flags & Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY) {
gExpectedHistory.entries.pop();

View File

@ -24,7 +24,7 @@ add_task(async function test_interactions_referrer() {
true,
Services.io.newURI(TEST_REFERRER_URL)
);
browser.loadURI(TEST_URL, {
browser.loadURI(Services.io.newURI(TEST_URL), {
referrerInfo: referrerInfo1,
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal(
{}

View File

@ -48,7 +48,7 @@ add_task(async function() {
true,
Services.io.newURI(REFERRER1)
);
browser.loadURI("http://example.org", {
browser.loadURI(Services.io.newURI("http://example.org"), {
referrerInfo: referrerInfo1,
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
});

View File

@ -83,7 +83,7 @@ add_task(async function save_worthy_tabs_remote_final() {
// Replace about:blank with a new remote page.
let entryReplaced = promiseOnHistoryReplaceEntry(browser);
browser.loadURI("https://example.com/", {
browser.loadURI(Services.io.newURI("https://example.com/"), {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
await entryReplaced;
@ -141,7 +141,7 @@ add_task(async function dont_save_empty_tabs_final() {
// We're doing a cross origin navigation, so we can't reliably use a
// SpecialPowers task here. Instead we just emulate a location.replace() call.
browser.loadURI("about:blank", {
browser.loadURI(Services.io.newURI("about:blank"), {
loadFlags:
Ci.nsIWebNavigation.LOAD_FLAGS_STOP_CONTENT |
Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY,

View File

@ -206,7 +206,7 @@ function closeAllButOneTab(url = "about:blank") {
while (gBrowser.tabs.length > 1) {
gBrowser.removeTab(gBrowser.selectedTab, { animate: false });
}
gBrowser.selectedBrowser.loadURI(url, {
gBrowser.selectedBrowser.loadURI(Services.io.newURI(url), {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
if (gBrowser.selectedTab.pinned) {

View File

@ -10,10 +10,11 @@ add_task(async function() {
// Open the URL in a private browsing window.
const win = await BrowserTestUtils.openNewBrowserWindow({ private: true });
const tab = win.gBrowser.selectedBrowser;
const systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
tab.loadURI(ALT_DOMAIN_SECURED + "storage-cache-error.html", {
triggeringPrincipal: systemPrincipal,
});
const triggeringPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
tab.loadURI(
Services.io.newURI(ALT_DOMAIN_SECURED + "storage-cache-error.html"),
{ triggeringPrincipal }
);
await BrowserTestUtils.browserLoaded(tab);
// On enumerating cache storages, CacheStorage::Keys would throw a

View File

@ -311,7 +311,9 @@ add_task(async function windowless_browser() {
Ci.nsIWebProgress.NOTIFY_ALL
);
});
browser.loadURI("about:blank", { triggeringPrincipal: principal });
browser.loadURI(Services.io.newURI("about:blank"), {
triggeringPrincipal: principal,
});
info("Wait for the location change");
await onLocationChange;
is(

View File

@ -27,7 +27,7 @@ add_task(async function test_loadURI_persists_postData() {
Ci.nsIPrincipal
);
tab.linkedBrowser.loadURI(gUrl, {
tab.linkedBrowser.loadURI(Services.io.newURI(gUrl), {
triggeringPrincipal: systemPrincipal,
postData: postStream,
});

View File

@ -99,7 +99,7 @@ add_task(async function test() {
// page after each test, since the tests will each navigate away
// from it.
await promiseLoaded(TEST_PAGE, () => {
browser.loadURI(TEST_PAGE, {
browser.loadURI(Services.io.newURI(TEST_PAGE), {
triggeringPrincipal: document.nodePrincipal,
});
});

View File

@ -33,7 +33,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=430050
document.getElementById('b').setAttribute("src",
"data:text/plain,failed");
const systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
document.getElementById('b').loadURI('data:text/plain,succeeded', {
document.getElementById('b').loadURI(Services.io.newURI('data:text/plain,succeeded'), {
triggeringPrincipal: systemPrincipal
});
document.getElementById('b').addEventListener("load", endTest);

View File

@ -206,7 +206,7 @@ async function chromeScriptFunc() {
const system = Services.scriptSecurityManager.getSystemPrincipal();
browser.loadURI(
"data:text/html,<!DOCTYPE HTML><html><body></body></html>",
Services.io.newURI("data:text/html,<!DOCTYPE HTML><html><body></body></html>"),
{ triggeringPrincipal: system }
);

View File

@ -124,7 +124,10 @@ var waitForLoad = async function(uri) {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
referrerInfo,
};
gBrowser.selectedBrowser.webNavigation.loadURI(uri, loadURIOptions);
gBrowser.selectedBrowser.webNavigation.loadURI(
Services.io.newURI(uri),
loadURIOptions
);
await BrowserTestUtils.browserStopped(gBrowser, uri);
};

View File

@ -15,7 +15,7 @@ function testOnPrivateWindow(aCallback) {
win.addEventListener("load", function() {
win.addEventListener("DOMContentLoaded", function onInnerLoad() {
if (win.content.location.href == "about:privatebrowsing") {
win.gBrowser.loadURI(contentPage, {
win.gBrowser.loadURI(Services.io.newURI(contentPage), {
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
});
return;

View File

@ -27,13 +27,13 @@ function testOnWindow(aIsPrivate, aCallback) {
win.addEventListener("load", function() {
win.addEventListener("DOMContentLoaded", function onInnerLoad() {
if (win.content.location.href == "about:privatebrowsing") {
win.gBrowser.loadURI(contentPage);
win.gBrowser.loadURI(Services.io.newURI(contentPage));
return;
}
win.removeEventListener("DOMContentLoaded", onInnerLoad, true);
SimpleTest.executeSoon(function() { aCallback(win); });
}, true);
win.gBrowser.loadURI(contentPage);
win.gBrowser.loadURI(Services.io.newURI(contentPage));
}, {capture: true, once: true});
}

View File

@ -22,7 +22,7 @@ add_task(async function test_windowlessBrowserTroubleshootCrash() {
let loadURIOptions = {
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
};
webNav.loadURI("about:blank", loadURIOptions);
webNav.loadURI(Services.io.newURI("about:blank"), loadURIOptions);
await onLoaded;

View File

@ -61,7 +61,7 @@ function testBFCache() {
is(chances > 0, true, "Must have animated a few frames so far");
// Browse elsewhere; push our animating page into the bfcache
gBrowser.loadURI("about:blank");
gBrowser.loadURI(Services.io.newURI("about:blank"));
// Wait a bit for page to fully load, then wait a while and
// see that no animation occurs.

View File

@ -12,8 +12,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=618176
<!-- test code goes here -->
<script type="application/javascript"><![CDATA[
/* global messageManager */
const TEST_PAGE =
"data:text/html,<script>var a=[1,2,3];</script>Hi";
const TEST_PAGE = Services.io.newURI(
"data:text/html,<script>var a=[1,2,3];</script>Hi"
);
const FRAME_SCRIPT =
"data:,addEventListener('pageshow', function() { sendAsyncMessage('test', content.wrappedJSObject.a) }, false);";

View File

@ -45,7 +45,7 @@
]),
});
});
b.loadURI("about:blank", { triggeringPrincipal });
b.loadURI(null /*blank*/, { triggeringPrincipal });
await loaded;
}
});

View File

@ -144,7 +144,7 @@ function testOnWindow(aIsPrivate, aCallback) {
whenDelayedStartupFinished(win, function() {
win.addEventListener("DOMContentLoaded", function onInnerLoad() {
if (win.content.location.href != contentPage) {
win.gBrowser.loadURI(contentPage, {
win.gBrowser.loadURI(Services.io.newURI(contentPage), {
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
});
return;
@ -156,7 +156,7 @@ function testOnWindow(aIsPrivate, aCallback) {
}, true);
SimpleTest.info("load's window: " + win.location + " vs. " + window.location);
win.setTimeout(function() {
win.gBrowser.loadURI(contentPage, {
win.gBrowser.loadURI(Services.io.newURI(contentPage), {
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
});
}, 0);

View File

@ -82,7 +82,7 @@ class Delegate {
{}
);
browser.loadURI(url, {
browser.fixupAndLoadURIString(url, {
flags: Ci.nsIWebNavigation.LOAD_FLAGS_NONE,
triggeringPrincipal,
});

View File

@ -831,7 +831,7 @@ add_test(function test_helpers_open_sync_preferences() {
let mockBrowser = {
loadURI(uri) {
Assert.equal(
uri,
uri.spec,
"about:preferences?entrypoint=fxa%3Averification_complete#sync"
);
run_next_test();

View File

@ -934,7 +934,7 @@ export var BrowserTestUtils = {
* The URI to load.
*/
loadURIString(browser, uri) {
browser.loadURI(uri, {
browser.fixupAndLoadURIString(uri, {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
},

View File

@ -110,7 +110,7 @@ function testInit() {
let loadURIOptions = {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
};
webNav.loadURI(url, loadURIOptions);
webNav.fixupAndLoadURIString(url, loadURIOptions);
};
var listener =

View File

@ -3,7 +3,7 @@ const gBaseURL = "https://example.com/browser/testing/mochitest/tests/browser/";
function promiseTabLoadEvent(tab, url) {
let promise = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, url);
if (url) {
tab.linkedBrowser.loadURI(url);
tab.linkedBrowser.loadURI(Services.io.newURI(url));
}
return promise;
}

View File

@ -163,7 +163,7 @@ class ContentPage {
triggeringPrincipal: system,
};
chromeShell.loadURI(
"chrome://extensions/content/dummy.xhtml",
Services.io.newURI("chrome://extensions/content/dummy.xhtml"),
loadURIOptions
);
@ -255,7 +255,7 @@ class ContentPage {
async loadURL(url, redirectUrl = undefined) {
await this.browserReady;
this.browser.loadURI(url, {
this.browser.fixupAndLoadURIString(url, {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
return promiseBrowserLoaded(this.browser, url, redirectUrl);

View File

@ -230,7 +230,7 @@ export class TalosTabSwitchParent extends JSWindowActorParent {
// We'll switch back to about:blank after each tab switch
// in an attempt to put the graphics layer into a "steady"
// state before switching to the next tab.
initialTab.linkedBrowser.loadURI("about:blank", {
initialTab.linkedBrowser.loadURI(Services.io.newURI("about:blank"), {
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal(
{}
),

View File

@ -1,7 +1,8 @@
"use strict";
const childFrameURL =
"data:text/html,<!DOCTYPE HTML><html><body></body></html>";
const childFrameURL = Services.io.newURI(
"data:text/html,<!DOCTYPE HTML><html><body></body></html>"
);
async function runTestsForFrame(browser, isPrivate) {
let loadContext = Cu.createLoadContext();

View File

@ -147,8 +147,8 @@ add_task(async function test_unload_extension_during_background_page_startup() {
// Prevent the background page from actually loading.
Management.once("extension-browser-inserted", (eventName, browser) => {
// Intercept background page load.
let browserLoadURI = browser.loadURI;
browser.loadURI = function() {
let browserFixupAndLoadURIString = browser.fixupAndLoadURIString;
browser.fixupAndLoadURIString = function() {
Assert.equal(++backgroundLoadCount, 1, "loadURI should be called once");
Assert.equal(
arguments[0],
@ -157,7 +157,7 @@ add_task(async function test_unload_extension_during_background_page_startup() {
);
// Reset to "about:blank" to not load the actual background page.
arguments[0] = "about:blank";
browserLoadURI.apply(this, arguments);
browserFixupAndLoadURIString.apply(this, arguments);
// And force the extension process to crash.
if (browser.isRemote) {

View File

@ -539,7 +539,7 @@ add_task(async function test_shutdown_before_background_loaded() {
let bgAbortedPromise = new Promise(resolve => {
let Management = ExtensionParent.apiManager;
Management.once("extension-browser-inserted", (eventName, browser) => {
browser.loadURI = async () => {
browser.fixupAndLoadURIString = async () => {
// The fire.wakeup/fire.async promises created while loading the
// background page should settle when the page fails to load.
fire = (await primeListenerPromise)[0].fire;

View File

@ -31,7 +31,10 @@ add_task(async function test_referrer() {
Services.io.newURI(DUMMY2)
),
};
browser.webNavigation.loadURI(DUMMY1, loadURIOptionsWithReferrer);
browser.webNavigation.loadURI(
Services.io.newURI(DUMMY1),
loadURIOptionsWithReferrer
);
await waitForLoad(DUMMY1);
await SpecialPowers.spawn(browser, [[DUMMY1, DUMMY2]], function([
@ -83,10 +86,10 @@ add_task(async function test_history() {
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
let browser = gBrowser.selectedBrowser;
browser.webNavigation.loadURI(DUMMY1, LOAD_URI_OPTIONS);
browser.webNavigation.loadURI(Services.io.newURI(DUMMY1), LOAD_URI_OPTIONS);
await waitForLoad(DUMMY1);
browser.webNavigation.loadURI(DUMMY2, LOAD_URI_OPTIONS);
browser.webNavigation.loadURI(Services.io.newURI(DUMMY2), LOAD_URI_OPTIONS);
await waitForLoad(DUMMY2);
if (!SpecialPowers.Services.appinfo.sessionHistoryInParent) {
@ -162,20 +165,26 @@ add_task(async function test_flags() {
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
let browser = gBrowser.selectedBrowser;
browser.webNavigation.loadURI(DUMMY1, LOAD_URI_OPTIONS);
browser.webNavigation.loadURI(Services.io.newURI(DUMMY1), LOAD_URI_OPTIONS);
await waitForLoad(DUMMY1);
let loadURIOptionsReplaceHistory = {
triggeringPrincipal: SYSTEMPRINCIPAL,
loadFlags: Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY,
};
browser.webNavigation.loadURI(DUMMY2, loadURIOptionsReplaceHistory);
browser.webNavigation.loadURI(
Services.io.newURI(DUMMY2),
loadURIOptionsReplaceHistory
);
await waitForLoad(DUMMY2);
await checkHistory(browser, { count: 1, index: 0 });
let loadURIOptionsBypassHistory = {
triggeringPrincipal: SYSTEMPRINCIPAL,
loadFlags: Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY,
};
browser.webNavigation.loadURI(DUMMY1, loadURIOptionsBypassHistory);
browser.webNavigation.loadURI(
Services.io.newURI(DUMMY1),
loadURIOptionsBypassHistory
);
await waitForLoad(DUMMY1);
await checkHistory(browser, { count: 1, index: 0 });
@ -196,7 +205,10 @@ add_task(async function test_badarguments() {
triggeringPrincipal: SYSTEMPRINCIPAL,
postData: {},
};
browser.webNavigation.loadURI(DUMMY1, loadURIOptionsBadPostData);
browser.webNavigation.loadURI(
Services.io.newURI(DUMMY1),
loadURIOptionsBadPostData
);
ok(
false,
"Should have seen an exception from trying to pass some postdata"
@ -210,7 +222,10 @@ add_task(async function test_badarguments() {
triggeringPrincipal: SYSTEMPRINCIPAL,
headers: {},
};
browser.webNavigation.loadURI(DUMMY1, loadURIOptionsBadHeader);
browser.webNavigation.loadURI(
Services.io.newURI(DUMMY1),
loadURIOptionsBadHeader
);
ok(false, "Should have seen an exception from trying to pass some headers");
} catch (e) {
ok(true, "Should have seen an exception from trying to pass some headers");

View File

@ -31,7 +31,7 @@ function testOnWindow() {
subject => subject == win).then(() => {
win.addEventListener("DOMContentLoaded", function onInnerLoad() {
if (win.content.location.href != contentPage) {
win.gBrowser.loadURI(contentPage, {
win.gBrowser.loadURI(Services.io.newURI(contentPage), {
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
});
return;
@ -47,7 +47,7 @@ function testOnWindow() {
}, false, true);
}, true);
SimpleTest.executeSoon(function() {
win.gBrowser.loadURI(contentPage, {
win.gBrowser.loadURI(Services.io.newURI(contentPage), {
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
});
});

View File

@ -54,7 +54,7 @@ function testOnWindow() {
subject => subject == win).then(() => {
win.addEventListener("DOMContentLoaded", function onInnerLoad() {
if (win.content.location.href != contentPage) {
win.gBrowser.loadURI(contentPage, {
win.gBrowser.loadURI(Services.io.newURI(contentPage), {
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
});
return;
@ -69,7 +69,7 @@ function testOnWindow() {
}, false, true);
}, true);
SimpleTest.executeSoon(function() {
win.gBrowser.loadURI(contentPage, {
win.gBrowser.loadURI(Services.io.newURI(contentPage), {
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
});
});

View File

@ -82,7 +82,7 @@ function executeTest(test) {
subject => subject == win).then(() => {
win.addEventListener("DOMContentLoaded", function onInnerLoad() {
if (win.content.location.href != contentPage) {
win.gBrowser.loadURI(contentPage, {
win.gBrowser.loadURI(Services.io.newURI(contentPage), {
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
});
return;
@ -106,7 +106,7 @@ function executeTest(test) {
});
}, true);
SimpleTest.executeSoon(function() {
win.gBrowser.loadURI(contentPage, {
win.gBrowser.loadURI(Services.io.newURI(contentPage), {
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
});
});

View File

@ -30,7 +30,7 @@ function testOnWindow(aPrivate) {
subject => subject == win).then(() => {
win.addEventListener("DOMContentLoaded", function onInnerLoad() {
if (win.content.location.href != contentPage) {
win.gBrowser.loadURI(contentPage, {
win.gBrowser.loadURI(Services.io.newURI(contentPage), {
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
});
return;
@ -45,7 +45,7 @@ function testOnWindow(aPrivate) {
}, false, true);
}, true);
SimpleTest.executeSoon(function() {
win.gBrowser.loadURI(contentPage, {
win.gBrowser.loadURI(Services.io.newURI(contentPage), {
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
});
});

View File

@ -29,7 +29,7 @@ function testOnWindow(aCallback) {
subject => subject == win).then(() => {
win.addEventListener("DOMContentLoaded", function onInnerLoad() {
if (win.content.location.href != contentPage) {
win.gBrowser.loadURI(contentPage, {
win.gBrowser.loadURI(Services.io.newURI(contentPage), {
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
});
return;
@ -42,7 +42,7 @@ function testOnWindow(aCallback) {
}, false, true);
}, true);
SimpleTest.executeSoon(function() {
win.gBrowser.loadURI(contentPage, {
win.gBrowser.loadURI(Services.io.newURI(contentPage), {
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
});
});

View File

@ -146,7 +146,7 @@ function useTriggeringPrincipal(principal = undefined) {
let triggeringPrincipal = principal ?? browser.contentPrincipal;
info("Loading uri: " + uri);
browser.loadURI(uri, { triggeringPrincipal });
browser.loadURI(Services.io.newURI(uri), { triggeringPrincipal });
};
}

View File

@ -9,8 +9,8 @@ server.registerDirectory("/", do_get_cwd());
server.start(-1);
const ROOT = `http://localhost:${server.identity.primaryPort}`;
const BASE = `${ROOT}/`;
const HEADLESS_URL = `${BASE}/headless.html`;
const HEADLESS_BUTTON_URL = `${BASE}/headless_button.html`;
const HEADLESS_URL = Services.io.newURI(`${BASE}/headless.html`);
const HEADLESS_BUTTON_URL = Services.io.newURI(`${BASE}/headless_button.html`);
registerCleanupFunction(() => {
server.stop(() => {});
});