Bug 1485305 - misc Ensure loadURI always passes a triggeringPrincipal() r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D4560

--HG--
extra : source : edc4d8898d26a199fb230489a644b88c2fd8f739
This commit is contained in:
Jonathan Kingston 2018-08-29 15:48:52 +01:00
parent bab12b5e5b
commit 23bfc5f0ef
8 changed files with 15 additions and 8 deletions

View File

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

View File

@ -26,7 +26,7 @@ add_task(async function setup() {
async function testDeviceConnected(deviceName) {
info("testDeviceConnected with deviceName=" + deviceName);
gBrowser.selectedBrowser.loadURI("about:robots");
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:robots");
await waitForDocLoadComplete();
let waitForTabPromise = BrowserTestUtils.waitForNewTab(gBrowser);

View File

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

View File

@ -633,7 +633,9 @@ var BrowserTestUtils = {
*/
async loadURI(browser, uri) {
// Load the new URI.
browser.loadURI(uri);
browser.loadURI(uri, {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
// Nothing to do in non-e10s mode.
if (!browser.ownerGlobal.gMultiProcessBrowser) {

View File

@ -326,10 +326,13 @@ function startAndLoadURI(pageName) {
start_time = Date.now();
if (loadNoCache) {
content.loadURI(pageName, {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
flags: Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE
});
} else {
content.loadURI(pageName);
content.loadURI(pageName, {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
}
}

View File

@ -220,7 +220,9 @@ async function test(window) {
// 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", null, null);
initialTab.linkedBrowser.loadURI("about:blank", {
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
});
let tabs = gBrowser.getTabsToTheEndFrom(initialTab);
let times = [];

View File

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

View File

@ -20,7 +20,7 @@ const progressListeners = new Map();
function loadContentWindow(windowlessBrowser, uri) {
return new Promise((resolve, reject) => {
windowlessBrowser.loadURI(uri, Ci.nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
windowlessBrowser.loadURI(uri, Ci.nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null, Services.scriptSecurityManager.getSystemPrincipal());
let docShell = windowlessBrowser.docShell;
let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebProgress);