Bug 1485305 - browser/ tests Ensure loadURI always passes a triggeringPrincipal() r=Mossop

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

--HG--
extra : source : 2cf17e4974823d09d0fdd1aef64e69e840b288a1
extra : intermediate-source : 4771e6948a78507aa95a56e5b324d87dc82e9009
This commit is contained in:
Jonathan Kingston 2018-08-29 15:44:56 +01:00
Родитель 82cf4833c8
Коммит 555f89c8d7
103 изменённых файлов: 174 добавлений и 158 удалений

Просмотреть файл

@ -10,7 +10,7 @@ add_task(async function() {
let extraTab = gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser); let extraTab = gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
let haveChanged = waitForFavicon(extraTab.linkedBrowser, TEST_ROOT + "file_bug970276_favicon1.ico"); let haveChanged = waitForFavicon(extraTab.linkedBrowser, TEST_ROOT + "file_bug970276_favicon1.ico");
extraTab.linkedBrowser.loadURI(TEST_URL); BrowserTestUtils.loadURI(extraTab.linkedBrowser, TEST_URL);
await BrowserTestUtils.browserLoaded(extraTab.linkedBrowser); await BrowserTestUtils.browserLoaded(extraTab.linkedBrowser);
await haveChanged; await haveChanged;

Просмотреть файл

@ -27,7 +27,7 @@ add_task(async function() {
let expectedFavicon = TEST_ROOT + "file_generic_favicon.ico"; let expectedFavicon = TEST_ROOT + "file_generic_favicon.ico";
let faviconPromise = waitForFavicon(extraTab.linkedBrowser, expectedFavicon); let faviconPromise = waitForFavicon(extraTab.linkedBrowser, expectedFavicon);
extraTab.linkedBrowser.loadURI(TEST_URL); BrowserTestUtils.loadURI(extraTab.linkedBrowser, TEST_URL);
await BrowserTestUtils.browserLoaded(extraTab.linkedBrowser); await BrowserTestUtils.browserLoaded(extraTab.linkedBrowser);
await faviconPromise; await faviconPromise;

Просмотреть файл

@ -97,8 +97,8 @@ function test() {
BrowserTestUtils.browserStopped(gBackgroundBrowser, kBasePage), BrowserTestUtils.browserStopped(gBackgroundBrowser, kBasePage),
BrowserTestUtils.browserStopped(gForegroundBrowser, kBasePage), BrowserTestUtils.browserStopped(gForegroundBrowser, kBasePage),
]; ];
gBackgroundBrowser.loadURI(kBasePage); BrowserTestUtils.loadURI(gBackgroundBrowser, kBasePage);
gForegroundBrowser.loadURI(kBasePage); BrowserTestUtils.loadURI(gForegroundBrowser, kBasePage);
Promise.all(promises).then(startTest1); Promise.all(promises).then(startTest1);
} }
@ -107,7 +107,7 @@ function runTest(browser, url, next) {
gAllNotificationsPos = 0; gAllNotificationsPos = 0;
gNextTest = next; gNextTest = next;
gTestBrowser = browser; gTestBrowser = browser;
browser.loadURI(url); BrowserTestUtils.loadURI(browser, url);
} }
function startTest1() { function startTest1() {

Просмотреть файл

@ -1,7 +1,7 @@
add_task(async function() { add_task(async function() {
let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, true); let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, true);
const htmlContent = "data:text/html, <iframe src='data:text/html,text text'></iframe>"; const htmlContent = "data:text/html, <iframe src='data:text/html,text text'></iframe>";
gBrowser.loadURI(htmlContent); BrowserTestUtils.loadURI(gBrowser, htmlContent);
await loadedPromise; await loadedPromise;
await ContentTask.spawn(gBrowser.selectedBrowser, { }, async function(arg) { await ContentTask.spawn(gBrowser.selectedBrowser, { }, async function(arg) {

Просмотреть файл

@ -6,7 +6,7 @@ add_task(async function() {
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser); gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
let promise = BrowserTestUtils.waitForErrorPage(gBrowser.selectedBrowser); let promise = BrowserTestUtils.waitForErrorPage(gBrowser.selectedBrowser);
gBrowser.loadURI("https://nocert.example.com/"); BrowserTestUtils.loadURI(gBrowser, "https://nocert.example.com/");
await promise; await promise;
await remote(() => { await remote(() => {

Просмотреть файл

@ -3,7 +3,7 @@ function test() {
gBrowser.addProgressListener(progressListener1); gBrowser.addProgressListener(progressListener1);
gBrowser.addProgressListener(progressListener2); gBrowser.addProgressListener(progressListener2);
gBrowser.addProgressListener(progressListener3); gBrowser.addProgressListener(progressListener3);
gBrowser.loadURI("data:text/plain,bug519216"); BrowserTestUtils.loadURI(gBrowser, "data:text/plain,bug519216");
} }
var calledListener1 = false; var calledListener1 = false;

Просмотреть файл

@ -15,7 +15,9 @@ add_task(async function() {
ok(true, "pageshow listener called: " + newwindow.gBrowser.currentURI.spec); ok(true, "pageshow listener called: " + newwindow.gBrowser.currentURI.spec);
resolve(); resolve();
}); });
selectedBrowser.loadURI("data:text/html,<h1 id='h1'>Select Me</h1>"); selectedBrowser.loadURI("data:text/html,<h1 id='h1'>Select Me</h1>", {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
}); });
await SimpleTest.promiseFocus(newwindow); await SimpleTest.promiseFocus(newwindow);

Просмотреть файл

@ -24,5 +24,5 @@ function test() {
gBrowser.removeTab(gBrowser.tabs[1]); // example.org tab gBrowser.removeTab(gBrowser.tabs[1]); // example.org tab
finish(); finish();
} }
newTab.linkedBrowser.loadURI("http://example.com"); BrowserTestUtils.loadURI(newTab.linkedBrowser, "http://example.com");
} }

Просмотреть файл

@ -24,7 +24,7 @@ add_task(async function test_remove_bookmark_with_tag_via_edit_bookmark() {
Assert.ok(await PlacesUtils.bookmarks.fetch({url: testURL}), "the test url is bookmarked"); Assert.ok(await PlacesUtils.bookmarks.fetch({url: testURL}), "the test url is bookmarked");
gBrowser.loadURI(testURL); BrowserTestUtils.loadURI(gBrowser, testURL);
await BrowserTestUtils.waitForCondition( await BrowserTestUtils.waitForCondition(
() => BookmarkingUI.status == BookmarkingUI.STATUS_STARRED, () => BookmarkingUI.status == BookmarkingUI.STATUS_STARRED,

Просмотреть файл

@ -30,5 +30,5 @@ function test() {
} }
}); });
tab.linkedBrowser.loadURI("http://example.com/browser/browser/base/content/test/general/dummy_page.html"); BrowserTestUtils.loadURI(tab.linkedBrowser, "http://example.com/browser/browser/base/content/test/general/dummy_page.html");
} }

Просмотреть файл

@ -91,7 +91,7 @@ add_task(async function() {
for (let test of tests) { for (let test of tests) {
let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
gBrowser.loadURI(test.url); BrowserTestUtils.loadURI(gBrowser, test.url);
await loadedPromise; await loadedPromise;
info("Run subtest " + test.name); info("Run subtest " + test.name);

Просмотреть файл

@ -82,7 +82,7 @@ async function expectFocusOnF6(backward, expectedDocument, expectedElement, onCo
// Load a page and navigate between it and the chrome window. // Load a page and navigate between it and the chrome window.
add_task(async function() { add_task(async function() {
let page1Promise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); let page1Promise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
gBrowser.selectedBrowser.loadURI(testPage1); BrowserTestUtils.loadURI(gBrowser.selectedBrowser, testPage1);
await page1Promise; await page1Promise;
// When the urlbar is focused, pressing F6 should focus the root of the content page. // When the urlbar is focused, pressing F6 should focus the root of the content page.

Просмотреть файл

@ -14,7 +14,7 @@ function makeTest(name, startURL, startProcessIsRemote, endURL, endProcessIsRemo
// Load the initial URL and make sure we are in the right initial process // Load the initial URL and make sure we are in the right initial process
info("Loading initial URL"); info("Loading initial URL");
browser.loadURI(startURL); BrowserTestUtils.loadURI(browser, startURL);
await BrowserTestUtils.browserLoaded(browser); await BrowserTestUtils.browserLoaded(browser);
is(browser.currentURI.spec, startURL, "Shouldn't have been redirected"); is(browser.currentURI.spec, startURL, "Shouldn't have been redirected");

Просмотреть файл

@ -48,6 +48,7 @@ var check_history = async function() {
for (let i = 0; i < count; i++) { for (let i = 0; i < count; i++) {
let entry = sessionHistory.entries[i]; let entry = sessionHistory.entries[i];
info("Checking History Entry:", entry.uri);
is(entry.uri, gExpectedHistory.entries[i].uri, "Should have the right URI"); is(entry.uri, gExpectedHistory.entries[i].uri, "Should have the right URI");
is(entry.title, gExpectedHistory.entries[i].title, "Should have the right title"); is(entry.title, gExpectedHistory.entries[i].title, "Should have the right title");
} }
@ -77,7 +78,10 @@ var waitForLoad = async function(uri) {
// Waits for a load and updates the known history // Waits for a load and updates the known history
var waitForLoadWithFlags = async function(uri, flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE) { var waitForLoadWithFlags = async function(uri, flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE) {
info("Loading " + uri + " flags = " + flags); info("Loading " + uri + " flags = " + flags);
gBrowser.selectedBrowser.loadURI(uri, { flags }); gBrowser.selectedBrowser.loadURI(uri, {
flags,
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
await BrowserTestUtils.browserStopped(gBrowser); await BrowserTestUtils.browserStopped(gBrowser);
if (!(flags & Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY)) { if (!(flags & Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY)) {

Просмотреть файл

@ -12,7 +12,7 @@ add_task(async function findbar_test() {
let promise = ContentTask.spawn(newTab.linkedBrowser, null, async function() { let promise = ContentTask.spawn(newTab.linkedBrowser, null, async function() {
await ContentTaskUtils.waitForEvent(this, "DOMContentLoaded", false); await ContentTaskUtils.waitForEvent(this, "DOMContentLoaded", false);
}); });
newTab.linkedBrowser.loadURI("http://example.com/browser/" + BrowserTestUtils.loadURI(newTab.linkedBrowser, "http://example.com/browser/" +
"browser/base/content/test/general/test_bug628179.html"); "browser/base/content/test/general/test_bug628179.html");
await promise; await promise;

Просмотреть файл

@ -91,7 +91,7 @@ async function testRealRefresh(refreshPage, delay) {
}, async function(browser) { }, async function(browser) {
await pushPrefs(["accessibility.blockautorefresh", true]); await pushPrefs(["accessibility.blockautorefresh", true]);
browser.loadURI(refreshPage + "?p=" + TARGET_PAGE + "&d=" + delay); BrowserTestUtils.loadURI(browser, refreshPage + "?p=" + TARGET_PAGE + "&d=" + delay);
await BrowserTestUtils.browserLoaded(browser); await BrowserTestUtils.browserLoaded(browser);
// Once browserLoaded resolves, all nsIWebProgressListener callbacks // Once browserLoaded resolves, all nsIWebProgressListener callbacks

Просмотреть файл

@ -62,7 +62,7 @@ add_task(async function navigate() {
isAppTab = await isBrowserAppTab(browser); isAppTab = await isBrowserAppTab(browser);
ok(isAppTab, "Docshell should think it is an app tab"); ok(isAppTab, "Docshell should think it is an app tab");
gBrowser.loadURI(DUMMY); BrowserTestUtils.loadURI(gBrowser, DUMMY);
await BrowserTestUtils.browserStopped(gBrowser); await BrowserTestUtils.browserStopped(gBrowser);
loadFrameScript(browser); loadFrameScript(browser);
isAppTab = await isBrowserAppTab(browser); isAppTab = await isBrowserAppTab(browser);
@ -76,7 +76,7 @@ add_task(async function navigate() {
isAppTab = await isBrowserAppTab(browser); isAppTab = await isBrowserAppTab(browser);
ok(isAppTab, "Docshell should think it is an app tab"); ok(isAppTab, "Docshell should think it is an app tab");
gBrowser.loadURI("about:robots"); BrowserTestUtils.loadURI(gBrowser, "about:robots");
await BrowserTestUtils.browserStopped(gBrowser); await BrowserTestUtils.browserStopped(gBrowser);
loadFrameScript(browser); loadFrameScript(browser);
isAppTab = await isBrowserAppTab(browser); isAppTab = await isBrowserAppTab(browser);

Просмотреть файл

@ -14,7 +14,7 @@ function triggerSave(aWindow, aCallback) {
let testBrowser = aWindow.gBrowser.selectedBrowser; let testBrowser = aWindow.gBrowser.selectedBrowser;
// This page sets a cookie if and only if a cookie does not exist yet // This page sets a cookie if and only if a cookie does not exist yet
let testURI = "http://mochi.test:8888/browser/browser/base/content/test/general/bug792517-2.html"; let testURI = "http://mochi.test:8888/browser/browser/base/content/test/general/bug792517-2.html";
testBrowser.loadURI(testURI); BrowserTestUtils.loadURI(testBrowser, testURI);
BrowserTestUtils.browserLoaded(testBrowser, false, testURI) BrowserTestUtils.browserLoaded(testBrowser, false, testURI)
.then(() => { .then(() => {
waitForFocus(function() { waitForFocus(function() {

Просмотреть файл

@ -29,7 +29,7 @@ function triggerSave(aWindow, aCallback) {
let testBrowser = aWindow.gBrowser.selectedBrowser; let testBrowser = aWindow.gBrowser.selectedBrowser;
let testURI = "http://mochi.test:8888/browser/browser/base/content/test/general/navigating_window_with_download.html"; let testURI = "http://mochi.test:8888/browser/browser/base/content/test/general/navigating_window_with_download.html";
windowObserver.setCallback(onUCTDialog); windowObserver.setCallback(onUCTDialog);
testBrowser.loadURI(testURI); BrowserTestUtils.loadURI(testBrowser, testURI);
// Create the folder the link will be saved into. // Create the folder the link will be saved into.
var destDir = createTemporarySaveDirectory(); var destDir = createTemporarySaveDirectory();

Просмотреть файл

@ -12,7 +12,7 @@ add_task(async function() {
var fileName; var fileName;
let loadPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); let loadPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
gBrowser.loadURI("http://mochi.test:8888/browser/browser/base/content/test/general/web_video.html"); BrowserTestUtils.loadURI(gBrowser, "http://mochi.test:8888/browser/browser/base/content/test/general/web_video.html");
await loadPromise; await loadPromise;
let popupShownPromise = BrowserTestUtils.waitForEvent(document, "popupshown"); let popupShownPromise = BrowserTestUtils.waitForEvent(document, "popupshown");

Просмотреть файл

@ -64,7 +64,7 @@ async function testSendReportAutomatically(testURL, suffix, errorURISuffix) {
// Load the page and wait for the error report submission. // Load the page and wait for the error report submission.
let promiseStatus = createReportResponseStatusPromise(URL_REPORTS + suffix); let promiseStatus = createReportResponseStatusPromise(URL_REPORTS + suffix);
browser.loadURI(testURL); BrowserTestUtils.loadURI(browser, testURL);
await BrowserTestUtils.waitForErrorPage(browser); await BrowserTestUtils.waitForErrorPage(browser);
ok(!isErrorStatus(await promiseStatus), ok(!isErrorStatus(await promiseStatus),
@ -88,7 +88,7 @@ async function testSetAutomatic(testURL, suffix, errorURISuffix) {
let browser = tab.linkedBrowser; let browser = tab.linkedBrowser;
// Load the page. // Load the page.
browser.loadURI(testURL); BrowserTestUtils.loadURI(browser, testURL);
await BrowserTestUtils.waitForErrorPage(browser); await BrowserTestUtils.waitForErrorPage(browser);
// Check that we loaded the right error page. // Check that we loaded the right error page.
@ -129,7 +129,7 @@ async function testSendReportDisabled(testURL, errorURISuffix) {
let browser = tab.linkedBrowser; let browser = tab.linkedBrowser;
// Load the page. // Load the page.
browser.loadURI(testURL); BrowserTestUtils.loadURI(browser, testURL);
await BrowserTestUtils.waitForErrorPage(browser); await BrowserTestUtils.waitForErrorPage(browser);
// Check that we loaded the right error page. // Check that we loaded the right error page.

Просмотреть файл

@ -68,6 +68,6 @@ function promiseTabLoadEvent(aTab, aURL, aFinalURL) {
aFinalURL = aURL; aFinalURL = aURL;
info("Wait for load tab event"); info("Wait for load tab event");
aTab.linkedBrowser.loadURI(aURL); BrowserTestUtils.loadURI(aTab.linkedBrowser, aURL);
return BrowserTestUtils.browserLoaded(aTab.linkedBrowser, false, aFinalURL); return BrowserTestUtils.browserLoaded(aTab.linkedBrowser, false, aFinalURL);
} }

Просмотреть файл

@ -10,7 +10,7 @@ add_task(async function() {
SessionStore.forgetClosedWindow(0); SessionStore.forgetClosedWindow(0);
let tab = BrowserTestUtils.addTab(gBrowser); let tab = BrowserTestUtils.addTab(gBrowser);
tab.linkedBrowser.loadURI(uri); BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser); await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
await TabStateFlusher.flush(tab.linkedBrowser); await TabStateFlusher.flush(tab.linkedBrowser);

Просмотреть файл

@ -27,7 +27,7 @@ var clickTest = async function(tab) {
}; };
function loadURI(tab, url) { function loadURI(tab, url) {
tab.linkedBrowser.loadURI(url); BrowserTestUtils.loadURI(tab.linkedBrowser, url);
return BrowserTestUtils.browserLoaded(tab.linkedBrowser); return BrowserTestUtils.browserLoaded(tab.linkedBrowser);
} }

Просмотреть файл

@ -25,7 +25,7 @@ function frame_script() {
* Promise that resolves when the browser is no longer remote. * Promise that resolves when the browser is no longer remote.
*/ */
function prepareNonRemoteBrowser(aWindow, browser) { function prepareNonRemoteBrowser(aWindow, browser) {
browser.loadURI(NON_REMOTE_PAGE); BrowserTestUtils.loadURI(browser, NON_REMOTE_PAGE);
return BrowserTestUtils.browserLoaded(browser); return BrowserTestUtils.browserLoaded(browser);
} }

Просмотреть файл

@ -5,7 +5,7 @@
add_task(async function() { add_task(async function() {
let testWindow = await BrowserTestUtils.openNewBrowserWindow(); let testWindow = await BrowserTestUtils.openNewBrowserWindow();
testWindow.gBrowser.loadURI("data:text/html,<h1>A Page</h1>"); BrowserTestUtils.loadURI(testWindow.gBrowser, "data:text/html,<h1>A Page</h1>");
await BrowserTestUtils.browserLoaded(testWindow.gBrowser.selectedBrowser); await BrowserTestUtils.browserLoaded(testWindow.gBrowser.selectedBrowser);
await SimpleTest.promiseFocus(testWindow.gBrowser.selectedBrowser); await SimpleTest.promiseFocus(testWindow.gBrowser.selectedBrowser);

Просмотреть файл

@ -21,7 +21,7 @@ add_task(async function() {
is(gBrowser.contentTitle, "Test Page", "Should have the right title."); is(gBrowser.contentTitle, "Test Page", "Should have the right title.");
browser.loadURI(unknown_url); BrowserTestUtils.loadURI(browser, unknown_url);
let win = await waitForNewWindow(); let win = await waitForNewWindow();
is(win.location, "chrome://mozapps/content/downloads/unknownContentType.xul", is(win.location, "chrome://mozapps/content/downloads/unknownContentType.xul",
"Should have seen the unknown content dialog."); "Should have seen the unknown content dialog.");

Просмотреть файл

@ -303,7 +303,7 @@ var FullZoomHelper = {
resolve(); resolve();
}); });
tab.linkedBrowser.loadURI(url); BrowserTestUtils.loadURI(tab.linkedBrowser, url);
}); });
}, },

Просмотреть файл

@ -74,7 +74,7 @@ async function test() {
let url = "https://example.com/browser/browser/base/content/test/pageinfo/image.html"; let url = "https://example.com/browser/browser/base/content/test/pageinfo/image.html";
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser); gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
let loadPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, url); let loadPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, url);
gBrowser.selectedBrowser.loadURI(url); BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
await loadPromise; await loadPromise;
// Pass a dummy imageElement, if there isn't an imageElement, pageInfo.js // Pass a dummy imageElement, if there isn't an imageElement, pageInfo.js

Просмотреть файл

@ -46,5 +46,5 @@ function test() {
}, {capture: true, once: true}); }, {capture: true, once: true});
}); });
gBrowser.loadURI(URI); BrowserTestUtils.loadURI(gBrowser, URI);
} }

Просмотреть файл

@ -28,7 +28,7 @@ function test() {
}, {capture: true, once: true}); }, {capture: true, once: true});
}); });
gBrowser.selectedBrowser.loadURI( BrowserTestUtils.loadURI(gBrowser.selectedBrowser,
"data:text/html," + "data:text/html," +
"<html>" + "<html>" +
" <head>" + " <head>" +

Просмотреть файл

@ -35,5 +35,5 @@ function test() {
}, {capture: true, once: true}); }, {capture: true, once: true});
}); });
gBrowser.selectedBrowser.loadURI(URI); BrowserTestUtils.loadURI(gBrowser.selectedBrowser, URI);
} }

Просмотреть файл

@ -136,7 +136,7 @@ add_task(async function testChromeHearsPluginCrashFirst() {
let win = await BrowserTestUtils.openNewBrowserWindow({remote: true}); let win = await BrowserTestUtils.openNewBrowserWindow({remote: true});
let browser = win.gBrowser.selectedBrowser; let browser = win.gBrowser.selectedBrowser;
browser.loadURI(CRASH_URL); BrowserTestUtils.loadURI(browser, CRASH_URL);
await BrowserTestUtils.browserLoaded(browser); await BrowserTestUtils.browserLoaded(browser);
// In this case, we want the <object> to match the -moz-handler-crashed // In this case, we want the <object> to match the -moz-handler-crashed
@ -205,7 +205,7 @@ add_task(async function testContentHearsCrashFirst() {
let win = await BrowserTestUtils.openNewBrowserWindow({remote: true}); let win = await BrowserTestUtils.openNewBrowserWindow({remote: true});
let browser = win.gBrowser.selectedBrowser; let browser = win.gBrowser.selectedBrowser;
browser.loadURI(CRASH_URL); BrowserTestUtils.loadURI(browser, CRASH_URL);
await BrowserTestUtils.browserLoaded(browser); await BrowserTestUtils.browserLoaded(browser);
// In this case, we want the <object> to match the -moz-handler-crashed // In this case, we want the <object> to match the -moz-handler-crashed

Просмотреть файл

@ -36,7 +36,7 @@ function promiseTabLoadEvent(tab, url) {
let browser = tab.linkedBrowser; let browser = tab.linkedBrowser;
if (url) { if (url) {
browser.loadURI(url); BrowserTestUtils.loadURI(browser, url);
} }
return BrowserTestUtils.browserLoaded(browser, false, url); return BrowserTestUtils.browserLoaded(browser, false, url);

Просмотреть файл

@ -275,7 +275,7 @@ async function noCertErrorTest(secureCheck) {
gBrowser.selectedTab = newTab; gBrowser.selectedTab = newTab;
let promise = BrowserTestUtils.waitForErrorPage(gBrowser.selectedBrowser); let promise = BrowserTestUtils.waitForErrorPage(gBrowser.selectedBrowser);
gBrowser.loadURI("https://nocert.example.com/"); BrowserTestUtils.loadURI(gBrowser, "https://nocert.example.com/");
await promise; await promise;
is(getIdentityMode(), "unknownIdentity", "Identity should be unknown"); is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
is(getConnectionState(), "not-secure", "Connection should be file"); is(getConnectionState(), "not-secure", "Connection should be file");

Просмотреть файл

@ -40,7 +40,7 @@ function runTests() {
// Starting the test // Starting the test
var url = PRE_PATH + "file_csp_block_all_mixedcontent.html"; var url = PRE_PATH + "file_csp_block_all_mixedcontent.html";
BrowserTestUtils.browserLoaded(gTestBrowser, false, url).then(verifyUInotDegraded); BrowserTestUtils.browserLoaded(gTestBrowser, false, url).then(verifyUInotDegraded);
gTestBrowser.loadURI(url); BrowserTestUtils.loadURI(gTestBrowser, url);
} }
// ------------------------------------------------------ // ------------------------------------------------------

Просмотреть файл

@ -77,7 +77,7 @@ const PROBE_TESTS = [
category: "back", category: "back",
async prepare(browser) { async prepare(browser) {
browser.loadURI(PAGE_2); BrowserTestUtils.loadURI(browser, PAGE_2);
await BrowserTestUtils.browserLoaded(browser); await BrowserTestUtils.browserLoaded(browser);
}, },
@ -96,7 +96,7 @@ const PROBE_TESTS = [
category: "forward", category: "forward",
async prepare(browser) { async prepare(browser) {
browser.loadURI(PAGE_2); BrowserTestUtils.loadURI(browser, PAGE_2);
await BrowserTestUtils.browserLoaded(browser); await BrowserTestUtils.browserLoaded(browser);
let pageShow = let pageShow =
BrowserTestUtils.waitForContentEvent(browser, "pageshow"); BrowserTestUtils.waitForContentEvent(browser, "pageshow");
@ -119,9 +119,9 @@ const PROBE_TESTS = [
category: "historyNavigation", category: "historyNavigation",
async prepare(browser) { async prepare(browser) {
browser.loadURI(PAGE_2); BrowserTestUtils.loadURI(browser, PAGE_2);
await BrowserTestUtils.browserLoaded(browser); await BrowserTestUtils.browserLoaded(browser);
browser.loadURI("http://example.com"); BrowserTestUtils.loadURI(browser, "http://example.com");
await BrowserTestUtils.browserLoaded(browser); await BrowserTestUtils.browserLoaded(browser);
await TabStateFlusher.flush(browser); await TabStateFlusher.flush(browser);
}, },
@ -141,9 +141,9 @@ const PROBE_TESTS = [
category: "historyNavigation", category: "historyNavigation",
async prepare(browser) { async prepare(browser) {
browser.loadURI(PAGE_2); BrowserTestUtils.loadURI(browser, PAGE_2);
await BrowserTestUtils.browserLoaded(browser); await BrowserTestUtils.browserLoaded(browser);
browser.loadURI("http://example.com"); BrowserTestUtils.loadURI(browser, "http://example.com");
await BrowserTestUtils.browserLoaded(browser); await BrowserTestUtils.browserLoaded(browser);
let pageShow = let pageShow =
BrowserTestUtils.waitForContentEvent(browser, "pageshow"); BrowserTestUtils.waitForContentEvent(browser, "pageshow");

Просмотреть файл

@ -26,7 +26,7 @@ add_task(async function() {
let viewSourceBrowser = viewSourceTab.linkedBrowser; let viewSourceBrowser = viewSourceTab.linkedBrowser;
let promiseLoad = let promiseLoad =
BrowserTestUtils.browserLoaded(viewSourceBrowser, false, uriString); BrowserTestUtils.browserLoaded(viewSourceBrowser, false, uriString);
viewSourceBrowser.loadURI(uriString); BrowserTestUtils.loadURI(viewSourceBrowser, uriString);
let href = await promiseLoad; let href = await promiseLoad;
is(href, uriString, is(href, uriString,
"Check file:// URI loads in a browser that was previously for view-source"); "Check file:// URI loads in a browser that was previously for view-source");

Просмотреть файл

@ -369,7 +369,7 @@ async function test_cross_process_load() {
); );
// Go to a different process. // Go to a different process.
browser.loadURI("about:mozilla"); BrowserTestUtils.loadURI(browser, "about:mozilla");
await BrowserTestUtils.browserLoaded(browser); await BrowserTestUtils.browserLoaded(browser);
await soundPlayingStoppedPromise; await soundPlayingStoppedPromise;

Просмотреть файл

@ -17,7 +17,7 @@ add_task(async function test_contextmenu_openlink_after_tabnavigated() {
info("Popup Shown"); info("Popup Shown");
info("Navigate the tab with the opened context menu"); info("Navigate the tab with the opened context menu");
gBrowser.selectedBrowser.loadURI("about:blank"); BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:blank");
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
let awaitNewTabOpen = BrowserTestUtils.waitForNewTab(gBrowser, "http://example.com/"); let awaitNewTabOpen = BrowserTestUtils.waitForNewTab(gBrowser, "http://example.com/");

Просмотреть файл

@ -62,7 +62,7 @@ add_task(async function() {
// Check that same-origin load doesn't break the affinity. // Check that same-origin load doesn't break the affinity.
promiseLoad = BrowserTestUtils.browserLoaded(httpBrowser, false, TEST_HTTP + "foo"); promiseLoad = BrowserTestUtils.browserLoaded(httpBrowser, false, TEST_HTTP + "foo");
httpBrowser.loadURI(TEST_HTTP + "foo"); BrowserTestUtils.loadURI(httpBrowser, TEST_HTTP + "foo");
await promiseLoad; await promiseLoad;
await CheckBrowserInPid(httpBrowser, filePid, await CheckBrowserInPid(httpBrowser, filePid,
"Check that http tab still in file content process after same origin load."); "Check that http tab still in file content process after same origin load.");
@ -93,7 +93,7 @@ add_task(async function() {
// Check that file:// URI load doesn't break the affinity. // Check that file:// URI load doesn't break the affinity.
promiseLoad = BrowserTestUtils.browserLoaded(httpBrowser, false, uriString); promiseLoad = BrowserTestUtils.browserLoaded(httpBrowser, false, uriString);
httpBrowser.loadURI(uriString); BrowserTestUtils.loadURI(httpBrowser, uriString);
await promiseLoad; await promiseLoad;
await CheckBrowserInPid(httpBrowser, filePid, await CheckBrowserInPid(httpBrowser, filePid,
"Check that http tab still in file content process after file:// load."); "Check that http tab still in file content process after file:// load.");
@ -109,7 +109,7 @@ add_task(async function() {
// Check that cross-origin load does break the affinity. // Check that cross-origin load does break the affinity.
promiseLoad = BrowserTestUtils.browserLoaded(httpBrowser, false, TEST_CROSS_ORIGIN); promiseLoad = BrowserTestUtils.browserLoaded(httpBrowser, false, TEST_CROSS_ORIGIN);
httpBrowser.loadURI(TEST_CROSS_ORIGIN); BrowserTestUtils.loadURI(httpBrowser, TEST_CROSS_ORIGIN);
await promiseLoad; await promiseLoad;
await CheckBrowserNotInPid(httpBrowser, filePid, await CheckBrowserNotInPid(httpBrowser, filePid,
"Check that http tab not in file content process after cross origin load."); "Check that http tab not in file content process after cross origin load.");

Просмотреть файл

@ -36,7 +36,7 @@ add_task(async function() {
let openedBrowser = openedTab.linkedBrowser; let openedBrowser = openedTab.linkedBrowser;
// Ensure that new file:// tab can be navigated to web content. // Ensure that new file:// tab can be navigated to web content.
openedBrowser.loadURI(WEB_ADDRESS); BrowserTestUtils.loadURI(openedBrowser, "http://example.org/");
let href = await BrowserTestUtils.browserLoaded(openedBrowser, false, WEB_ADDRESS); let href = await BrowserTestUtils.browserLoaded(openedBrowser, false, WEB_ADDRESS);
is(href, WEB_ADDRESS, is(href, WEB_ADDRESS,
"Check that new file:// page has navigated successfully to web content"); "Check that new file:// page has navigated successfully to web content");

Просмотреть файл

@ -20,7 +20,7 @@ add_task(async function() {
// Navigate to data URI. // Navigate to data URI.
let promiseLoad = BrowserTestUtils.browserLoaded(fileBrowser, false, let promiseLoad = BrowserTestUtils.browserLoaded(fileBrowser, false,
DATA_URI); DATA_URI);
fileBrowser.loadURI(DATA_URI); BrowserTestUtils.loadURI(fileBrowser, DATA_URI);
let href = await promiseLoad; let href = await promiseLoad;
is(href, DATA_URI, "Check data URI loaded."); is(href, DATA_URI, "Check data URI loaded.");
let dataPid = await ContentTask.spawn(fileBrowser, null, () => { let dataPid = await ContentTask.spawn(fileBrowser, null, () => {

Просмотреть файл

@ -55,7 +55,7 @@ var tests = [
loadTabInWindow(window, function(tab) { loadTabInWindow(window, function(tab) {
// Load a new URL and then immediately stop it, to simulate a page load // Load a new URL and then immediately stop it, to simulate a page load
// error. // error.
tab.linkedBrowser.loadURI("http://test1.example.com"); BrowserTestUtils.loadURI(tab.linkedBrowser, "http://test1.example.com");
tab.linkedBrowser.stop(); tab.linkedBrowser.stop();
is(gURLBar.textValue, "example.com", "URL bar had user/pass stripped after load error"); is(gURLBar.textValue, "example.com", "URL bar had user/pass stripped after load error");
gBrowser.removeTab(tab); gBrowser.removeTab(tab);

Просмотреть файл

@ -14,9 +14,9 @@ add_task(async function() {
let loaded1 = BrowserTestUtils.browserLoaded(deletedURLTab.linkedBrowser, false, testURL); let loaded1 = BrowserTestUtils.browserLoaded(deletedURLTab.linkedBrowser, false, testURL);
let loaded2 = BrowserTestUtils.browserLoaded(fullURLTab.linkedBrowser, false, testURL); let loaded2 = BrowserTestUtils.browserLoaded(fullURLTab.linkedBrowser, false, testURL);
let loaded3 = BrowserTestUtils.browserLoaded(partialURLTab.linkedBrowser, false, testURL); let loaded3 = BrowserTestUtils.browserLoaded(partialURLTab.linkedBrowser, false, testURL);
deletedURLTab.linkedBrowser.loadURI(testURL); BrowserTestUtils.loadURI(deletedURLTab.linkedBrowser, testURL);
fullURLTab.linkedBrowser.loadURI(testURL); BrowserTestUtils.loadURI(fullURLTab.linkedBrowser, testURL);
partialURLTab.linkedBrowser.loadURI(testURL); BrowserTestUtils.loadURI(partialURLTab.linkedBrowser, testURL);
await Promise.all([loaded1, loaded2, loaded3]); await Promise.all([loaded1, loaded2, loaded3]);
testURL = gURLBar.trimValue(testURL); testURL = gURLBar.trimValue(testURL);

Просмотреть файл

@ -109,7 +109,7 @@ function delayed(aIsSelectedTab) {
if (!aIsSelectedTab) { if (!aIsSelectedTab) {
// If this was a background request, go on a foreground request. // If this was a background request, go on a foreground request.
gBrowser.selectedBrowser.loadURI(REDIRECT_FROM + "#FG"); BrowserTestUtils.loadURI(gBrowser.selectedBrowser, REDIRECT_FROM + "#FG");
} else { } else {
// Othrewise, nothing to do remains. // Othrewise, nothing to do remains.
finish(); finish();

Просмотреть файл

@ -59,7 +59,7 @@ add_task(async function step_3() {
add_task(async function step_4() { add_task(async function step_4() {
info("Running step 4 - ensure we don't register subframes as open pages"); info("Running step 4 - ensure we don't register subframes as open pages");
let tab = BrowserTestUtils.addTab(gBrowser); let tab = BrowserTestUtils.addTab(gBrowser);
tab.linkedBrowser.loadURI('data:text/html,<body><iframe src=""></iframe></body>'); BrowserTestUtils.loadURI(tab.linkedBrowser, 'data:text/html,<body><iframe src=""></iframe></body>');
await BrowserTestUtils.browserLoaded(tab.linkedBrowser); await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
await ContentTask.spawn(tab.linkedBrowser, null, async function() { await ContentTask.spawn(tab.linkedBrowser, null, async function() {
@ -82,7 +82,7 @@ add_task(async function step_6() {
info("Running step 6 - check swapBrowsersAndCloseOther preserves registered switch-to-tab result"); info("Running step 6 - check swapBrowsersAndCloseOther preserves registered switch-to-tab result");
let tabToKeep = BrowserTestUtils.addTab(gBrowser); let tabToKeep = BrowserTestUtils.addTab(gBrowser);
let tab = BrowserTestUtils.addTab(gBrowser); let tab = BrowserTestUtils.addTab(gBrowser);
tab.linkedBrowser.loadURI("about:mozilla"); BrowserTestUtils.loadURI(tab.linkedBrowser, "about:mozilla");
await BrowserTestUtils.browserLoaded(tab.linkedBrowser); await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
gBrowser.updateBrowserRemoteness(tabToKeep.linkedBrowser, tab.linkedBrowser.isRemoteBrowser); gBrowser.updateBrowserRemoteness(tabToKeep.linkedBrowser, tab.linkedBrowser.isRemoteBrowser);
@ -132,7 +132,7 @@ function loadTab(tab, url) {
}); });
info("Loading page: " + url); info("Loading page: " + url);
tab.linkedBrowser.loadURI(url); BrowserTestUtils.loadURI(tab.linkedBrowser, url);
return Promise.all([ loaded, visited ]); return Promise.all([ loaded, visited ]);
} }

Просмотреть файл

@ -33,7 +33,7 @@ add_task(async function clearURLBarAfterParentProcessURLInExistingTab() {
newTabBrowser.addEventListener("Initialized", async function() { newTabBrowser.addEventListener("Initialized", async function() {
resolve(gBrowser.selectedTab); resolve(gBrowser.selectedTab);
}, {capture: true, once: true}); }, {capture: true, once: true});
newTabBrowser.loadURI("about:preferences"); BrowserTestUtils.loadURI(newTabBrowser, "about:preferences");
}); });
document.getElementById("home-button").click(); document.getElementById("home-button").click();
await BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, HomePage.get()); await BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, HomePage.get());

Просмотреть файл

@ -69,7 +69,7 @@ add_task(async function() {
let promiseLoaded = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, let promiseLoaded = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser,
false, "http://example.com/"); false, "http://example.com/");
gBrowser.loadURI("http://example.com/"); BrowserTestUtils.loadURI(gBrowser, "http://example.com/");
await promiseLoaded; await promiseLoaded;
await testCopy("example.com", "http://example.com/"); await testCopy("example.com", "http://example.com/");

Просмотреть файл

@ -100,12 +100,12 @@ add_task(async function() {
// Navigate away from the starting page to force about:addons to load // Navigate away from the starting page to force about:addons to load
// in a new tab during the tests below. // in a new tab during the tests below.
gBrowser.selectedBrowser.loadURI("about:robots"); BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:robots");
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
registerCleanupFunction(async function() { registerCleanupFunction(async function() {
// Return to about:blank when we're done // Return to about:blank when we're done
gBrowser.selectedBrowser.loadURI("about:blank"); BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:blank");
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
}); });

Просмотреть файл

@ -41,12 +41,12 @@ add_task(async function setup() {
// Navigate away from the initial page so that about:addons always // Navigate away from the initial page so that about:addons always
// opens in a new tab during tests // opens in a new tab during tests
gBrowser.selectedBrowser.loadURI("about:robots"); BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:robots");
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
registerCleanupFunction(async function() { registerCleanupFunction(async function() {
// Return to about:blank when we're done // Return to about:blank when we're done
gBrowser.selectedBrowser.loadURI("about:blank"); BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:blank");
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
}); });
}); });

Просмотреть файл

@ -21,12 +21,12 @@ add_task(async function setup() {
// Navigate away from the initial page so that about:addons always // Navigate away from the initial page so that about:addons always
// opens in a new tab during tests // opens in a new tab during tests
gBrowser.selectedBrowser.loadURI("about:robots"); BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:robots");
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
registerCleanupFunction(async function() { registerCleanupFunction(async function() {
// Return to about:blank when we're done // Return to about:blank when we're done
gBrowser.selectedBrowser.loadURI("about:blank"); BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:blank");
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
}); });
}); });

Просмотреть файл

@ -3,7 +3,7 @@
const INSTALL_PAGE = `${BASE}/file_install_extensions.html`; const INSTALL_PAGE = `${BASE}/file_install_extensions.html`;
async function installTrigger(filename) { async function installTrigger(filename) {
gBrowser.selectedBrowser.loadURI(INSTALL_PAGE); BrowserTestUtils.loadURI(gBrowser.selectedBrowser, INSTALL_PAGE);
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
ContentTask.spawn(gBrowser.selectedBrowser, `${BASE}/${filename}`, async function(url) { ContentTask.spawn(gBrowser.selectedBrowser, `${BASE}/${filename}`, async function(url) {

Просмотреть файл

@ -3,7 +3,7 @@
const INSTALL_PAGE = `${BASE}/file_install_extensions.html`; const INSTALL_PAGE = `${BASE}/file_install_extensions.html`;
async function installMozAM(filename) { async function installMozAM(filename) {
gBrowser.selectedBrowser.loadURI(INSTALL_PAGE); BrowserTestUtils.loadURI(gBrowser.selectedBrowser, INSTALL_PAGE);
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
await ContentTask.spawn(gBrowser.selectedBrowser, `${BASE}/${filename}`, async function(url) { await ContentTask.spawn(gBrowser.selectedBrowser, `${BASE}/${filename}`, async function(url) {

Просмотреть файл

@ -15,7 +15,7 @@ add_task(async function test_unsigned() {
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser); let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
gBrowser.selectedBrowser.loadURI(`${BASE}/file_install_extensions.html`); BrowserTestUtils.loadURI(gBrowser.selectedBrowser, `${BASE}/file_install_extensions.html`);
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
ContentTask.spawn(gBrowser.selectedBrowser, `${BASE}/browser_webext_unsigned.xpi`, async function(url) { ContentTask.spawn(gBrowser.selectedBrowser, `${BASE}/browser_webext_unsigned.xpi`, async function(url) {

Просмотреть файл

@ -19,7 +19,7 @@ add_task(async function setup() {
async function testUpdateNoPrompt(filename, id, async function testUpdateNoPrompt(filename, id,
initialVersion = "1.0", updateVersion = "2.0") { initialVersion = "1.0", updateVersion = "2.0") {
// Navigate away to ensure that BrowserOpenAddonMgr() opens a new tab // Navigate away to ensure that BrowserOpenAddonMgr() opens a new tab
gBrowser.selectedBrowser.loadURI("about:robots"); BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:robots");
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
// Install initial version of the test extension // Install initial version of the test extension

Просмотреть файл

@ -401,7 +401,7 @@ async function interactiveUpdateTest(autoUpdate, checkFn) {
// Navigate away from the starting page to force about:addons to load // Navigate away from the starting page to force about:addons to load
// in a new tab during the tests below. // in a new tab during the tests below.
gBrowser.selectedBrowser.loadURI("about:robots"); BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:robots");
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
// Install version 1.0 of the test extension // Install version 1.0 of the test extension

Просмотреть файл

@ -531,7 +531,7 @@ var gTests = [
run: async function checkNoAlwaysOnHttp() { run: async function checkNoAlwaysOnHttp() {
// Load an http page instead of the https version. // Load an http page instead of the https version.
let browser = gBrowser.selectedBrowser; let browser = gBrowser.selectedBrowser;
browser.loadURI(browser.documentURI.spec.replace("https://", "http://")); BrowserTestUtils.loadURI(browser, browser.documentURI.spec.replace("https://", "http://"));
await BrowserTestUtils.browserLoaded(browser); await BrowserTestUtils.browserLoaded(browser);
// Initially set both permissions to 'allow'. // Initially set both permissions to 'allow'.

Просмотреть файл

@ -21,7 +21,7 @@ add_task(async function test_exit_background_customize_mode() {
await BrowserTestUtils.switchTab(gBrowser, nonCustomizingTab); await BrowserTestUtils.switchTab(gBrowser, nonCustomizingTab);
await finishedCustomizing; await finishedCustomizing;
custTab.linkedBrowser.loadURI("http://example.com"); BrowserTestUtils.loadURI(custTab.linkedBrowser, "http://example.com");
await BrowserTestUtils.browserLoaded(custTab.linkedBrowser); await BrowserTestUtils.browserLoaded(custTab.linkedBrowser);
Assert.equal(gBrowser.tabContainer.querySelector("tab[customizemode=true]"), Assert.equal(gBrowser.tabContainer.querySelector("tab[customizemode=true]"),

Просмотреть файл

@ -7,7 +7,7 @@ add_task(async function() {
let notificationValue = "Protocol Registration: web+testprotocol"; let notificationValue = "Protocol Registration: web+testprotocol";
let testURI = TEST_PATH + "browser_registerProtocolHandler_notification.html"; let testURI = TEST_PATH + "browser_registerProtocolHandler_notification.html";
window.gBrowser.selectedBrowser.loadURI(testURI); BrowserTestUtils.loadURI(window.gBrowser.selectedBrowser, testURI);
await TestUtils.waitForCondition(function() { await TestUtils.waitForCondition(function() {
// Do not start until the notification is up // Do not start until the notification is up
let notificationBox = window.gBrowser.getNotificationBox(); let notificationBox = window.gBrowser.getNotificationBox();

Просмотреть файл

@ -106,7 +106,7 @@ add_task(async function test_remote_window_open_data_uri2() {
// The iframe test2.html will fetch test2.js, which will have cookies. // The iframe test2.html will fetch test2.js, which will have cookies.
const DATA_URI = `data:text/html, const DATA_URI = `data:text/html,
<iframe id="iframe1" src="http://mochi.test:8888/browser/browser/components/originattributes/test/browser/test2.html"></iframe>`; <iframe id="iframe1" src="http://mochi.test:8888/browser/browser/components/originattributes/test/browser/test2.html"></iframe>`;
browser.loadURI(DATA_URI); BrowserTestUtils.loadURI(browser, DATA_URI);
await BrowserTestUtils.browserLoaded(browser, true); await BrowserTestUtils.browserLoaded(browser, true);
await ContentTask.spawn(browser, {}, async function() { await ContentTask.spawn(browser, {}, async function() {

Просмотреть файл

@ -22,7 +22,7 @@ add_task(async function test_blob_uri_inherit_oa_from_content() {
// First we load a normal web page. // First we load a normal web page.
let win = await BrowserTestUtils.openNewBrowserWindow({ remote: true }); let win = await BrowserTestUtils.openNewBrowserWindow({ remote: true });
let browser = win.gBrowser.selectedBrowser; let browser = win.gBrowser.selectedBrowser;
browser.loadURI(BASE_URI); BrowserTestUtils.loadURI(browser, BASE_URI);
await BrowserTestUtils.browserLoaded(browser); await BrowserTestUtils.browserLoaded(browser);
// Then navigate to the blob: URI. // Then navigate to the blob: URI.

Просмотреть файл

@ -12,7 +12,7 @@ add_task(async function test_remote_window_open_js_uri() {
Assert.ok(browser.isRemoteBrowser, "should be a remote browser"); Assert.ok(browser.isRemoteBrowser, "should be a remote browser");
browser.loadURI(`javascript:1;`); BrowserTestUtils.loadURI(browser, `javascript:1;`);
await ContentTask.spawn(browser, {}, async function() { await ContentTask.spawn(browser, {}, async function() {
info("origin " + content.document.nodePrincipal.origin); info("origin " + content.document.nodePrincipal.origin);
@ -35,7 +35,7 @@ add_task(async function test_remote_window_open_js_uri2() {
Assert.ok(browser.isRemoteBrowser, "should be a remote browser"); Assert.ok(browser.isRemoteBrowser, "should be a remote browser");
browser.loadURI(`javascript: BrowserTestUtils.loadURI(browser, `javascript:
let iframe = document.createElement("iframe"); let iframe = document.createElement("iframe");
iframe.src = "http://example.com"; iframe.src = "http://example.com";
iframe.id = "iframe1"; iframe.id = "iframe1";

Просмотреть файл

@ -10,7 +10,7 @@ add_task(async function test() {
info("Creating a normal window..."); info("Creating a normal window...");
let win = await BrowserTestUtils.openNewBrowserWindow(); let win = await BrowserTestUtils.openNewBrowserWindow();
let tab = win.gBrowser.selectedBrowser; let tab = win.gBrowser.selectedBrowser;
tab.loadURI(BASE_URI); BrowserTestUtils.loadURI(tab, BASE_URI);
await BrowserTestUtils.browserLoaded(tab); await BrowserTestUtils.browserLoaded(tab);
let blobURL; let blobURL;
@ -25,7 +25,7 @@ add_task(async function test() {
info("Creating a private window..."); info("Creating a private window...");
let privateWin = await BrowserTestUtils.openNewBrowserWindow({ private: true }); let privateWin = await BrowserTestUtils.openNewBrowserWindow({ private: true });
let privateTab = privateWin.gBrowser.selectedBrowser; let privateTab = privateWin.gBrowser.selectedBrowser;
privateTab.loadURI(BASE_URI); BrowserTestUtils.loadURI(privateTab, BASE_URI);
await BrowserTestUtils.browserLoaded(privateTab); await BrowserTestUtils.browserLoaded(privateTab);
await ContentTask.spawn(privateTab, blobURL, function(url) { await ContentTask.spawn(privateTab, blobURL, function(url) {

Просмотреть файл

@ -27,7 +27,7 @@ add_task(async function test() {
// Step 1 // Step 1
let non_private_browser = gBrowser.selectedBrowser; let non_private_browser = gBrowser.selectedBrowser;
let url = prefix + "?action=set&name=test&value=value&initial=true"; let url = prefix + "?action=set&name=test&value=value&initial=true";
non_private_browser.loadURI(url); BrowserTestUtils.loadURI(non_private_browser, url);
await BrowserTestUtils.browserLoaded(non_private_browser, false, url); await BrowserTestUtils.browserLoaded(non_private_browser, false, url);
@ -35,13 +35,13 @@ add_task(async function test() {
let private_window = await BrowserTestUtils.openNewBrowserWindow({ private: true }); let private_window = await BrowserTestUtils.openNewBrowserWindow({ private: true });
let private_browser = private_window.getBrowser().selectedBrowser; let private_browser = private_window.getBrowser().selectedBrowser;
url = prefix + "?action=set&name=test2&value=value2"; url = prefix + "?action=set&name=test2&value=value2";
private_browser.loadURI(url); BrowserTestUtils.loadURI(private_browser, url);
await BrowserTestUtils.browserLoaded(private_browser, false, url); await BrowserTestUtils.browserLoaded(private_browser, false, url);
// Step 3 // Step 3
url = prefix + "?action=get&name=test2"; url = prefix + "?action=get&name=test2";
non_private_browser.loadURI(url); BrowserTestUtils.loadURI(non_private_browser, url);
await BrowserTestUtils.browserLoaded(non_private_browser, false, url); await BrowserTestUtils.browserLoaded(non_private_browser, false, url);
let elts = await getElts(non_private_browser); let elts = await getElts(non_private_browser);
isnot(elts[0], "value2", "public window shouldn't see private storage"); isnot(elts[0], "value2", "public window shouldn't see private storage");
@ -50,7 +50,7 @@ add_task(async function test() {
// Step 4 // Step 4
url = prefix + "?action=get&name=test"; url = prefix + "?action=get&name=test";
private_browser.loadURI(url); BrowserTestUtils.loadURI(private_browser, url);
await BrowserTestUtils.browserLoaded(private_browser, false, url); await BrowserTestUtils.browserLoaded(private_browser, false, url);
elts = await getElts(private_browser); elts = await getElts(private_browser);
isnot(elts[0], "value", "private window shouldn't see public storage"); isnot(elts[0], "value", "private window shouldn't see public storage");
@ -66,7 +66,7 @@ add_task(async function test() {
private_browser = private_window.getBrowser().selectedBrowser; private_browser = private_window.getBrowser().selectedBrowser;
url = prefix + "?action=get&name=test2"; url = prefix + "?action=get&name=test2";
private_browser.loadURI(url); BrowserTestUtils.loadURI(private_browser, url);
await BrowserTestUtils.browserLoaded(private_browser, false, url); await BrowserTestUtils.browserLoaded(private_browser, false, url);
elts = await getElts(private_browser); elts = await getElts(private_browser);
isnot(elts[0], "value2", "public window shouldn't see cleared private storage"); isnot(elts[0], "value2", "public window shouldn't see cleared private storage");
@ -82,14 +82,14 @@ add_task(async function test() {
private_browser = private_window.getBrowser().selectedBrowser; private_browser = private_window.getBrowser().selectedBrowser;
url = prefix + "?action=set&name=test3&value=value3"; url = prefix + "?action=set&name=test3&value=value3";
private_browser.loadURI(url); BrowserTestUtils.loadURI(private_browser, url);
await BrowserTestUtils.browserLoaded(private_browser, false, url); await BrowserTestUtils.browserLoaded(private_browser, false, url);
elts = await getElts(private_browser); elts = await getElts(private_browser);
is(elts[1], "1", "private window should only see new private items"); is(elts[1], "1", "private window should only see new private items");
// Cleanup. // Cleanup.
url = prefix + "?final=true"; url = prefix + "?final=true";
non_private_browser.loadURI(url); BrowserTestUtils.loadURI(non_private_browser, url);
await BrowserTestUtils.browserLoaded(non_private_browser, false, url); await BrowserTestUtils.browserLoaded(non_private_browser, false, url);
private_window.close(); private_window.close();
}); });

Просмотреть файл

@ -20,7 +20,7 @@ add_task(async function test() {
let privateWin = await BrowserTestUtils.openNewBrowserWindow({private: true}); let privateWin = await BrowserTestUtils.openNewBrowserWindow({private: true});
let privateBrowser = privateWin.gBrowser.selectedBrowser; let privateBrowser = privateWin.gBrowser.selectedBrowser;
privateBrowser.loadURI(testURI); BrowserTestUtils.loadURI(privateBrowser, testURI);
await BrowserTestUtils.browserLoaded(privateBrowser); await BrowserTestUtils.browserLoaded(privateBrowser);
info("Test on private window"); info("Test on private window");
@ -29,7 +29,7 @@ add_task(async function test() {
let win = await BrowserTestUtils.openNewBrowserWindow(); let win = await BrowserTestUtils.openNewBrowserWindow();
let browser = win.gBrowser.selectedBrowser; let browser = win.gBrowser.selectedBrowser;
browser.loadURI(testURI); BrowserTestUtils.loadURI(browser, testURI);
await BrowserTestUtils.browserLoaded(browser); await BrowserTestUtils.browserLoaded(browser);
info("Test on public window"); info("Test on public window");

Просмотреть файл

@ -36,14 +36,14 @@ add_task(async function test() {
let win = await BrowserTestUtils.openNewBrowserWindow(); let win = await BrowserTestUtils.openNewBrowserWindow();
let browser = win.gBrowser.selectedBrowser; let browser = win.gBrowser.selectedBrowser;
browser.loadURI(testPageURL); BrowserTestUtils.loadURI(browser, testPageURL);
await BrowserTestUtils.browserLoaded(browser); await BrowserTestUtils.browserLoaded(browser);
await checkGeolocation(false, win); await checkGeolocation(false, win);
let privateWin = await BrowserTestUtils.openNewBrowserWindow({private: true}); let privateWin = await BrowserTestUtils.openNewBrowserWindow({private: true});
let privateBrowser = privateWin.gBrowser.selectedBrowser; let privateBrowser = privateWin.gBrowser.selectedBrowser;
privateBrowser.loadURI(testPageURL); BrowserTestUtils.loadURI(privateBrowser, testPageURL);
await BrowserTestUtils.browserLoaded(privateBrowser); await BrowserTestUtils.browserLoaded(privateBrowser);
await checkGeolocation(true, privateWin); await checkGeolocation(true, privateWin);

Просмотреть файл

@ -13,8 +13,7 @@
let browser = win.gBrowser.selectedBrowser; let browser = win.gBrowser.selectedBrowser;
await BrowserTestUtils.browserLoaded(browser); await BrowserTestUtils.browserLoaded(browser);
browser.loadURI( BrowserTestUtils.loadURI(browser, "http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/" +
"http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/" +
"browser_privatebrowsing_localStorage_page2.html"); "browser_privatebrowsing_localStorage_page2.html");
await BrowserTestUtils.browserLoaded(browser); await BrowserTestUtils.browserLoaded(browser);

Просмотреть файл

@ -46,7 +46,7 @@ add_task(async function test() {
}, {once: true}); }, {once: true});
aWindow.gBrowser.selectedBrowser.loadURI(testURI); BrowserTestUtils.loadURI(aWindow.gBrowser.selectedBrowser, testURI);
} }
let win1 = await BrowserTestUtils.openNewBrowserWindow(); let win1 = await BrowserTestUtils.openNewBrowserWindow();

Просмотреть файл

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

Просмотреть файл

@ -40,7 +40,7 @@ function testMalware(data) {
// Now launch the unwanted software test // Now launch the unwanted software test
onDOMContentLoaded(testUnwanted); onDOMContentLoaded(testUnwanted);
gBrowser.loadURI("http://www.itisatrap.org/firefox/unwanted.html"); BrowserTestUtils.loadURI(gBrowser, "http://www.itisatrap.org/firefox/unwanted.html");
} }
function testUnwanted(data) { function testUnwanted(data) {
@ -51,7 +51,7 @@ function testUnwanted(data) {
// Now launch the phishing test // Now launch the phishing test
onDOMContentLoaded(testPhishing); onDOMContentLoaded(testPhishing);
gBrowser.loadURI("http://www.itisatrap.org/firefox/its-a-trap.html"); BrowserTestUtils.loadURI(gBrowser, "http://www.itisatrap.org/firefox/its-a-trap.html");
} }
function testPhishing(data) { function testPhishing(data) {

Просмотреть файл

@ -32,7 +32,7 @@ function check_menu_at_page(url, testFn) {
let dclPromise = ContentTask.spawn(browser, null, async function() { let dclPromise = ContentTask.spawn(browser, null, async function() {
await ContentTaskUtils.waitForEvent(this, "DOMContentLoaded", false); await ContentTaskUtils.waitForEvent(this, "DOMContentLoaded", false);
}); });
browser.loadURI(url); BrowserTestUtils.loadURI(browser, url);
await dclPromise; await dclPromise;
let menu = document.getElementById("menu_HelpPopup"); let menu = document.getElementById("menu_HelpPopup");

Просмотреть файл

@ -201,7 +201,9 @@ add_task(async function testShiftMiddleClick() {
add_task(async function testRightClick() { add_task(async function testRightClick() {
preTabNo = gBrowser.tabs.length; preTabNo = gBrowser.tabs.length;
gBrowser.selectedBrowser.loadURI("about:blank"); BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:blank", {
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
});
await new Promise(resolve => { await new Promise(resolve => {
setTimeout(function() { setTimeout(function() {
is(gBrowser.tabs.length, preTabNo, "RightClick did not open new tab"); is(gBrowser.tabs.length, preTabNo, "RightClick did not open new tab");
@ -255,7 +257,9 @@ add_task(async function asyncCleanup() {
while (gBrowser.tabs.length != 1) { while (gBrowser.tabs.length != 1) {
gBrowser.removeTab(gBrowser.tabs[0], {animate: false}); gBrowser.removeTab(gBrowser.tabs[0], {animate: false});
} }
gBrowser.selectedBrowser.loadURI("about:blank"); BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:blank", {
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
});
await promiseRemoveEngine(); await promiseRemoveEngine();
}); });

Просмотреть файл

@ -28,7 +28,7 @@ function test() {
// load about:home, but remove the listener first so it doesn't // load about:home, but remove the listener first so it doesn't
// get in the way // get in the way
gBrowser.removeProgressListener(listener); gBrowser.removeProgressListener(listener);
gBrowser.loadURI("about:home"); BrowserTestUtils.loadURI(gBrowser, "about:home");
info("Waiting for about:home load"); info("Waiting for about:home load");
tab.linkedBrowser.addEventListener("load", function load(event) { tab.linkedBrowser.addEventListener("load", function load(event) {
if (event.originalTarget != tab.linkedBrowser.contentDocumentAsCPOW || if (event.originalTarget != tab.linkedBrowser.contentDocumentAsCPOW ||

Просмотреть файл

@ -16,7 +16,7 @@ const TESTS = [
function promiseTestOpenCloseWindow(aIsPrivate, aTest) { function promiseTestOpenCloseWindow(aIsPrivate, aTest) {
return (async function() { return (async function() {
let win = await BrowserTestUtils.openNewBrowserWindow({ "private": aIsPrivate }); let win = await BrowserTestUtils.openNewBrowserWindow({ "private": aIsPrivate });
win.gBrowser.selectedBrowser.loadURI(aTest.url); BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser, aTest.url);
await promiseBrowserLoaded(win.gBrowser.selectedBrowser, true, aTest.url); await promiseBrowserLoaded(win.gBrowser.selectedBrowser, true, aTest.url);
// Mark the window with some unique data to be restored later on. // Mark the window with some unique data to be restored later on.
ss.setWindowValue(win, aTest.key, aTest.value); ss.setWindowValue(win, aTest.key, aTest.value);

Просмотреть файл

@ -33,7 +33,7 @@ add_task(async function() {
], ],
}); });
browser.loadURI("about:sessionrestore"); BrowserTestUtils.loadURI(browser, "about:sessionrestore");
await BrowserTestUtils.browserLoaded(browser, false, "about:sessionrestore"); await BrowserTestUtils.browserLoaded(browser, false, "about:sessionrestore");
doc = browser.contentDocument; doc = browser.contentDocument;

Просмотреть файл

@ -17,7 +17,10 @@ add_task(async function() {
// Load a new URI with a specific referrer. // Load a new URI with a specific referrer.
let referrerURI = Services.io.newURI(REFERRER1); let referrerURI = Services.io.newURI(REFERRER1);
browser.loadURI("http://example.org", { referrerURI }); browser.loadURI("http://example.org", {
referrerURI,
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
});
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
await TabStateFlusher.flush(browser); await TabStateFlusher.flush(browser);

Просмотреть файл

@ -97,7 +97,7 @@ add_task(async function test_remove_uninteresting_window() {
// site. // site.
let tab = newWin.gBrowser.selectedTab; let tab = newWin.gBrowser.selectedTab;
let browser = tab.linkedBrowser; let browser = tab.linkedBrowser;
browser.loadURI(PAGE); BrowserTestUtils.loadURI(browser, PAGE);
await BrowserTestUtils.browserLoaded(browser, false, PAGE); await BrowserTestUtils.browserLoaded(browser, false, PAGE);
await TabStateFlusher.flush(browser); await TabStateFlusher.flush(browser);
@ -157,7 +157,7 @@ add_task(async function test_synchronously_remove_window_state() {
// interesting. // interesting.
let newWin = await BrowserTestUtils.openNewBrowserWindow(); let newWin = await BrowserTestUtils.openNewBrowserWindow();
let browser = newWin.gBrowser.selectedBrowser; let browser = newWin.gBrowser.selectedBrowser;
browser.loadURI(PAGE); BrowserTestUtils.loadURI(browser, PAGE);
await BrowserTestUtils.browserLoaded(browser, false, PAGE); await BrowserTestUtils.browserLoaded(browser, false, PAGE);
await TabStateFlusher.flush(browser); await TabStateFlusher.flush(browser);

Просмотреть файл

@ -32,7 +32,7 @@ async function setupBackgroundTabs(testFn) {
// foreground. // foreground.
let initialTab = gBrowser.selectedTab; let initialTab = gBrowser.selectedTab;
let initialBrowser = initialTab.linkedBrowser; let initialBrowser = initialTab.linkedBrowser;
initialBrowser.loadURI(NON_REMOTE_PAGE); BrowserTestUtils.loadURI(initialBrowser, NON_REMOTE_PAGE);
await BrowserTestUtils.browserLoaded(initialBrowser); await BrowserTestUtils.browserLoaded(initialBrowser);
// Open some tabs that should be running in the content process. // Open some tabs that should be running in the content process.

Просмотреть файл

@ -73,7 +73,7 @@ add_task(async function test_creation() {
// Open a second tab, save session, ensure that the correct files exist. // Open a second tab, save session, ensure that the correct files exist.
info("Testing situation after a second write"); info("Testing situation after a second write");
let URL2 = URL_BASE + "?second_write"; let URL2 = URL_BASE + "?second_write";
tab.linkedBrowser.loadURI(URL2); BrowserTestUtils.loadURI(tab.linkedBrowser, URL2);
await promiseBrowserLoaded(tab.linkedBrowser); await promiseBrowserLoaded(tab.linkedBrowser);
await TabStateFlusher.flush(tab.linkedBrowser); await TabStateFlusher.flush(tab.linkedBrowser);
await SessionSaver.run(); await SessionSaver.run();

Просмотреть файл

@ -120,7 +120,7 @@ async function createTabWithStorageData(urls, win = window) {
let browser = tab.linkedBrowser; let browser = tab.linkedBrowser;
for (let url of urls) { for (let url of urls) {
browser.loadURI(url); BrowserTestUtils.loadURI(browser, url);
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
await modifySessionStorage(browser, {test: INITIAL_VALUE}); await modifySessionStorage(browser, {test: INITIAL_VALUE});
} }

Просмотреть файл

@ -12,7 +12,7 @@ let notificationsCount = 0;
async function openWindow(url) { async function openWindow(url) {
let win = await promiseNewWindowLoaded(); let win = await promiseNewWindowLoaded();
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY; let flags = Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY;
win.gBrowser.selectedBrowser.loadURI(url, { flags }); BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser, url, { flags });
await promiseBrowserLoaded(win.gBrowser.selectedBrowser, true, url); await promiseBrowserLoaded(win.gBrowser.selectedBrowser, true, url);
return win; return win;
} }

Просмотреть файл

@ -14,7 +14,7 @@ let notificationsCount = 0;
async function openWindow(url) { async function openWindow(url) {
let win = await promiseNewWindowLoaded(); let win = await promiseNewWindowLoaded();
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY; let flags = Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY;
win.gBrowser.selectedBrowser.loadURI(url, { flags }); BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser, url, { flags });
await promiseBrowserLoaded(win.gBrowser.selectedBrowser, true, url); await promiseBrowserLoaded(win.gBrowser.selectedBrowser, true, url);
return win; return win;
} }

Просмотреть файл

@ -134,7 +134,7 @@ add_task(async function test_crash_page_not_in_history() {
ok(browser.isRemoteBrowser, "Should be a remote browser"); ok(browser.isRemoteBrowser, "Should be a remote browser");
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
browser.loadURI(PAGE_1); BrowserTestUtils.loadURI(browser, PAGE_1);
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
await TabStateFlusher.flush(browser); await TabStateFlusher.flush(browser);
@ -163,7 +163,7 @@ add_task(async function test_revived_history_from_remote() {
ok(browser.isRemoteBrowser, "Should be a remote browser"); ok(browser.isRemoteBrowser, "Should be a remote browser");
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
browser.loadURI(PAGE_1); BrowserTestUtils.loadURI(browser, PAGE_1);
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
await TabStateFlusher.flush(browser); await TabStateFlusher.flush(browser);
@ -172,7 +172,7 @@ add_task(async function test_revived_history_from_remote() {
// Browse to a new site that will cause the browser to // Browse to a new site that will cause the browser to
// become remote again. // become remote again.
browser.loadURI(PAGE_2); BrowserTestUtils.loadURI(browser, PAGE_2);
await promiseTabRestored(newTab); await promiseTabRestored(newTab);
ok(!newTab.hasAttribute("crashed"), "Tab shouldn't be marked as crashed anymore."); ok(!newTab.hasAttribute("crashed"), "Tab shouldn't be marked as crashed anymore.");
ok(browser.isRemoteBrowser, "Should be a remote browser"); ok(browser.isRemoteBrowser, "Should be a remote browser");
@ -202,7 +202,7 @@ add_task(async function test_revived_history_from_non_remote() {
ok(browser.isRemoteBrowser, "Should be a remote browser"); ok(browser.isRemoteBrowser, "Should be a remote browser");
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
browser.loadURI(PAGE_1); BrowserTestUtils.loadURI(browser, PAGE_1);
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
await TabStateFlusher.flush(browser); await TabStateFlusher.flush(browser);
@ -211,7 +211,7 @@ add_task(async function test_revived_history_from_non_remote() {
// Browse to a new site that will not cause the browser to // Browse to a new site that will not cause the browser to
// become remote again. // become remote again.
browser.loadURI("about:mozilla"); BrowserTestUtils.loadURI(browser, "about:mozilla");
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
ok(!newTab.hasAttribute("crashed"), "Tab shouldn't be marked as crashed anymore."); ok(!newTab.hasAttribute("crashed"), "Tab shouldn't be marked as crashed anymore.");
ok(!browser.isRemoteBrowser, "Should not be a remote browser"); ok(!browser.isRemoteBrowser, "Should not be a remote browser");
@ -240,7 +240,7 @@ add_task(async function test_revive_tab_from_session_store() {
ok(browser.isRemoteBrowser, "Should be a remote browser"); ok(browser.isRemoteBrowser, "Should be a remote browser");
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
browser.loadURI(PAGE_1); BrowserTestUtils.loadURI(browser, PAGE_1);
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
let newTab2 = BrowserTestUtils.addTab(gBrowser, "about:blank", { sameProcessAsFrameLoader: browser.frameLoader }); let newTab2 = BrowserTestUtils.addTab(gBrowser, "about:blank", { sameProcessAsFrameLoader: browser.frameLoader });
@ -248,10 +248,10 @@ add_task(async function test_revive_tab_from_session_store() {
ok(browser2.isRemoteBrowser, "Should be a remote browser"); ok(browser2.isRemoteBrowser, "Should be a remote browser");
await promiseBrowserLoaded(browser2); await promiseBrowserLoaded(browser2);
browser.loadURI(PAGE_1); BrowserTestUtils.loadURI(browser, PAGE_1);
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
browser.loadURI(PAGE_2); BrowserTestUtils.loadURI(browser, PAGE_2);
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
await TabStateFlusher.flush(browser); await TabStateFlusher.flush(browser);
@ -293,7 +293,7 @@ add_task(async function test_revive_all_tabs_from_session_store() {
ok(browser.isRemoteBrowser, "Should be a remote browser"); ok(browser.isRemoteBrowser, "Should be a remote browser");
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
browser.loadURI(PAGE_1); BrowserTestUtils.loadURI(browser, PAGE_1);
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
// In order to see a second about:tabcrashed page, we'll need // In order to see a second about:tabcrashed page, we'll need
@ -306,10 +306,10 @@ add_task(async function test_revive_all_tabs_from_session_store() {
ok(browser2.isRemoteBrowser, "Should be a remote browser"); ok(browser2.isRemoteBrowser, "Should be a remote browser");
await promiseBrowserLoaded(browser2); await promiseBrowserLoaded(browser2);
browser.loadURI(PAGE_1); BrowserTestUtils.loadURI(browser, PAGE_1);
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
browser.loadURI(PAGE_2); BrowserTestUtils.loadURI(browser, PAGE_2);
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
await TabStateFlusher.flush(browser); await TabStateFlusher.flush(browser);
@ -353,7 +353,7 @@ add_task(async function test_close_tab_after_crash() {
ok(browser.isRemoteBrowser, "Should be a remote browser"); ok(browser.isRemoteBrowser, "Should be a remote browser");
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
browser.loadURI(PAGE_1); BrowserTestUtils.loadURI(browser, PAGE_1);
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
await TabStateFlusher.flush(browser); await TabStateFlusher.flush(browser);
@ -382,7 +382,7 @@ add_task(async function test_hide_restore_all_button() {
ok(browser.isRemoteBrowser, "Should be a remote browser"); ok(browser.isRemoteBrowser, "Should be a remote browser");
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
browser.loadURI(PAGE_1); BrowserTestUtils.loadURI(browser, PAGE_1);
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
await TabStateFlusher.flush(browser); await TabStateFlusher.flush(browser);
@ -401,7 +401,7 @@ add_task(async function test_hide_restore_all_button() {
let newTab2 = BrowserTestUtils.addTab(gBrowser); let newTab2 = BrowserTestUtils.addTab(gBrowser);
gBrowser.selectedTab = newTab; gBrowser.selectedTab = newTab;
browser.loadURI(PAGE_2); BrowserTestUtils.loadURI(browser, PAGE_2);
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
// Load up a second window so we can get another tab to show // Load up a second window so we can get another tab to show
@ -440,7 +440,7 @@ add_task(async function test_aboutcrashedtabzoom() {
ok(browser.isRemoteBrowser, "Should be a remote browser"); ok(browser.isRemoteBrowser, "Should be a remote browser");
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
browser.loadURI(PAGE_1); BrowserTestUtils.loadURI(browser, PAGE_1);
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
FullZoom.enlarge(); FullZoom.enlarge();

Просмотреть файл

@ -12,7 +12,7 @@ add_task(async function test() {
// Load some URL in the current tab. // Load some URL in the current tab.
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY; let flags = Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY;
win.gBrowser.selectedBrowser.loadURI("about:robots", { flags }); BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser, "about:robots", { flags });
await promiseBrowserLoaded(win.gBrowser.selectedBrowser); await promiseBrowserLoaded(win.gBrowser.selectedBrowser);
// Open a second tab and close the first one. // Open a second tab and close the first one.

Просмотреть файл

@ -78,7 +78,7 @@ let forgetWinHelper = async function(forgetFn) {
// Create a tab worth remembering. // Create a tab worth remembering.
let tab = newWin.gBrowser.selectedTab; let tab = newWin.gBrowser.selectedTab;
let browser = tab.linkedBrowser; let browser = tab.linkedBrowser;
browser.loadURI(PAGE); BrowserTestUtils.loadURI(browser, PAGE);
await BrowserTestUtils.browserLoaded(browser, false, PAGE); await BrowserTestUtils.browserLoaded(browser, false, PAGE);
await TabStateFlusher.flush(browser); await TabStateFlusher.flush(browser);

Просмотреть файл

@ -20,7 +20,7 @@ add_task(async function test_frametree() {
is(await countNonDynamicFrames(browser), 0, "no child frames"); is(await countNonDynamicFrames(browser), 0, "no child frames");
// Navigate to a frameset. // Navigate to a frameset.
browser.loadURI(URL_FRAMESET); BrowserTestUtils.loadURI(browser, URL_FRAMESET);
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
// The frameset has two frames. // The frameset has two frames.

Просмотреть файл

@ -34,7 +34,7 @@ add_task(async function check_history_not_persisted() {
}); });
// Load a new URL into the tab, it should replace the about:blank history entry // Load a new URL into the tab, it should replace the about:blank history entry
browser.loadURI("about:robots"); BrowserTestUtils.loadURI(browser, "about:robots");
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
await ContentTask.spawn(browser, null, function() { await ContentTask.spawn(browser, null, function() {
let sessionHistory = docShell.QueryInterface(Ci.nsIInterfaceRequestor) let sessionHistory = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
@ -77,7 +77,7 @@ add_task(async function check_history_default_persisted() {
}); });
// Load a new URL into the tab, it should replace the about:blank history entry // Load a new URL into the tab, it should replace the about:blank history entry
browser.loadURI("about:robots"); BrowserTestUtils.loadURI(browser, "about:robots");
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
await ContentTask.spawn(browser, null, function() { await ContentTask.spawn(browser, null, function() {
let sessionHistory = docShell.QueryInterface(Ci.nsIInterfaceRequestor) let sessionHistory = docShell.QueryInterface(Ci.nsIInterfaceRequestor)

Просмотреть файл

@ -13,9 +13,9 @@ add_task(async function() {
ok(!browser.isRemoteBrowser, "Ensure browser is not remote"); ok(!browser.isRemoteBrowser, "Ensure browser is not remote");
// Load a remote page, and then another remote page immediately // Load a remote page, and then another remote page immediately
// after. // after.
browser.loadURI(PAGE_1); BrowserTestUtils.loadURI(browser, PAGE_1);
browser.stop(); browser.stop();
browser.loadURI(PAGE_2); BrowserTestUtils.loadURI(browser, PAGE_2);
await BrowserTestUtils.browserLoaded(browser); await BrowserTestUtils.browserLoaded(browser);
ok(browser.isRemoteBrowser, "Should have switched remoteness"); ok(browser.isRemoteBrowser, "Should have switched remoteness");

Просмотреть файл

@ -22,7 +22,7 @@ add_task(async function() {
tab2 = BrowserTestUtils.addTab(gBrowser); tab2 = BrowserTestUtils.addTab(gBrowser);
await promiseBrowserLoaded(tab2.linkedBrowser); await promiseBrowserLoaded(tab2.linkedBrowser);
await setUsePrivateBrowsing(tab2.linkedBrowser, true); await setUsePrivateBrowsing(tab2.linkedBrowser, true);
tab2.linkedBrowser.loadURI(URL_PRIVATE); BrowserTestUtils.loadURI(tab2.linkedBrowser, URL_PRIVATE);
await promiseBrowserLoaded(tab2.linkedBrowser); await promiseBrowserLoaded(tab2.linkedBrowser);
info("Flush to make sure chrome received all data."); info("Flush to make sure chrome received all data.");

Просмотреть файл

@ -32,6 +32,8 @@ var testSwitchToTab = async function(url, options) {
ok(tab.hasAttribute("pending"), "tab is pending"); ok(tab.hasAttribute("pending"), "tab is pending");
await promise; await promise;
options.triggeringPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
// Switch-to-tab with a similar URI. // Switch-to-tab with a similar URI.
switchToTabHavingURI(url, false, options); switchToTabHavingURI(url, false, options);

Просмотреть файл

@ -125,7 +125,7 @@ add_task(async function test_scroll_background_tabs() {
await checkScroll(tab, {scroll: SCROLL_STR}, "scroll on first page is fine"); await checkScroll(tab, {scroll: SCROLL_STR}, "scroll on first page is fine");
// Navigate to a different page and scroll there as well. // Navigate to a different page and scroll there as well.
browser.loadURI(URL2); BrowserTestUtils.loadURI(browser, URL2);
await BrowserTestUtils.browserLoaded(browser); await BrowserTestUtils.browserLoaded(browser);
// Scroll down a little. // Scroll down a little.

Просмотреть файл

@ -76,7 +76,7 @@ add_task(async function test_pageshow() {
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
// Create a second shistory entry. // Create a second shistory entry.
browser.loadURI(URL2); BrowserTestUtils.loadURI(browser, URL2);
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
// Wait until shistory changes. // Wait until shistory changes.
@ -164,7 +164,7 @@ add_task(async function test_about_page_navigate() {
// Verify that the title is also recorded. // Verify that the title is also recorded.
is(entries[0].title, "about:blank", "title is correct"); is(entries[0].title, "about:blank", "title is correct");
browser.loadURI("about:robots"); BrowserTestUtils.loadURI(browser, "about:robots");
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
// Check that we have changed the history entry. // Check that we have changed the history entry.

Просмотреть файл

@ -76,7 +76,7 @@ add_task(async function session_storage() {
"sessionStorage data for mochi.test has been duplicated correctly"); "sessionStorage data for mochi.test has been duplicated correctly");
// Check that loading a new URL discards data. // Check that loading a new URL discards data.
browser2.loadURI("http://mochi.test:8888/"); BrowserTestUtils.loadURI(browser2, "http://mochi.test:8888/");
await promiseBrowserLoaded(browser2); await promiseBrowserLoaded(browser2);
await TabStateFlusher.flush(browser2); await TabStateFlusher.flush(browser2);
@ -86,7 +86,7 @@ add_task(async function session_storage() {
ok(!storage["http://example.com"], "storage data was discarded"); ok(!storage["http://example.com"], "storage data was discarded");
// Check that loading a new URL discards data. // Check that loading a new URL discards data.
browser2.loadURI("about:mozilla"); BrowserTestUtils.loadURI(browser2, "about:mozilla");
await promiseBrowserLoaded(browser2); await promiseBrowserLoaded(browser2);
await TabStateFlusher.flush(browser2); await TabStateFlusher.flush(browser2);

Просмотреть файл

@ -27,7 +27,7 @@ add_task(async function() {
// Load more pages than we would save to disk on a clean shutdown. // Load more pages than we would save to disk on a clean shutdown.
for (let i = 0; i < MAX_BACK + 2; i++) { for (let i = 0; i < MAX_BACK + 2; i++) {
browser.loadURI(URL + i); BrowserTestUtils.loadURI(browser, URL + i);
await promiseBrowserLoaded(browser); await promiseBrowserLoaded(browser);
ok(browser.isRemoteBrowser, "browser is still remote"); ok(browser.isRemoteBrowser, "browser is still remote");
} }
@ -36,7 +36,7 @@ add_task(async function() {
await countHistoryEntries(browser, MAX_BACK + 2); await countHistoryEntries(browser, MAX_BACK + 2);
// Load a non-remote page. // Load a non-remote page.
browser.loadURI("about:robots"); BrowserTestUtils.loadURI(browser, "about:robots");
await promiseTabRestored(tab); await promiseTabRestored(tab);
ok(!browser.isRemoteBrowser, "browser is not remote anymore"); ok(!browser.isRemoteBrowser, "browser is not remote anymore");

Просмотреть файл

@ -17,7 +17,7 @@ async function openAndCloseTab(window, url) {
async function openWindow(url) { async function openWindow(url) {
let win = await promiseNewWindowLoaded(); let win = await promiseNewWindowLoaded();
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY; let flags = Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY;
win.gBrowser.selectedBrowser.loadURI(url, { flags }); BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser, url, { flags });
await promiseBrowserLoaded(win.gBrowser.selectedBrowser, true, url); await promiseBrowserLoaded(win.gBrowser.selectedBrowser, true, url);
return win; return win;
} }

Просмотреть файл

@ -58,7 +58,7 @@ function onPageLoad() {
function test() { function test() {
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser); gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(onPageLoad, false, "about:logo"); BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(onPageLoad, false, "about:logo");
gBrowser.loadURI("about:logo"); BrowserTestUtils.loadURI(gBrowser, "about:logo");
waitForExplicitFinish(); waitForExplicitFinish();
} }

Просмотреть файл

@ -33,7 +33,7 @@ function test() {
}); });
}); });
gBrowser.selectedBrowser.loadURI("http://example.com/"); BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "http://example.com/");
} }
function getLanguageExceptions() { function getLanguageExceptions() {

Просмотреть файл

@ -88,7 +88,7 @@ function test() {
}); });
}); });
gBrowser.selectedBrowser.loadURI("data:text/plain,test page"); BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "data:text/plain,test page");
} }
function checkURLBarIcon(aExpectTranslated = false) { function checkURLBarIcon(aExpectTranslated = false) {

Просмотреть файл

@ -37,14 +37,14 @@ add_task(async function testTemporaryPermissionTabURLs() {
await BrowserTestUtils.withNewTab("about:blank", async function(browser) { await BrowserTestUtils.withNewTab("about:blank", async function(browser) {
for (let uri of same) { for (let uri of same) {
let loaded = BrowserTestUtils.browserLoaded(browser, false, uri.spec); let loaded = BrowserTestUtils.browserLoaded(browser, false, uri.spec);
browser.loadURI(uri.spec); BrowserTestUtils.loadURI(browser, uri.spec);
await loaded; await loaded;
SitePermissions.set(uri, id, SitePermissions.BLOCK, SitePermissions.SCOPE_TEMPORARY, browser); SitePermissions.set(uri, id, SitePermissions.BLOCK, SitePermissions.SCOPE_TEMPORARY, browser);
for (let uri2 of same) { for (let uri2 of same) {
let loaded2 = BrowserTestUtils.browserLoaded(browser, false, uri2.spec); let loaded2 = BrowserTestUtils.browserLoaded(browser, false, uri2.spec);
browser.loadURI(uri2.spec); BrowserTestUtils.loadURI(browser, uri2.spec);
await loaded2; await loaded2;
Assert.deepEqual(SitePermissions.get(uri2, id, browser), { Assert.deepEqual(SitePermissions.get(uri2, id, browser), {
@ -58,7 +58,7 @@ add_task(async function testTemporaryPermissionTabURLs() {
for (let uri of different) { for (let uri of different) {
let loaded = BrowserTestUtils.browserLoaded(browser, false, uri.spec); let loaded = BrowserTestUtils.browserLoaded(browser, false, uri.spec);
browser.loadURI(uri.spec); BrowserTestUtils.loadURI(browser, uri.spec);
await loaded; await loaded;
SitePermissions.set(uri, id, SitePermissions.BLOCK, SitePermissions.SCOPE_TEMPORARY, browser); SitePermissions.set(uri, id, SitePermissions.BLOCK, SitePermissions.SCOPE_TEMPORARY, browser);
@ -70,7 +70,7 @@ add_task(async function testTemporaryPermissionTabURLs() {
for (let uri2 of different) { for (let uri2 of different) {
loaded = BrowserTestUtils.browserLoaded(browser, false, uri2.spec); loaded = BrowserTestUtils.browserLoaded(browser, false, uri2.spec);
browser.loadURI(uri2.spec); BrowserTestUtils.loadURI(browser, uri2.spec);
await loaded; await loaded;
if (uri2 != uri) { if (uri2 != uri) {

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше