зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1485305 - toolkit/ Ensure loadURI always passes a triggeringPrincipal() r=Mossop
Differential Revision: https://phabricator.services.mozilla.com/D4563 --HG-- extra : source : d6cf9480ff81327427d175fbf3a50ffbad1671cc
This commit is contained in:
Родитель
10a8d159fb
Коммит
161582bc8b
|
@ -107,6 +107,9 @@ class WebNavigationChild extends ActorChild {
|
|||
baseURI = Services.io.newURI(baseURI);
|
||||
if (triggeringPrincipal)
|
||||
triggeringPrincipal = Utils.deserializePrincipal(triggeringPrincipal);
|
||||
if (!triggeringPrincipal) {
|
||||
triggeringPrincipal = Services.scriptSecurityManager.getSystemPrincipal({});
|
||||
}
|
||||
this._wrapURIChangeCall(() => {
|
||||
return this.webNavigation.loadURIWithOptions(uri, flags, referrer, referrerPolicy,
|
||||
postData, headers, baseURI, triggeringPrincipal);
|
||||
|
|
|
@ -1112,7 +1112,7 @@ class HiddenXULWindow {
|
|||
let system = Services.scriptSecurityManager.getSystemPrincipal();
|
||||
this.chromeShell.createAboutBlankContentViewer(system);
|
||||
this.chromeShell.useGlobalHistory = false;
|
||||
this.chromeShell.loadURI("chrome://extensions/content/dummy.xul", 0, null, null, null);
|
||||
this.chromeShell.loadURI("chrome://extensions/content/dummy.xul", 0, null, null, null, system);
|
||||
|
||||
await promiseObserved("chrome-document-global-created",
|
||||
win => win.document == this.chromeShell.document);
|
||||
|
|
|
@ -131,7 +131,7 @@ class ContentPage {
|
|||
|
||||
chromeShell.createAboutBlankContentViewer(system);
|
||||
chromeShell.useGlobalHistory = false;
|
||||
chromeShell.loadURI("chrome://extensions/content/dummy.xul", 0, null, null, null);
|
||||
chromeShell.loadURI("chrome://extensions/content/dummy.xul", 0, null, null, null, system);
|
||||
|
||||
await promiseObserved("chrome-document-global-created",
|
||||
win => win.document == chromeShell.document);
|
||||
|
@ -182,7 +182,9 @@ class ContentPage {
|
|||
async loadURL(url, redirectUrl = undefined) {
|
||||
await this.browserReady;
|
||||
|
||||
this.browser.loadURI(url);
|
||||
this.browser.loadURI(url, {
|
||||
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
});
|
||||
return promiseBrowserLoaded(this.browser, url, redirectUrl);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ add_task(async function() {
|
|||
});
|
||||
|
||||
await BrowserTestUtils.withNewTab("about:blank", async function() {
|
||||
gBrowser.loadURI("moz://a");
|
||||
BrowserTestUtils.loadURI(gBrowser, "moz://a");
|
||||
await BrowserTestUtils.waitForLocationChange(gBrowser,
|
||||
`https://example.com/${path}mozprotocol.html`);
|
||||
ok(true, "Made it to the expected page");
|
||||
|
|
|
@ -81,7 +81,7 @@ add_task(async function() {
|
|||
let tab = gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
|
||||
|
||||
let promise = ContentTask.spawn(tab.linkedBrowser, ids, task);
|
||||
tab.linkedBrowser.loadURI("data:text/html;charset=utf-8," +
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, "data:text/html;charset=utf-8," +
|
||||
"<html><body>" +
|
||||
"<form id='" + ids.FORM1_ID + "'>" +
|
||||
"<input id='" + ids.CHANGE_INPUT_ID + "'></form>" +
|
||||
|
|
|
@ -87,7 +87,7 @@ function task(contentConsts) {
|
|||
add_task(async function() {
|
||||
let tab = gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
|
||||
let promise = ContentTask.spawn(tab.linkedBrowser, consts, task);
|
||||
tab.linkedBrowser.loadURI("data:text/html;charset=utf-8," +
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, "data:text/html;charset=utf-8," +
|
||||
"<html><body>" +
|
||||
"<form id='" + consts.FORM1_ID + "'>" +
|
||||
"<input id='" + consts.CHANGE_INPUT_ID + "'></form>" +
|
||||
|
|
|
@ -57,7 +57,7 @@ add_task(async function test_urlbar_fragment_enter() {
|
|||
add_task(async function test_backButton_forwardButton() {
|
||||
await withTestPage(async function(aBrowser) {
|
||||
// Load a new page in the tab so we can test going back
|
||||
aBrowser.loadURI("https://example.com" + DIRECTORY_PATH + "formless_basic.html?second");
|
||||
BrowserTestUtils.loadURI(aBrowser, "https://example.com" + DIRECTORY_PATH + "formless_basic.html?second");
|
||||
await BrowserTestUtils.browserLoaded(aBrowser, false,
|
||||
"https://example.com" + DIRECTORY_PATH +
|
||||
"formless_basic.html?second");
|
||||
|
@ -121,7 +121,7 @@ add_task(async function test_back_keyboard_shortcut() {
|
|||
}
|
||||
await withTestPage(async function(aBrowser) {
|
||||
// Load a new page in the tab so we can test going back
|
||||
aBrowser.loadURI("https://example.com" + DIRECTORY_PATH + "formless_basic.html?second");
|
||||
BrowserTestUtils.loadURI(aBrowser, "https://example.com" + DIRECTORY_PATH + "formless_basic.html?second");
|
||||
await BrowserTestUtils.browserLoaded(aBrowser, false,
|
||||
"https://example.com" + DIRECTORY_PATH +
|
||||
"formless_basic.html?second");
|
||||
|
|
|
@ -34,7 +34,7 @@ add_task(async function test() {
|
|||
});
|
||||
|
||||
BrowserTestUtils.browserLoaded(tab.linkedBrowser).then(() => finish());
|
||||
tab.linkedBrowser.loadURI("http://example.com/browser/toolkit/components/passwordmgr/test/browser/authenticate.sjs");
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, "http://example.com/browser/toolkit/components/passwordmgr/test/browser/authenticate.sjs");
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -213,7 +213,7 @@ function testOnWindow(aIsPrivate, aCallback) {
|
|||
whenDelayedStartupFinished(win, function() {
|
||||
win.addEventListener("DOMContentLoaded", function onInnerLoad() {
|
||||
if (win.content.location.href != contentPage) {
|
||||
win.gBrowser.loadURI(contentPage);
|
||||
BrowserTestUtils.loadURI(win.gBrowser, contentPage);
|
||||
return;
|
||||
}
|
||||
win.removeEventListener("DOMContentLoaded", onInnerLoad, true);
|
||||
|
@ -224,7 +224,7 @@ function testOnWindow(aIsPrivate, aCallback) {
|
|||
SimpleTest.executeSoon(function() { aCallback(win); });
|
||||
}, false, true);
|
||||
}, true);
|
||||
SimpleTest.executeSoon(function() { win.gBrowser.loadURI(contentPage); });
|
||||
SimpleTest.executeSoon(function() { BrowserTestUtils.loadURI(win.gBrowser, contentPage); });
|
||||
});
|
||||
}, {capture: true, once: true});
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ add_task(async function test() {
|
|||
await ContentTask.spawn(newTab.linkedBrowser, null, frameScript);
|
||||
|
||||
info("Opening URL");
|
||||
newTab.linkedBrowser.loadURI(URL);
|
||||
BrowserTestUtils.loadURI(newTab.linkedBrowser, URL);
|
||||
|
||||
if (Services.sysinfo.getPropertyAsAString("name") == "Windows_NT") {
|
||||
info("Deactivating sanity checks under Windows (bug 1151240)");
|
||||
|
|
|
@ -31,7 +31,7 @@ add_task(async function() {
|
|||
expectedURI = uri;
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
|
||||
PlacesObservers.addListener(["page-visited"], onVisitsListener);
|
||||
gBrowser.loadURI(uri);
|
||||
BrowserTestUtils.loadURI(gBrowser, uri);
|
||||
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, uri);
|
||||
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, uri);
|
||||
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, uri);
|
||||
|
|
|
@ -24,7 +24,7 @@ function test() {
|
|||
|
||||
function waitForTabLoad(aWin, aCallback) {
|
||||
BrowserTestUtils.browserLoaded(aWin.gBrowser.selectedBrowser).then(aCallback);
|
||||
aWin.gBrowser.selectedBrowser.loadURI(pageURI);
|
||||
BrowserTestUtils.loadURI(aWin.gBrowser.selectedBrowser, pageURI);
|
||||
}
|
||||
|
||||
testOnWindow(true, function(win) {
|
||||
|
|
|
@ -29,7 +29,7 @@ add_task(async function test() {
|
|||
}
|
||||
PlacesObservers.addListener(["page-visited"], onVisits);
|
||||
});
|
||||
gBrowser.selectedBrowser.loadURI(TEST_URL);
|
||||
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_URL);
|
||||
await promiseVisit;
|
||||
|
||||
is(await PlacesTestUtils.fieldInDB(TEST_URL, "frecency"), frecency, "Frecency should be unchanged");
|
||||
|
|
|
@ -28,7 +28,7 @@ add_task(async function() {
|
|||
await SpecialPowers.popPrefEnv();
|
||||
|
||||
let browserLoadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
gBrowser.loadURI(FINAL_URL);
|
||||
BrowserTestUtils.loadURI(gBrowser, FINAL_URL);
|
||||
await browserLoadedPromise;
|
||||
|
||||
let subject = await visitUriPromise;
|
||||
|
|
|
@ -172,7 +172,7 @@ add_task(async function test_reader_view_element_attribute_transform() {
|
|||
await observeAttribute(menuitem, "hidden",
|
||||
() => {
|
||||
let url = TEST_PATH + "readerModeArticle.html";
|
||||
tab.linkedBrowser.loadURI(url);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, url);
|
||||
},
|
||||
() => {
|
||||
is(menuitem.hidden, false, "menuitem's hidden attribute should be false on a reader-able page");
|
||||
|
@ -185,7 +185,7 @@ add_task(async function test_reader_view_element_attribute_transform() {
|
|||
await observeAttribute(menuitem, "hidden",
|
||||
() => {
|
||||
let url = TEST_PATH + "readerModeArticleHiddenNodes.html";
|
||||
tab.linkedBrowser.loadURI(url);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, url);
|
||||
},
|
||||
() => {
|
||||
is(menuitem.hidden, true, "menuitem's hidden attribute should be true on a non-reader-able page");
|
||||
|
@ -198,7 +198,7 @@ add_task(async function test_reader_view_element_attribute_transform() {
|
|||
await observeAttribute(menuitem, "hidden",
|
||||
() => {
|
||||
let url = TEST_PATH + "readerModeArticle.html";
|
||||
tab.linkedBrowser.loadURI(url);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, url);
|
||||
},
|
||||
() => {
|
||||
is(menuitem.hidden, false, "menuitem's hidden attribute should be false on a reader-able page");
|
||||
|
@ -235,7 +235,7 @@ add_task(async function test_reader_view_element_attribute_transform() {
|
|||
await observeAttribute(menuitem, "hidden",
|
||||
() => {
|
||||
let url = TEST_PATH + "readerModeArticleHiddenNodes.html";
|
||||
tab.linkedBrowser.loadURI(url);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, url);
|
||||
},
|
||||
() => {
|
||||
is(menuitem.hidden, true, "menuitem's hidden attribute should be true on a non-reader-able page");
|
||||
|
|
|
@ -45,7 +45,7 @@ add_task(async function test_reader_button() {
|
|||
});
|
||||
});
|
||||
});
|
||||
tab.linkedBrowser.loadURI(url);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, url);
|
||||
await paintPromise;
|
||||
|
||||
is_element_hidden(readerButton, "Reader mode button is still not present on tab with unreadable content.");
|
||||
|
|
|
@ -96,6 +96,7 @@ RemoteWebNavigation.prototype = {
|
|||
// reason (such as failing to parse the URI), just ignore it.
|
||||
}
|
||||
}
|
||||
|
||||
this._sendMessage("WebNavigation:LoadURI", {
|
||||
uri: aURI,
|
||||
flags: aLoadFlags,
|
||||
|
@ -106,7 +107,7 @@ RemoteWebNavigation.prototype = {
|
|||
baseURI: aBaseURI ? aBaseURI.spec : null,
|
||||
triggeringPrincipal: aTriggeringPrincipal
|
||||
? Utils.serializePrincipal(aTriggeringPrincipal)
|
||||
: null,
|
||||
: Services.scriptSecurityManager.createNullPrincipal({}),
|
||||
requestTime: Services.telemetry.msSystemNow(),
|
||||
});
|
||||
},
|
||||
|
|
|
@ -82,7 +82,7 @@ add_task(async function init_navigate() {
|
|||
is(port.browser, gBrowser.selectedBrowser, "Port is for the correct browser");
|
||||
|
||||
let loaded = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
gBrowser.loadURI("about:blank");
|
||||
BrowserTestUtils.loadURI(gBrowser, "about:blank");
|
||||
|
||||
await waitForMessage(port, "RemotePage:Unload");
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ function addTab(aURI, aCallback) {
|
|||
function navigateTo(aURI) {
|
||||
let browser = gBrowser.selectedBrowser;
|
||||
BrowserTestUtils.browserLoaded(browser).then(next);
|
||||
browser.loadURI(aURI);
|
||||
BrowserTestUtils.loadURI(browser, aURI);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -83,7 +83,9 @@ 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(contentPage, {
|
||||
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -104,7 +106,11 @@ function executeTest(test) {
|
|||
}
|
||||
});
|
||||
}, true);
|
||||
SimpleTest.executeSoon(function() { win.gBrowser.loadURI(contentPage); });
|
||||
SimpleTest.executeSoon(function() {
|
||||
win.gBrowser.loadURI(contentPage, {
|
||||
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
|
||||
});
|
||||
});
|
||||
});
|
||||
}, {capture: true, once: true});
|
||||
});
|
||||
|
|
|
@ -31,7 +31,9 @@ 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(contentPage, {
|
||||
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
|
||||
});
|
||||
return;
|
||||
}
|
||||
win.removeEventListener("DOMContentLoaded", onInnerLoad, true);
|
||||
|
@ -44,7 +46,9 @@ function testOnWindow(aPrivate) {
|
|||
}, false, true);
|
||||
}, true);
|
||||
SimpleTest.executeSoon(function() {
|
||||
win.gBrowser.loadURI(contentPage);
|
||||
win.gBrowser.loadURI(contentPage, {
|
||||
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
|
||||
});
|
||||
});
|
||||
});
|
||||
}, {capture: true, once: true});
|
||||
|
|
|
@ -21,6 +21,7 @@ var contentPage = "chrome://mochitests/content/chrome/toolkit/components/url-cla
|
|||
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm");
|
||||
ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
|
||||
ChromeUtils.import("resource://testing-common/TestUtils.jsm");
|
||||
|
||||
function testOnWindow(aCallback) {
|
||||
|
@ -30,7 +31,7 @@ function testOnWindow(aCallback) {
|
|||
subject => subject == win).then(() => {
|
||||
win.addEventListener("DOMContentLoaded", function onInnerLoad() {
|
||||
if (win.content.location.href != contentPage) {
|
||||
win.gBrowser.loadURI(contentPage);
|
||||
BrowserTestUtils.loadURI(win.gBrowser, contentPage);
|
||||
return;
|
||||
}
|
||||
win.removeEventListener("DOMContentLoaded", onInnerLoad, true);
|
||||
|
@ -40,7 +41,9 @@ function testOnWindow(aCallback) {
|
|||
SimpleTest.executeSoon(function() { aCallback(win); });
|
||||
}, false, true);
|
||||
}, true);
|
||||
SimpleTest.executeSoon(function() { win.gBrowser.loadURI(contentPage); });
|
||||
SimpleTest.executeSoon(function() {
|
||||
BrowserTestUtils.loadURI(win.gBrowser, contentPage);
|
||||
});
|
||||
});
|
||||
}, {capture: true, once: true});
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ var contentPage = "http://www.itisatrap.org/chrome/toolkit/components/url-classi
|
|||
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm");
|
||||
ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
|
||||
ChromeUtils.import("resource://testing-common/TestUtils.jsm");
|
||||
|
||||
function testOnWindow(aPrivate, aCallback) {
|
||||
|
@ -33,7 +34,7 @@ function testOnWindow(aPrivate, aCallback) {
|
|||
subject => subject == win).then(() => {
|
||||
win.addEventListener("DOMContentLoaded", function onInnerLoad() {
|
||||
if (win.content.location.href != contentPage) {
|
||||
win.gBrowser.loadURI(contentPage);
|
||||
BrowserTestUtils.loadURI(win.gBrowser, contentPage);
|
||||
return;
|
||||
}
|
||||
win.removeEventListener("DOMContentLoaded", onInnerLoad, true);
|
||||
|
@ -43,7 +44,7 @@ function testOnWindow(aPrivate, aCallback) {
|
|||
SimpleTest.executeSoon(function() { aCallback(win); });
|
||||
}, false, true);
|
||||
}, true);
|
||||
SimpleTest.executeSoon(function() { win.gBrowser.loadURI(contentPage); });
|
||||
SimpleTest.executeSoon(function() { BrowserTestUtils.loadURI(win.gBrowser, contentPage); });
|
||||
});
|
||||
}, {capture: true, once: true});
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ var contentPage2 = "http://example.com/tests/toolkit/components/url-classifier/t
|
|||
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm");
|
||||
ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
|
||||
ChromeUtils.import("resource://testing-common/TestUtils.jsm");
|
||||
|
||||
function testOnWindow(contentPage) {
|
||||
|
@ -32,7 +33,7 @@ function testOnWindow(contentPage) {
|
|||
subject => subject == win).then(() => {
|
||||
win.addEventListener("DOMContentLoaded", function onInnerLoad() {
|
||||
if (win.content.location.href != contentPage) {
|
||||
win.gBrowser.loadURI(contentPage);
|
||||
BrowserTestUtils.loadURI(win.gBrowser, contentPage);
|
||||
return;
|
||||
}
|
||||
win.removeEventListener("DOMContentLoaded", onInnerLoad, true);
|
||||
|
@ -45,7 +46,7 @@ function testOnWindow(contentPage) {
|
|||
}, false, true);
|
||||
}, true);
|
||||
SimpleTest.executeSoon(function() {
|
||||
win.gBrowser.loadURI(contentPage);
|
||||
BrowserTestUtils.loadURI(win.gBrowser, contentPage);
|
||||
});
|
||||
});
|
||||
}, {capture: true, once: true});
|
||||
|
|
|
@ -281,7 +281,7 @@ var ViewSourceContent = {
|
|||
loadSourceFromURL(URL) {
|
||||
let loadFlags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
|
||||
let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
|
||||
webNav.loadURI(URL, loadFlags, null, null, null);
|
||||
webNav.loadURI(URL, loadFlags, null, null, null, Services.scriptSecurityManager.getSystemPrincipal());
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -604,7 +604,8 @@ var ViewSourceContent = {
|
|||
webNav.loadURIWithOptions(uri, loadFlags,
|
||||
null, referrerPolicy, // referrer
|
||||
null, null, // postData, headers
|
||||
Services.io.newURI(baseURI));
|
||||
Services.io.newURI(baseURI),
|
||||
Services.scriptSecurityManager.getSystemPrincipal());
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -58,13 +58,13 @@ add_task(async function cross_tabs_audio_competing() {
|
|||
info("- open tab 1 in foreground -");
|
||||
let tab1 = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
|
||||
"about:blank");
|
||||
tab1.linkedBrowser.loadURI(PAGE);
|
||||
BrowserTestUtils.loadURI(tab1.linkedBrowser, PAGE);
|
||||
await waitForTabPlayingEvent(tab1, true);
|
||||
|
||||
info("- open tab 2 in foreground -");
|
||||
let tab2 = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
|
||||
"about:blank");
|
||||
tab2.linkedBrowser.loadURI(PAGE);
|
||||
BrowserTestUtils.loadURI(tab2.linkedBrowser, PAGE);
|
||||
await waitForTabPlayingEvent(tab1, false);
|
||||
|
||||
info("- open tab 3 in foreground -");
|
||||
|
@ -87,7 +87,7 @@ add_task(async function within_one_tab_audio_competing() {
|
|||
info("- open tab and play audio1 -");
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
|
||||
"about:blank");
|
||||
tab.linkedBrowser.loadURI(PAGE);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
|
||||
await waitForTabPlayingEvent(tab, true);
|
||||
|
||||
info("- play audio2 in the same tab -");
|
||||
|
|
|
@ -115,7 +115,7 @@ function stop_audio1_from_page() {
|
|||
}
|
||||
|
||||
async function audio_competing_for_active_agent(url, browser) {
|
||||
browser.loadURI(url);
|
||||
BrowserTestUtils.loadURI(browser, url);
|
||||
|
||||
info("- page should have playing audio -");
|
||||
await wait_for_event(browser, "DOMAudioPlaybackStarted");
|
||||
|
|
|
@ -14,7 +14,9 @@ add_task(async function testAudibleAutoplayMedia() {
|
|||
|
||||
// start observing the topic before loading the page to ensure we can get it.
|
||||
let audibleAutoplayOccurred = TestUtils.topicObserved("AudibleAutoplayMediaOccurred");
|
||||
browser.loadURI(PAGE);
|
||||
browser.loadURI(PAGE, {
|
||||
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
});
|
||||
|
||||
await BrowserTestUtils.browserLoaded(browser);
|
||||
await audibleAutoplayOccurred;
|
||||
|
|
|
@ -45,7 +45,7 @@ async function test_permission_propagation(testName, testSrc, layersNum) {
|
|||
info("- open new tab -");
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
|
||||
"about:blank");
|
||||
tab.linkedBrowser.loadURI(testSrc);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, testSrc);
|
||||
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
|
||||
// If the frame isn't activated, the video play will fail.
|
||||
|
|
|
@ -13,7 +13,7 @@ async function allow_play_for_played_video() {
|
|||
info("- open new tab -");
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
|
||||
"about:blank");
|
||||
tab.linkedBrowser.loadURI(VIDEO_PAGE);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, VIDEO_PAGE);
|
||||
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
|
||||
info("- simulate user-click to start video -");
|
||||
|
|
|
@ -44,7 +44,7 @@ async function test_play_without_user_gesture() {
|
|||
info("- open new tab -");
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
|
||||
"about:blank");
|
||||
tab.linkedBrowser.loadURI(VIDEO_PAGE);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, VIDEO_PAGE);
|
||||
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
|
||||
async function check_autoplay_keyword() {
|
||||
|
@ -82,7 +82,7 @@ async function test_play_with_user_gesture(gesture) {
|
|||
info("- open new tab -");
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
|
||||
"about:blank");
|
||||
tab.linkedBrowser.loadURI(VIDEO_PAGE);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, VIDEO_PAGE);
|
||||
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
|
||||
info("- simulate user gesture -");
|
||||
|
|
|
@ -7,7 +7,7 @@ add_task(async function() {
|
|||
</body></html>';
|
||||
|
||||
let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
gBrowser.loadURI(dataUri);
|
||||
BrowserTestUtils.loadURI(gBrowser, dataUri);
|
||||
await loadedPromise;
|
||||
|
||||
await BrowserTestUtils.synthesizeMouse("#i", 50, 50, { button: 1 },
|
||||
|
|
|
@ -39,7 +39,7 @@ add_task(async function setup_test_preference() {
|
|||
add_task(async function block_autoplay_media() {
|
||||
info("- open new background tab1 -");
|
||||
let tab1 = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
|
||||
tab1.linkedBrowser.loadURI(PAGE);
|
||||
BrowserTestUtils.loadURI(tab1.linkedBrowser, PAGE);
|
||||
await BrowserTestUtils.browserLoaded(tab1.linkedBrowser);
|
||||
|
||||
info("- should block autoplay media for non-visited tab1 -");
|
||||
|
@ -47,7 +47,7 @@ add_task(async function block_autoplay_media() {
|
|||
|
||||
info("- open new background tab2 -");
|
||||
let tab2 = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
|
||||
tab2.linkedBrowser.loadURI(PAGE);
|
||||
BrowserTestUtils.loadURI(tab2.linkedBrowser, PAGE);
|
||||
await BrowserTestUtils.browserLoaded(tab2.linkedBrowser);
|
||||
|
||||
info("- should block autoplay for non-visited tab2 -");
|
||||
|
@ -91,7 +91,7 @@ add_task(async function block_autoplay_media() {
|
|||
|
||||
info("- open new background tab4 -");
|
||||
let tab4 = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
|
||||
tab4.linkedBrowser.loadURI(PAGE);
|
||||
BrowserTestUtils.loadURI(tab4.linkedBrowser, PAGE);
|
||||
await BrowserTestUtils.browserLoaded(tab4.linkedBrowser);
|
||||
info("- should block autoplay for non-visited tab4 -");
|
||||
await check_audio_suspended(tab4.linkedBrowser, SuspendedType.SUSPENDED_BLOCK);
|
||||
|
@ -102,7 +102,7 @@ add_task(async function block_autoplay_media() {
|
|||
await check_audio_paused(tab4.linkedBrowser, false);
|
||||
|
||||
info("- check that loading a new URI in page clears gesture activation status -");
|
||||
tab4.linkedBrowser.loadURI(PAGE);
|
||||
BrowserTestUtils.loadURI(tab4.linkedBrowser, PAGE);
|
||||
await BrowserTestUtils.browserLoaded(tab4.linkedBrowser);
|
||||
info("- should block autoplay again as gesture activation status cleared -");
|
||||
await check_audio_paused(tab4.linkedBrowser, true);
|
||||
|
|
|
@ -38,7 +38,7 @@ add_task(async function setup_test_preference() {
|
|||
add_task(async function block_autoplay_media() {
|
||||
info("- open new background tab1, and check tab1's media suspend type -");
|
||||
let tab1 = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
|
||||
tab1.linkedBrowser.loadURI(PAGE_SHOULD_NOT_PLAY);
|
||||
BrowserTestUtils.loadURI(tab1.linkedBrowser, PAGE_SHOULD_NOT_PLAY);
|
||||
await BrowserTestUtils.browserLoaded(tab1.linkedBrowser);
|
||||
await ContentTask.spawn(tab1.linkedBrowser, SuspendedType.NONE_SUSPENDED,
|
||||
check_audio_suspended);
|
||||
|
@ -48,7 +48,7 @@ add_task(async function block_autoplay_media() {
|
|||
|
||||
info("- open new background tab2, and check tab2's media suspend type -");
|
||||
let tab2 = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
|
||||
tab2.linkedBrowser.loadURI(PAGE_SHOULD_PLAY);
|
||||
BrowserTestUtils.loadURI(tab2.linkedBrowser, PAGE_SHOULD_PLAY);
|
||||
await BrowserTestUtils.browserLoaded(tab2.linkedBrowser);
|
||||
await ContentTask.spawn(tab2.linkedBrowser, SuspendedType.SUSPENDED_BLOCK,
|
||||
check_audio_suspended);
|
||||
|
|
|
@ -59,7 +59,7 @@ add_task(async function setup_test_preference() {
|
|||
add_task(async function media_should_be_able_to_play_in_visible_tab() {
|
||||
info("- open new background tab, and check tab's media pause state -");
|
||||
let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
|
||||
tab.linkedBrowser.loadURI(PAGE);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
|
||||
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
await ContentTask.spawn(tab.linkedBrowser, true,
|
||||
check_audio_pause_state);
|
||||
|
|
|
@ -86,7 +86,7 @@ add_task(async function block_multiple_media() {
|
|||
info("- open new background tab -");
|
||||
let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
|
||||
let browser = tab.linkedBrowser;
|
||||
browser.loadURI(PAGE);
|
||||
BrowserTestUtils.loadURI(browser, PAGE);
|
||||
await BrowserTestUtils.browserLoaded(browser);
|
||||
|
||||
info("- tab should be blocked -");
|
||||
|
|
|
@ -53,7 +53,7 @@ add_task(async function setup_test_preference() {
|
|||
add_task(async function block_not_in_tree_media() {
|
||||
info("- open new background tab -");
|
||||
let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
|
||||
tab.linkedBrowser.loadURI(PAGE);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
|
||||
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
|
||||
info("- tab should not be blocked -");
|
||||
|
|
|
@ -64,7 +64,7 @@ add_task(async function setup_test_preference() {
|
|||
add_task(async function unblock_icon_should_disapear_after_resume_tab() {
|
||||
info("- open new background tab -");
|
||||
let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
|
||||
tab.linkedBrowser.loadURI(PAGE);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
|
||||
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
|
||||
info("- audio doesn't be started in beginning -");
|
||||
|
|
|
@ -11,7 +11,7 @@ add_task(async function setup_test_preference() {
|
|||
add_task(async function block_plug_in() {
|
||||
info("- open new background tab -");
|
||||
let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
|
||||
tab.linkedBrowser.loadURI(PAGE);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
|
||||
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
|
||||
info("- tab should be blocked -");
|
||||
|
|
|
@ -35,7 +35,7 @@ add_task(async function setup_test_preference() {
|
|||
add_task(async function unblock_icon_should_disapear_after_resume_tab() {
|
||||
info("- open new background tab -");
|
||||
let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
|
||||
tab.linkedBrowser.loadURI(PAGE);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
|
||||
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
|
||||
info("- the suspend state of tab should be suspend-block -");
|
||||
|
@ -65,7 +65,7 @@ add_task(async function unblock_icon_should_disapear_after_resume_tab() {
|
|||
add_task(async function should_not_show_sound_indicator_after_resume_tab() {
|
||||
info("- open new background tab -");
|
||||
let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
|
||||
tab.linkedBrowser.loadURI(PAGE);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
|
||||
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
|
||||
info("- the suspend state of tab should be suspend-block -");
|
||||
|
|
|
@ -17,7 +17,7 @@ add_task(async function setup_test_preference() {
|
|||
add_task(async function block_web_audio() {
|
||||
info("- open new background tab -");
|
||||
let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
|
||||
tab.linkedBrowser.loadURI(PAGE);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
|
||||
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
|
||||
info("- tab should be blocked -");
|
||||
|
|
|
@ -92,7 +92,7 @@ body > div > div {width: 1000px;height: 1000px;}\
|
|||
for (let test of allTests) {
|
||||
if (test.dataUri) {
|
||||
let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
gBrowser.loadURI(test.dataUri);
|
||||
BrowserTestUtils.loadURI(gBrowser, test.dataUri);
|
||||
await loadedPromise;
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ add_task(async function test_content_url_annotation() {
|
|||
}, true, true);
|
||||
});
|
||||
});
|
||||
browser.loadURI(url);
|
||||
BrowserTestUtils.loadURI(browser, url);
|
||||
await promise;
|
||||
|
||||
// Crash the tab
|
||||
|
|
|
@ -44,13 +44,13 @@ add_task(async function() {
|
|||
is(browser.isSyntheticDocument, false, "Should not be synthetic");
|
||||
|
||||
let loadPromise = waitForPageShow(browser);
|
||||
browser.loadURI("data:text/html;charset=utf-8,<html/>");
|
||||
BrowserTestUtils.loadURI(browser, "data:text/html;charset=utf-8,<html/>");
|
||||
await loadPromise;
|
||||
is(listener.wasSynthetic, false, "Should not be synthetic");
|
||||
is(browser.isSyntheticDocument, false, "Should not be synthetic");
|
||||
|
||||
loadPromise = waitForPageShow(browser);
|
||||
browser.loadURI(FILES + "empty.png");
|
||||
BrowserTestUtils.loadURI(browser, FILES + "empty.png");
|
||||
await loadPromise;
|
||||
is(listener.wasSynthetic, true, "Should be synthetic");
|
||||
is(browser.isSyntheticDocument, true, "Should be synthetic");
|
||||
|
|
|
@ -62,7 +62,7 @@ add_task(async function() {
|
|||
var dataUri = 'data:text/html,<body style="height:10000px;"></body>';
|
||||
|
||||
let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
gBrowser.loadURI(dataUri);
|
||||
BrowserTestUtils.loadURI(gBrowser, dataUri);
|
||||
await loadedPromise;
|
||||
|
||||
await SimpleTest.promiseFocus(gBrowser.selectedBrowser);
|
||||
|
|
|
@ -10,7 +10,7 @@ function wait_for_event(browser, event) {
|
|||
}
|
||||
|
||||
async function test_on_browser(url, browser) {
|
||||
browser.loadURI(url);
|
||||
BrowserTestUtils.loadURI(browser, url);
|
||||
await wait_for_event(browser, "DOMAudioPlaybackStarted");
|
||||
await wait_for_event(browser, "DOMAudioPlaybackStopped");
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ function test_audio_in_browser() {
|
|||
}
|
||||
|
||||
async function test_on_browser(url, browser) {
|
||||
browser.loadURI(url);
|
||||
BrowserTestUtils.loadURI(browser, url);
|
||||
await wait_for_event(browser, "DOMAudioPlaybackStarted");
|
||||
|
||||
var result = await ContentTask.spawn(browser, null, test_audio_in_browser);
|
||||
|
@ -51,7 +51,7 @@ async function test_on_browser(url, browser) {
|
|||
}
|
||||
|
||||
async function test_visibility(url, browser) {
|
||||
browser.loadURI(url);
|
||||
BrowserTestUtils.loadURI(browser, url);
|
||||
await wait_for_event(browser, "DOMAudioPlaybackStarted");
|
||||
|
||||
var result = await ContentTask.spawn(browser, null, test_audio_in_browser);
|
||||
|
|
|
@ -41,7 +41,7 @@ function check_audio_pause_state(expectedPauseState) {
|
|||
|
||||
async function suspended_pause(url, browser) {
|
||||
info("### Start test for suspended-pause ###");
|
||||
browser.loadURI(url);
|
||||
BrowserTestUtils.loadURI(browser, url);
|
||||
|
||||
info("- page should have playing audio -");
|
||||
await wait_for_event(browser, "DOMAudioPlaybackStarted");
|
||||
|
@ -67,7 +67,7 @@ async function suspended_pause(url, browser) {
|
|||
|
||||
async function suspended_pause_disposable(url, browser) {
|
||||
info("### Start test for suspended-pause-disposable ###");
|
||||
browser.loadURI(url);
|
||||
BrowserTestUtils.loadURI(browser, url);
|
||||
|
||||
info("- page should have playing audio -");
|
||||
await wait_for_event(browser, "DOMAudioPlaybackStarted");
|
||||
|
@ -93,7 +93,7 @@ async function suspended_pause_disposable(url, browser) {
|
|||
|
||||
async function suspended_stop_disposable(url, browser) {
|
||||
info("### Start test for suspended-stop-disposable ###");
|
||||
browser.loadURI(url);
|
||||
BrowserTestUtils.loadURI(browser, url);
|
||||
|
||||
info("- page should have playing audio -");
|
||||
await wait_for_event(browser, "DOMAudioPlaybackStarted");
|
||||
|
|
|
@ -138,7 +138,7 @@ function no_audio_resumed() {
|
|||
|
||||
async function suspended_pause(url, browser) {
|
||||
info("### Start test for suspended-pause ###");
|
||||
browser.loadURI(url);
|
||||
BrowserTestUtils.loadURI(browser, url);
|
||||
|
||||
info("- page should have playing audio -");
|
||||
await wait_for_event(browser, "DOMAudioPlaybackStarted");
|
||||
|
@ -176,7 +176,7 @@ async function suspended_pause(url, browser) {
|
|||
|
||||
async function suspended_pause_disposable(url, browser) {
|
||||
info("### Start test for suspended-pause-disposable ###");
|
||||
browser.loadURI(url);
|
||||
BrowserTestUtils.loadURI(browser, url);
|
||||
|
||||
info("- page should have playing audio -");
|
||||
await wait_for_event(browser, "DOMAudioPlaybackStarted");
|
||||
|
@ -208,7 +208,7 @@ async function suspended_pause_disposable(url, browser) {
|
|||
|
||||
async function suspended_stop_disposable(url, browser) {
|
||||
info("### Start test for suspended-stop-disposable ###");
|
||||
browser.loadURI(url);
|
||||
BrowserTestUtils.loadURI(browser, url);
|
||||
|
||||
info("- page should have playing audio -");
|
||||
await wait_for_event(browser, "DOMAudioPlaybackStarted");
|
||||
|
|
|
@ -38,7 +38,7 @@ add_task(async function block_plug_in() {
|
|||
info("- open new tab -");
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
|
||||
"about:blank");
|
||||
tab.linkedBrowser.loadURI(PAGE);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
|
||||
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
|
||||
info("- tab should be audible -");
|
||||
|
|
|
@ -45,7 +45,7 @@ add_task(async function mute_web_audio() {
|
|||
info("- open new tab -");
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
|
||||
"about:blank");
|
||||
tab.linkedBrowser.loadURI(PAGE);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
|
||||
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
|
||||
info("- tab should be audible -");
|
||||
|
|
|
@ -107,7 +107,7 @@ add_task(async function resume_and_suspend_background_video_decoding() {
|
|||
|
||||
info("- before loading media, we shoudn't send the tab hover msg for tab -");
|
||||
await check_should_not_send_unselected_tab_hover_msg(browser);
|
||||
browser.loadURI(PAGE);
|
||||
BrowserTestUtils.loadURI(browser, PAGE);
|
||||
await BrowserTestUtils.browserLoaded(browser);
|
||||
|
||||
info("- should suspend background video decoding -");
|
||||
|
|
|
@ -17,7 +17,7 @@ MockFilePicker.init(window);
|
|||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
gBrowser.loadURI("http://mochi.test:8888/browser/toolkit/content/tests/browser/data/post_form_outer.sjs");
|
||||
BrowserTestUtils.loadURI(gBrowser, "http://mochi.test:8888/browser/toolkit/content/tests/browser/data/post_form_outer.sjs");
|
||||
|
||||
gBrowser.addEventListener("pageshow", function pageShown(event) {
|
||||
if (event.target.location == "about:blank")
|
||||
|
|
|
@ -33,7 +33,7 @@ add_task(async function should_not_show_sound_indicator_for_silent_video() {
|
|||
await waitForTabPlayingEvent(tab, false);
|
||||
|
||||
info("- loading autoplay silent video -");
|
||||
tab.linkedBrowser.loadURI(SILENT_PAGE);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, SILENT_PAGE);
|
||||
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
await ContentTask.spawn(tab.linkedBrowser, true /* playing */,
|
||||
check_audio_playing_state);
|
||||
|
@ -54,7 +54,7 @@ add_task(async function should_not_show_sound_indicator_for_almost_silent_video(
|
|||
await waitForTabPlayingEvent(tab, false);
|
||||
|
||||
info("- loading autoplay almost silent video -");
|
||||
tab.linkedBrowser.loadURI(ALMOST_SILENT_PAGE);
|
||||
BrowserTestUtils.loadURI(tab.linkedBrowser, ALMOST_SILENT_PAGE);
|
||||
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
await ContentTask.spawn(tab.linkedBrowser, true /* playing */,
|
||||
check_audio_playing_state);
|
||||
|
|
Загрузка…
Ссылка в новой задаче