Backed out 7 changesets (bug 1658084, bug 1671983) for perma failures on browser_async_remove_tab.js and browser_e10s_chrome_process.js. CLOSED TREE

Backed out changeset 2e6309c1cdbd (bug 1658084)
Backed out changeset 99aafd9304ef (bug 1671983)
Backed out changeset 80280b85280a (bug 1671983)
Backed out changeset 008db2659002 (bug 1671983)
Backed out changeset 32bd45c7fe3a (bug 1671983)
Backed out changeset 56e227e6580c (bug 1671983)
Backed out changeset a404f809f79d (bug 1671983)
This commit is contained in:
Razvan Maries 2020-11-04 04:23:47 +02:00
Родитель 1033f1d0e2
Коммит 10425eddfc
139 изменённых файлов: 1213 добавлений и 378 удалений

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

@ -34,8 +34,8 @@
let docLoaded = waitForEvent(EVENT_DOCUMENT_LOAD_COMPLETE, event =>
event.accessible.QueryInterface(nsIAccessibleDocument).URL === ABOUT_LICENSE_URL,
`Loaded tab: ${ABOUT_LICENSE_URL}`);
BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser,
"about:license");
await BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser,
ABOUT_LICENSE_URL);
await loaded;
await docLoaded;
await winFocused;

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

@ -30,6 +30,15 @@ class BrowserTabParent extends JSWindowActorParent {
browser.ownerGlobal.gBrowserInit._firstContentWindowPaintDeferred.resolve();
break;
}
case "Browser:LoadURI": {
if (gBrowser.sessionHistoryInParent) {
message.data.historyIndex =
browsingContext.sessionHistory.requestedIndex;
}
gBrowser.ownerGlobal.RedirectLoad(browser, message.data);
break;
}
}
}
}

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

@ -1537,31 +1537,32 @@ function _loadURI(browser, uri, params = {}) {
throw new Error("Cannot load with mismatched userContextId");
}
// Attempt to perform URI fixup to see if we can handle this URI in chrome.
try {
let fixupFlags = Ci.nsIURIFixup.FIXUP_FLAG_NONE;
if (loadFlags & Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP) {
fixupFlags |= Ci.nsIURIFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
}
if (loadFlags & Ci.nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS) {
fixupFlags |= Ci.nsIURIFixup.FIXUP_FLAG_FIX_SCHEME_TYPOS;
}
if (PrivateBrowsingUtils.isBrowserPrivate(browser)) {
fixupFlags |= Ci.nsIURIFixup.FIXUP_FLAG_PRIVATE_CONTEXT;
}
let uriObject = Services.uriFixup.getFixupURIInfo(uri, fixupFlags)
.preferredURI;
if (uriObject && handleUriInChrome(browser, uriObject)) {
// If we've handled the URI in Chrome, then just return here.
return;
}
} catch (e) {
// getFixupURIInfo may throw. Gracefully recover and try to load the URI normally.
let {
uriObject,
requiredRemoteType,
mustChangeProcess,
newFrameloader,
} = E10SUtils.shouldLoadURIInBrowser(
browser,
uri,
gMultiProcessBrowser,
gFissionBrowser,
loadFlags
);
if (uriObject && handleUriInChrome(browser, uriObject)) {
// If we've handled the URI in Chrome then just return here.
return;
}
if (newFrameloader) {
// If a new frameloader is needed for process reselection because this used
// to be a preloaded browser, clear the preloaded state now.
browser.removeAttribute("preloadedState");
}
// XXX(nika): Is `browser.isNavigating` necessary anymore?
browser.isNavigating = true;
// !requiredRemoteType means we're loading in the parent/this process.
if (!requiredRemoteType) {
browser.isNavigating = true;
}
let loadURIOptions = {
triggeringPrincipal,
csp,
@ -1571,9 +1572,96 @@ function _loadURI(browser, uri, params = {}) {
hasValidUserGestureActivation,
};
try {
browser.webNavigation.loadURI(uri, loadURIOptions);
if (!mustChangeProcess) {
browser.webNavigation.loadURI(uri, loadURIOptions);
} else {
// Check if the current browser is allowed to unload.
let { permitUnload } = browser.permitUnload();
if (!permitUnload) {
return;
}
if (postData) {
postData = serializeInputStream(postData);
}
let loadParams = {
uri,
triggeringPrincipal: triggeringPrincipal
? E10SUtils.serializePrincipal(triggeringPrincipal)
: null,
flags: loadFlags,
referrerInfo: E10SUtils.serializeReferrerInfo(referrerInfo),
remoteType: requiredRemoteType,
postData,
newFrameloader,
csp: csp ? gSerializationHelper.serializeToString(csp) : null,
};
if (userContextId) {
loadParams.userContextId = userContextId;
}
if (browser.webNavigation.maybeCancelContentJSExecution) {
let cancelContentJSEpoch = browser.webNavigation.maybeCancelContentJSExecution(
Ci.nsIRemoteTab.NAVIGATE_URL,
{ uri: uriObject }
);
loadParams.cancelContentJSEpoch = cancelContentJSEpoch;
}
LoadInOtherProcess(browser, loadParams);
}
} catch (e) {
// If anything goes wrong when switching remoteness, just switch remoteness
// manually and load the URI.
// We might lose history that way but at least the browser loaded a page.
// This might be necessary if SessionStore wasn't initialized yet i.e.
// when the homepage is a non-remote page.
if (mustChangeProcess) {
Cu.reportError(e);
gBrowser.updateBrowserRemotenessByURL(browser, uri);
browser.webNavigation.loadURI(uri, loadURIOptions);
} else {
throw e;
}
} finally {
browser.isNavigating = false;
if (!requiredRemoteType) {
browser.isNavigating = false;
}
}
}
// Starts a new load in the browser first switching the browser to the correct
// process
function LoadInOtherProcess(browser, loadOptions, historyIndex = -1) {
let tab = gBrowser.getTabForBrowser(browser);
SessionStore.navigateAndRestore(tab, loadOptions, historyIndex);
}
// Called when a docshell has attempted to load a page in an incorrect process.
// This function is responsible for loading the page in the correct process.
function RedirectLoad(browser, data) {
if (browser.getAttribute("preloadedState") === "consumed") {
browser.removeAttribute("preloadedState");
data.loadOptions.newFrameloader = true;
}
// We should only start the redirection if the browser window has finished
// starting up. Otherwise, we should wait until the startup is done.
if (gBrowserInit.delayedStartupFinished) {
LoadInOtherProcess(browser, data.loadOptions, data.historyIndex);
} else {
let delayedStartupFinished = (subject, topic) => {
if (topic == "browser-delayed-startup-finished" && subject == window) {
Services.obs.removeObserver(delayedStartupFinished, topic);
LoadInOtherProcess(browser, data.loadOptions, data.historyIndex);
}
};
Services.obs.addObserver(
delayedStartupFinished,
"browser-delayed-startup-finished"
);
}
}
@ -5101,6 +5189,50 @@ var XULBrowserWindow = {
);
},
// Check whether this URI should load in the current process
shouldLoadURI(
aDocShell,
aURI,
aReferrerInfo,
aHasPostData,
aTriggeringPrincipal,
aCsp
) {
if (!gMultiProcessBrowser) {
return true;
}
let browser = aDocShell
.QueryInterface(Ci.nsIDocShellTreeItem)
.sameTypeRootTreeItem.QueryInterface(Ci.nsIDocShell).chromeEventHandler;
// Ignore loads that aren't in the main tabbrowser
if (
browser.localName != "browser" ||
!browser.getTabBrowser ||
browser.getTabBrowser() != gBrowser
) {
return true;
}
if (!E10SUtils.shouldLoadURI(aDocShell, aURI, aHasPostData)) {
// XXX: Do we want to complain if we have post data but are still
// redirecting the load? Perhaps a telemetry probe? Theoretically we
// shouldn't do this, as it throws out data. See bug 1348018.
E10SUtils.redirectLoad(
aDocShell,
aURI,
aReferrerInfo,
aTriggeringPrincipal,
null,
aCsp
);
return false;
}
return true;
},
onProgressChange(
aWebProgress,
aRequest,
@ -6117,9 +6249,9 @@ nsBrowserAccess.prototype = {
// If we have an opener, that means that the caller is expecting access
// to the nsIDOMWindow of the opened tab right away. For e10s windows,
// this means forcing the newly opened browser to be non-remote so that
// we can hand back the nsIDOMWindow. DocumentLoadListener will do the
// job of shuttling off the newly opened browser to run in the right
// process once it starts loading a URI.
// we can hand back the nsIDOMWindow. The XULBrowserWindow.shouldLoadURI
// will do the job of shuttling off the newly opened browser to run in
// the right process once it starts loading a URI.
let forceNotRemote = aOpenWindowInfo && !aOpenWindowInfo.isRemote;
let userContextId = aOpenWindowInfo
? aOpenWindowInfo.originAttributes.userContextId

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

@ -9,6 +9,11 @@
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.defineModuleGetter(
this,
"E10SUtils",
"resource://gre/modules/E10SUtils.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"BrowserUtils",
@ -37,11 +42,25 @@ var WebBrowserChrome = {
aTriggeringPrincipal,
aCsp
) {
if (!E10SUtils.shouldLoadURI(aDocShell, aURI, aHasPostData)) {
E10SUtils.redirectLoad(
aDocShell,
aURI,
aReferrerInfo,
aTriggeringPrincipal,
null,
aCsp
);
return false;
}
return true;
},
shouldLoadURIInThisProcess(aURI) {
return true;
let remoteSubframes = docShell.QueryInterface(Ci.nsILoadContext)
.useRemoteSubframes;
return E10SUtils.shouldLoadURIInThisProcess(aURI, remoteSubframes);
},
};

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

@ -28,7 +28,7 @@ add_task(async function bookmarks_toolbar_shown_on_newtab() {
);
// 2: Test that the toolbar is hidden when the browser is navigated away from newtab
BrowserTestUtils.loadURI(newtab.linkedBrowser, "https://example.com");
await BrowserTestUtils.loadURI(newtab.linkedBrowser, "https://example.com");
await BrowserTestUtils.browserLoaded(newtab.linkedBrowser);
if (featureEnabled) {
await waitForBookmarksToolbarVisibility({ visible: false });
@ -39,7 +39,7 @@ add_task(async function bookmarks_toolbar_shown_on_newtab() {
);
// 3: Re-load about:newtab in the browser for the following tests and confirm toolbar reappears
BrowserTestUtils.loadURI(newtab.linkedBrowser, "about:newtab");
await BrowserTestUtils.loadURI(newtab.linkedBrowser, "about:newtab");
await BrowserTestUtils.browserLoaded(newtab.linkedBrowser);
if (featureEnabled) {
await waitForBookmarksToolbarVisibility({ visible: true });
@ -78,7 +78,7 @@ add_task(async function bookmarks_toolbar_shown_on_newtab() {
);
// 7: Similar to #3 above, loading about:newtab in example should show toolbar
BrowserTestUtils.loadURI(example.linkedBrowser, "about:newtab");
await BrowserTestUtils.loadURI(example.linkedBrowser, "about:newtab");
await BrowserTestUtils.browserLoaded(example.linkedBrowser);
if (featureEnabled) {
await waitForBookmarksToolbarVisibility({ visible: true });
@ -109,7 +109,10 @@ add_task(async function bookmarks_toolbar_shown_on_newtab() {
await BrowserTestUtils.switchTab(gBrowser, newtab);
await waitForBookmarksToolbarVisibility({ visible: false });
ok(!isBookmarksToolbarVisible(), "Toolbar should hide with custom newtab");
BrowserTestUtils.loadURI(example.linkedBrowser, AboutNewTab.newTabURL);
await BrowserTestUtils.loadURI(
example.linkedBrowser,
AboutNewTab.newTabURL
);
await BrowserTestUtils.browserLoaded(example.linkedBrowser);
await BrowserTestUtils.switchTab(gBrowser, example);
if (featureEnabled) {

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

@ -74,7 +74,10 @@ add_task(async function notification_bar_removes_itself_on_navigation() {
"Notification should be default browser"
);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "https://example.com");
await BrowserTestUtils.loadURI(
gBrowser.selectedBrowser,
"https://example.com"
);
let notificationRemoved = await TestUtils.waitForCondition(
() =>
@ -105,7 +108,7 @@ add_task(async function notification_appears_on_first_navigation_to_homepage() {
!gBrowser.getNotificationBox(tab.linkedBrowser).currentNotification,
"a notification should not be shown on about:robots"
);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:home");
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:home");
let notification = await TestUtils.waitForCondition(
() =>

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

@ -57,7 +57,7 @@ add_task(async function checkDontShowStopFromLocalURI() {
stopReloadContainerObserver.observe(stopReloadContainer, {
attributeFilter: ["animate"],
});
BrowserTestUtils.loadURI(tab.linkedBrowser, "about:mozilla");
await BrowserTestUtils.loadURI(tab.linkedBrowser, "about:mozilla");
BrowserTestUtils.removeTab(tab);
Assert.ok(
@ -82,7 +82,7 @@ add_task(async function checkDontShowStopFromNonLocalURI() {
stopReloadContainerObserver.observe(stopReloadContainer, {
attributeFilter: ["animate"],
});
BrowserTestUtils.loadURI(tab.linkedBrowser, "about:mozilla");
await BrowserTestUtils.loadURI(tab.linkedBrowser, "about:mozilla");
BrowserTestUtils.removeTab(tab);
Assert.ok(
@ -132,7 +132,7 @@ add_task(async function checkAnimateStopOnTabAfterTabFinishesOpening() {
return !gBrowser.tabAnimationsInProgress;
});
let animatePromise = getAnimatePromise(stopReloadContainer);
BrowserTestUtils.loadURI(tab.linkedBrowser, "https://example.com");
await BrowserTestUtils.loadURI(tab.linkedBrowser, "https://example.com");
await animatePromise;
BrowserTestUtils.removeTab(tab);
@ -158,7 +158,7 @@ add_task(async function checkDoShowStopFromLocalURI() {
return !gBrowser.tabAnimationsInProgress;
});
let animatePromise = getAnimatePromise(stopReloadContainer);
BrowserTestUtils.loadURI(tab.linkedBrowser, "https://example.com");
await BrowserTestUtils.loadURI(tab.linkedBrowser, "https://example.com");
await animatePromise;
await waitForNoAnimation(stopReloadContainer);
BrowserTestUtils.removeTab(tab);

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

@ -21,7 +21,7 @@ add_task(async function checkSwitchPageToOnlineMode() {
await BrowserTestUtils.withNewTab("about:blank", async function(browser) {
let netErrorLoaded = BrowserTestUtils.waitForErrorPage(browser);
BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.loadURI(browser, "http://example.com/");
await netErrorLoaded;
// Re-enable the proxy so example.com is resolved to localhost, rather than

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

@ -20,7 +20,7 @@ async function rightClickOpenInNewTabAndReturnContent(selector) {
false,
RESOURCE_LINK
);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, RESOURCE_LINK);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, RESOURCE_LINK);
await loaded;
const generatedBlobURL = await ContentTask.spawn(
@ -97,7 +97,7 @@ async function openInNewTabAndReturnContent(selector) {
false,
RESOURCE_LINK
);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, RESOURCE_LINK);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, RESOURCE_LINK);
await loaded;
const generatedBlobURL = await ContentTask.spawn(

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

@ -904,7 +904,7 @@ add_task(async function test_large_popup_in_small_window() {
let browserLoadedPromise = BrowserTestUtils.browserLoaded(
newWin.gBrowser.selectedBrowser
);
BrowserTestUtils.loadURI(newWin.gBrowser.selectedBrowser, pageUrl);
await BrowserTestUtils.loadURI(newWin.gBrowser.selectedBrowser, pageUrl);
await browserLoadedPromise;
newWin.gBrowser.selectedBrowser.focus();

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

@ -8,8 +8,7 @@ const URIS = ["about:blank", "about:sessionrestore", "about:privatebrowsing"];
add_task(async function() {
for (let uri of URIS) {
let tab = BrowserTestUtils.addTab(gBrowser);
BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
await BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
let win = gBrowser.replaceTabWithWindow(tab);

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

@ -22,11 +22,11 @@ add_task(async function test_newtab() {
async function(browser) {
// Can't load it directly because that'll use a preloaded tab if present.
let stopped = BrowserTestUtils.browserStopped(browser, "about:newtab");
BrowserTestUtils.loadURI(browser, "about:newtab");
await BrowserTestUtils.loadURI(browser, "about:newtab");
await stopped;
stopped = BrowserTestUtils.browserStopped(browser, "http://example.com/");
BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.loadURI(browser, "http://example.com/");
await stopped;
// This makes sure the parent process has the most up-to-date notion

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

@ -34,7 +34,7 @@ add_task(async function test_menu() {
false
);
let browser = tab.linkedBrowser;
BrowserTestUtils.loadURI(browser, WEB_ROOT + "page_style_sample.html");
await BrowserTestUtils.loadURI(browser, WEB_ROOT + "page_style_sample.html");
await promiseStylesheetsLoaded(tab, 17);
let menuitems = fillPopupAndGetItems();

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

@ -14,7 +14,7 @@ add_task(async function() {
false
);
let browser = tab.linkedBrowser;
BrowserTestUtils.loadURI(browser, PAGE);
await BrowserTestUtils.loadURI(browser, PAGE);
await promiseStylesheetsLoaded(tab, 17);
let menupopup = document.getElementById("pageStyleMenu").menupopup;

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

@ -377,7 +377,7 @@ function promiseOnBookmarkItemAdded(aExpectedURI) {
async function loadBadCertPage(url) {
let loaded = BrowserTestUtils.waitForErrorPage(gBrowser.selectedBrowser);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
await loaded;
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function() {

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

@ -264,7 +264,7 @@ add_task(async function navigate_around() {
for (let i = 0; i < 50; i++) {
let url = urls[i % urls.length];
info(`Navigating to ${url}...`);
BrowserTestUtils.loadURI(tab.linkedBrowser, url);
await BrowserTestUtils.loadURI(tab.linkedBrowser, url);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, url);
info(`Loaded ${url}.`);
}

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

@ -42,6 +42,7 @@ const known_scripts = {
"resource:///actors/PageStyleChild.jsm",
"resource:///actors/SearchTelemetryChild.jsm",
"resource://gre/modules/ActorManagerChild.jsm",
"resource://gre/modules/E10SUtils.jsm",
"resource://gre/modules/Readerable.jsm",
// Telemetry

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

@ -208,7 +208,7 @@ add_task(async function testBFCache() {
Services.prefs.setIntPref(AUTOPLAY_PREF, Ci.nsIAutoplay.BLOCKED);
await BrowserTestUtils.withNewTab("about:home", async function(browser) {
BrowserTestUtils.loadURI(browser, AUTOPLAY_PAGE);
await BrowserTestUtils.loadURI(browser, AUTOPLAY_PAGE);
await blockedIconShown();
gBrowser.goBack();
@ -255,7 +255,7 @@ add_task(async function testChangingBlockingSettingDuringNavigation() {
await BrowserTestUtils.withNewTab("about:home", async function(browser) {
await blockedIconHidden();
BrowserTestUtils.loadURI(browser, AUTOPLAY_PAGE);
await BrowserTestUtils.loadURI(browser, AUTOPLAY_PAGE);
await blockedIconShown();
Services.prefs.setIntPref(AUTOPLAY_PREF, Ci.nsIAutoplay.ALLOWED);
@ -308,7 +308,7 @@ add_task(async function testBlockedAll() {
await BrowserTestUtils.withNewTab("about:home", async function(browser) {
await blockedIconHidden();
BrowserTestUtils.loadURI(browser, MUTED_AUTOPLAY_PAGE);
await BrowserTestUtils.loadURI(browser, MUTED_AUTOPLAY_PAGE);
await blockedIconShown();
await openIdentityPopup();

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

@ -46,7 +46,7 @@ add_task(async function() {
await BrowserTestUtils.withNewTab("about:blank", async function(browser) {
// Try deprecated versions
BrowserTestUtils.loadURI(browser, HTTPS_TLS1_0);
await BrowserTestUtils.loadURI(browser, HTTPS_TLS1_0);
await BrowserTestUtils.browserLoaded(browser);
isSecurityState(browser, "broken");
is(
@ -56,7 +56,7 @@ add_task(async function() {
);
await checkConnectionState("not-secure");
BrowserTestUtils.loadURI(browser, HTTPS_TLS1_1);
await BrowserTestUtils.loadURI(browser, HTTPS_TLS1_1);
await BrowserTestUtils.browserLoaded(browser);
isSecurityState(browser, "broken");
is(
@ -67,14 +67,14 @@ add_task(async function() {
await checkConnectionState("not-secure");
// Transition to secure
BrowserTestUtils.loadURI(browser, HTTPS_TLS1_2);
await BrowserTestUtils.loadURI(browser, HTTPS_TLS1_2);
await BrowserTestUtils.browserLoaded(browser);
isSecurityState(browser, "secure");
is(getIdentityMode(), "verifiedDomain", "Identity should be verified");
await checkConnectionState("secure");
// Transition back to broken
BrowserTestUtils.loadURI(browser, HTTPS_TLS1_1);
await BrowserTestUtils.loadURI(browser, HTTPS_TLS1_1);
await BrowserTestUtils.browserLoaded(browser);
isSecurityState(browser, "broken");
is(
@ -85,7 +85,7 @@ add_task(async function() {
await checkConnectionState("not-secure");
// TLS1.3 for completeness
BrowserTestUtils.loadURI(browser, HTTPS_TLS1_3);
await BrowserTestUtils.loadURI(browser, HTTPS_TLS1_3);
await BrowserTestUtils.browserLoaded(browser);
isSecurityState(browser, "secure");
is(getIdentityMode(), "verifiedDomain", "Identity should be verified");

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

@ -14,7 +14,7 @@ const IFRAME_PAGE =
add_task(async function test() {
await BrowserTestUtils.withNewTab("about:blank", async function(browser) {
let loaded = BrowserTestUtils.waitForErrorPage(browser);
BrowserTestUtils.loadURI(browser, "https://self-signed.example.com");
await BrowserTestUtils.loadURI(browser, "https://self-signed.example.com");
await loaded;
let securityInfo = await browser.browsingContext.currentWindowGlobal.getSecurityInfo();
@ -33,14 +33,14 @@ add_task(async function test() {
);
loaded = BrowserTestUtils.browserLoaded(browser);
BrowserTestUtils.loadURI(browser, "http://example.com");
await BrowserTestUtils.loadURI(browser, "http://example.com");
await loaded;
securityInfo = await browser.browsingContext.currentWindowGlobal.getSecurityInfo();
ok(!securityInfo, "Found no security info");
loaded = BrowserTestUtils.browserLoaded(browser);
BrowserTestUtils.loadURI(browser, "https://example.com");
await BrowserTestUtils.loadURI(browser, "https://example.com");
await loaded;
securityInfo = await browser.browsingContext.currentWindowGlobal.getSecurityInfo();
@ -55,7 +55,7 @@ add_task(async function test() {
);
loaded = BrowserTestUtils.browserLoaded(browser);
BrowserTestUtils.loadURI(browser, IFRAME_PAGE);
await BrowserTestUtils.loadURI(browser, IFRAME_PAGE);
await loaded;
// Get the info of the parent, which is HTTP.

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

@ -38,7 +38,7 @@ add_task(async function() {
// Navigation from an http page to a https page with no mixed content
// The http page loads an http image on unload
url = HTTPS_TEST_ROOT_1 + "file_mixedContentFromOnunload_test1.html";
BrowserTestUtils.loadURI(browser, url);
await BrowserTestUtils.loadURI(browser, url);
await BrowserTestUtils.browserLoaded(browser);
// check security state. Since current url is https and doesn't have any
// mixed content resources, we expect it to be secure.
@ -51,10 +51,10 @@ add_task(async function() {
// Navigation from an http page to a https page that has mixed display content
// The https page loads an http image on unload
url = HTTP_TEST_ROOT_2 + "file_mixedContentFromOnunload.html";
BrowserTestUtils.loadURI(browser, url);
await BrowserTestUtils.loadURI(browser, url);
await BrowserTestUtils.browserLoaded(browser);
url = HTTPS_TEST_ROOT_2 + "file_mixedContentFromOnunload_test2.html";
BrowserTestUtils.loadURI(browser, url);
await BrowserTestUtils.loadURI(browser, url);
await BrowserTestUtils.browserLoaded(browser);
isSecurityState(browser, "broken");
await assertMixedContentBlockingState(browser, {

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

@ -52,7 +52,7 @@ add_task(async function() {
checkIdentityPopup("connection-mixed-active-loaded.svg");
// check that a warning is shown even without mixed content
BrowserTestUtils.loadURI(
await BrowserTestUtils.loadURI(
gBrowser.selectedBrowser,
"https://self-signed.example.com"
);

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

@ -49,7 +49,7 @@ async function run_testcase(testcase) {
// seem to work with withNewTab.
await BrowserTestUtils.withNewTab("about:blank", async browser => {
// Navigate to the test URI.
BrowserTestUtils.loadURI(browser, testcase.uri);
await BrowserTestUtils.loadURI(browser, testcase.uri);
if (!testcase.expectErrorPage) {
await BrowserTestUtils.browserLoaded(browser, false, testcase.uri);
} else {
@ -62,7 +62,7 @@ async function run_testcase(testcase) {
);
// Navigate to a URI that should be secure.
BrowserTestUtils.loadURI(browser, kSecureURI);
await BrowserTestUtils.loadURI(browser, kSecureURI);
await BrowserTestUtils.browserLoaded(browser, false, kSecureURI);
let secureIdentityMode = window.document.getElementById("identity-box")
.className;
@ -91,7 +91,7 @@ async function run_testcase(testcase) {
is(secureIdentityMode, "verifiedDomain", "identity should start as secure");
// Navigate to the test URI.
BrowserTestUtils.loadURI(browser, testcase.uri);
await BrowserTestUtils.loadURI(browser, testcase.uri);
if (!testcase.expectErrorPage) {
await BrowserTestUtils.browserLoaded(browser, false, testcase.uri);
} else {

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

@ -402,7 +402,7 @@ async function assertMixedContentBlockingState(tabbrowser, states = {}) {
async function loadBadCertPage(url) {
let loaded = BrowserTestUtils.waitForErrorPage(gBrowser.selectedBrowser);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
await loaded;
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function() {

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

@ -62,7 +62,7 @@ add_task(async function testSoundIndicatorShouldDisappearAfterTabNavigation() {
await waitForTabSoundIndicatorAppears(tab);
info(`sound indicator should disappear after navigating tab to blank page`);
BrowserTestUtils.loadURI(tab.linkedBrowser, "about:blank");
await BrowserTestUtils.loadURI(tab.linkedBrowser, "about:blank");
await waitForTabSoundIndicatorDisappears(tab);
info("remove tab");

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

@ -14,7 +14,7 @@ add_task(async function() {
let win = await BrowserTestUtils.openNewBrowserWindow();
let browser = win.gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.loadURI(browser, "http://example.com/");
await SpecialPowers.spawn(browser, [], () => {
// eslint-disable-next-line mozilla/balanced-listeners

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

@ -121,7 +121,7 @@ var TRANSITIONS = [
// Loads the new page by calling browser.loadURI directly
async function loadURI(browser, uri) {
info("Calling browser.loadURI");
BrowserTestUtils.loadURI(browser, uri);
await BrowserTestUtils.loadURI(browser, uri);
return true;
},

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

@ -356,7 +356,18 @@ add_task(async function test_synchronous() {
info("2");
// Load another page
info("Loading about:robots");
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:robots");
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:robots");
is(
gBrowser.selectedBrowser.isRemoteBrowser,
false,
"Remote attribute should be correct"
);
is(
gBrowser.selectedBrowser.permanentKey,
permanentKey,
"browser.permanentKey is still the same"
);
await BrowserTestUtils.browserStopped(gBrowser);
is(
gBrowser.selectedBrowser.isRemoteBrowser,
@ -372,10 +383,21 @@ add_task(async function test_synchronous() {
info("3");
// Load the remote page again
info("Loading http://example.org/" + DUMMY_PATH);
BrowserTestUtils.loadURI(
await BrowserTestUtils.loadURI(
gBrowser.selectedBrowser,
"http://example.org/" + DUMMY_PATH
);
is(
gBrowser.selectedBrowser.isRemoteBrowser,
expectedRemote,
"Remote attribute should be correct"
);
is(
gBrowser.selectedBrowser.permanentKey,
permanentKey,
"browser.permanentKey is still the same"
);
await BrowserTestUtils.browserStopped(gBrowser);
is(
gBrowser.selectedBrowser.isRemoteBrowser,

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

@ -39,7 +39,7 @@ add_task(async function() {
false,
"http://example.com/"
);
BrowserTestUtils.loadURI(appTab.linkedBrowser, "http://example.com/");
await BrowserTestUtils.loadURI(appTab.linkedBrowser, "http://example.com/");
info("Started loading example.com");
await pageLoadPromise;
info("Loaded example.com");

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

@ -219,7 +219,7 @@ async function promiseTabLoadEvent(tab, url) {
let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, handle);
if (url) {
BrowserTestUtils.loadURI(tab.linkedBrowser, url);
await BrowserTestUtils.loadURI(tab.linkedBrowser, url);
}
return loaded;

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

@ -662,8 +662,7 @@ add_task(async function browseraction_contextmenu_report_extension() {
await customizationReady;
} else {
info("Navigate the about:addons tab to about:blank");
BrowserTestUtils.loadURI(browser, "about:blank");
await BrowserTestUtils.browserLoaded(browser);
await BrowserTestUtils.loadURI(browser, "about:blank");
}
return menu;

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

@ -288,7 +288,10 @@ add_task(async function testBrowserActionTabPopulation() {
});
let win = await BrowserTestUtils.openNewBrowserWindow();
BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser, "http://example.com/");
await BrowserTestUtils.loadURI(
win.gBrowser.selectedBrowser,
"http://example.com/"
);
await BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser);
// Make sure the mouse isn't hovering over the browserAction widget.

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

@ -185,7 +185,7 @@ add_task(async function test_user_defined_commands() {
// Create a window before the extension is loaded.
let win1 = await BrowserTestUtils.openNewBrowserWindow();
BrowserTestUtils.loadURI(win1.gBrowser.selectedBrowser, "about:robots");
await BrowserTestUtils.loadURI(win1.gBrowser.selectedBrowser, "about:robots");
await BrowserTestUtils.browserLoaded(win1.gBrowser.selectedBrowser);
// We would have previously focused the window's content area after the
@ -269,7 +269,7 @@ add_task(async function test_user_defined_commands() {
// Create another window after the extension is loaded.
let win2 = await BrowserTestUtils.openNewBrowserWindow();
BrowserTestUtils.loadURI(win2.gBrowser.selectedBrowser, "about:robots");
await BrowserTestUtils.loadURI(win2.gBrowser.selectedBrowser, "about:robots");
await BrowserTestUtils.browserLoaded(win2.gBrowser.selectedBrowser);
// See comment above.
@ -309,7 +309,10 @@ add_task(async function test_user_defined_commands() {
let privateWin = await BrowserTestUtils.openNewBrowserWindow({
private: true,
});
BrowserTestUtils.loadURI(privateWin.gBrowser.selectedBrowser, "about:robots");
await BrowserTestUtils.loadURI(
privateWin.gBrowser.selectedBrowser,
"about:robots"
);
await BrowserTestUtils.browserLoaded(privateWin.gBrowser.selectedBrowser);
// See comment above.

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

@ -62,10 +62,10 @@ add_task(async function() {
await focusWindow(win2);
BrowserTestUtils.loadURI(win1.gBrowser.selectedBrowser, "about:robots");
await BrowserTestUtils.loadURI(win1.gBrowser.selectedBrowser, "about:robots");
await BrowserTestUtils.browserLoaded(win1.gBrowser.selectedBrowser);
BrowserTestUtils.loadURI(win2.gBrowser.selectedBrowser, "about:config");
await BrowserTestUtils.loadURI(win2.gBrowser.selectedBrowser, "about:config");
await BrowserTestUtils.browserLoaded(win2.gBrowser.selectedBrowser);
let extension = ExtensionTestUtils.loadExtension({

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

@ -29,7 +29,7 @@ async function navigateTo(uri, tab, toolbox, extension) {
const originalTabId = await getCurrentTabId(extension);
const onSwitched = toolbox.targetList.once("switched-target");
BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
await BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
await onSwitched;
const currentTabId = await getCurrentTabId(extension);

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

@ -14,7 +14,7 @@ const CONTENT_PROCESS_PAGE = "http://example.com/";
async function testOnNavigatedEvent(uri, tab, toolbox, extension) {
const onNavigated = extension.awaitMessage("network-onNavigated");
const onSwitched = toolbox.targetList.once("switched-target");
BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
await BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
await onSwitched;
const result = await onNavigated;
is(result, uri, "devtools.network.onNavigated works correctly");

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

@ -407,7 +407,7 @@ add_task(async function testIncognitoFind() {
let privateWin = await BrowserTestUtils.openNewBrowserWindow({
private: true,
});
BrowserTestUtils.loadURI(
await BrowserTestUtils.loadURI(
privateWin.gBrowser.selectedBrowser,
"http://example.com"
);
@ -446,7 +446,7 @@ add_task(async function testIncognitoFindAllowed() {
let privateWin = await BrowserTestUtils.openNewBrowserWindow({
private: true,
});
BrowserTestUtils.loadURI(privateWin.gBrowser.selectedBrowser, url);
await BrowserTestUtils.loadURI(privateWin.gBrowser.selectedBrowser, url);
await BrowserTestUtils.browserLoaded(privateWin.gBrowser.selectedBrowser);
let extension = ExtensionTestUtils.loadExtension({

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

@ -403,7 +403,7 @@ add_task(async function refresh_menus_during_navigation() {
elem = extension.getXULElementByMenuId("item2");
is(elem, null, "menu item 2 should be hidden");
BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE + "?2");
await BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE + "?2");
await BrowserTestUtils.browserStopped(tab.linkedBrowser);
await extension.callMenuApi("refresh");

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

@ -9,7 +9,7 @@ loadTestSubscript("head_sessions.js");
add_task(async function test_sessions_get_recently_closed() {
async function openAndCloseWindow(url = "http://example.com", tabUrls) {
let win = await BrowserTestUtils.openNewBrowserWindow();
BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser, url);
await BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser, url);
await BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser);
if (tabUrls) {
for (let url of tabUrls) {
@ -145,7 +145,7 @@ add_task(async function test_sessions_get_recently_closed_navigated() {
// Test with a window with navigation history.
let win = await BrowserTestUtils.openNewBrowserWindow();
for (let url of ["about:robots", "about:mozilla", "http://example.com/"]) {
BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser, url);
await BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser, url);
await BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser);
}

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

@ -53,7 +53,7 @@ add_task(async function test_sessions_get_recently_closed_tabs() {
let win = await BrowserTestUtils.openNewBrowserWindow();
let tabBrowser = win.gBrowser.selectedBrowser;
for (let url of ["about:robots", "about:mozilla", "about:config"]) {
BrowserTestUtils.loadURI(tabBrowser, url);
await BrowserTestUtils.loadURI(tabBrowser, url);
await BrowserTestUtils.browserLoaded(tabBrowser, false, url);
}

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

@ -87,7 +87,7 @@ add_task(async function test_sessions_restore() {
await extension.awaitMessage("ready");
let win = await BrowserTestUtils.openNewBrowserWindow();
BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser, "about:config");
await BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser, "about:config");
await BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser);
for (let url of ["about:robots", "about:mozilla"]) {
await BrowserTestUtils.openNewForegroundTab(win.gBrowser, url);

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

@ -171,7 +171,7 @@ add_task(async function test_update_reload() {
let win = await BrowserTestUtils.openNewBrowserWindow();
let tabBrowser = win.gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(tabBrowser, URL);
await BrowserTestUtils.loadURI(tabBrowser, URL);
await BrowserTestUtils.browserLoaded(tabBrowser, false, URL);
let tab = win.gBrowser.selectedTab;

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

@ -191,7 +191,7 @@ add_task(async function testWindowTitle() {
let promiseLoaded = BrowserTestUtils.browserLoaded(
realWin.gBrowser.selectedBrowser
);
BrowserTestUtils.loadURI(realWin.gBrowser.selectedBrowser, NEW_URL);
await BrowserTestUtils.loadURI(realWin.gBrowser.selectedBrowser, NEW_URL);
await promiseLoaded;
await verifyTitle(
realWin,

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

@ -62,7 +62,10 @@ add_task(async function test_About_Welcome_Location_Change() {
aboutWelcomeActor.AboutWelcomeObserver,
"AboutWelcomeObserver is not null"
);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "http://example.com/#foo");
await BrowserTestUtils.loadURI(
gBrowser.selectedBrowser,
"http://example.com/#foo"
);
await BrowserTestUtils.waitForLocationChange(
gBrowser,
"http://example.com/#foo"

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

@ -220,7 +220,7 @@ add_task(async function setup() {
add_task(async function test_cfr_notification_show() {
// addRecommendation checks that scheme starts with http and host matches
let browser = gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.browserLoaded(browser, false, "http://example.com/");
const response = await trigger_cfr_panel(browser, "example.com");
@ -274,7 +274,7 @@ add_task(async function test_cfr_notification_show() {
add_task(async function test_cfr_notification_show() {
// addRecommendation checks that scheme starts with http and host matches
let browser = gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.browserLoaded(browser, false, "http://example.com/");
let response = await trigger_cfr_panel(browser, "example.com", {
@ -340,7 +340,7 @@ add_task(async function test_cfr_notification_show() {
add_task(async function test_cfr_notification_minimize() {
// addRecommendation checks that scheme starts with http and host matches
let browser = gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.browserLoaded(browser, false, "http://example.com/");
let response = await trigger_cfr_panel(browser, "example.com");
@ -387,7 +387,7 @@ add_task(async function test_cfr_notification_minimize() {
add_task(async function test_cfr_notification_minimize_2() {
// addRecommendation checks that scheme starts with http and host matches
let browser = gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.browserLoaded(browser, false, "http://example.com/");
let response = await trigger_cfr_panel(browser, "example.com");
@ -449,7 +449,7 @@ add_task(async function test_cfr_notification_minimize_2() {
add_task(async function test_cfr_addon_install() {
// addRecommendation checks that scheme starts with http and host matches
const browser = gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.browserLoaded(browser, false, "http://example.com/");
const response = await trigger_cfr_panel(browser, "example.com", {
@ -508,7 +508,7 @@ add_task(async function test_cfr_addon_install() {
add_task(async function test_cfr_pin_tab_notification_show() {
// addRecommendation checks that scheme starts with http and host matches
let browser = gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.browserLoaded(browser, false, "http://example.com/");
const response = await trigger_cfr_panel(browser, "example.com", {
@ -564,7 +564,7 @@ add_task(
async function test_cfr_social_tracking_protection_notification_show() {
// addRecommendation checks that scheme starts with http and host matches
let browser = gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.browserLoaded(browser, false, "http://example.com/");
const showPanel = BrowserTestUtils.waitForEvent(
@ -617,7 +617,7 @@ add_task(
// addRecommendation checks that scheme starts with http and host matches
let browser = gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.browserLoaded(browser, false, "http://example.com/");
const showPanel = BrowserTestUtils.waitForEvent(
@ -680,7 +680,7 @@ add_task(
// addRecommendation checks that scheme starts with http and host matches
let browser = gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.browserLoaded(browser, false, "http://example.com/");
const showPanel = BrowserTestUtils.waitForEvent(
@ -730,7 +730,7 @@ add_task(
add_task(async function test_cfr_features_and_addon_show() {
// addRecommendation checks that scheme starts with http and host matches
let browser = gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.browserLoaded(browser, false, "http://example.com/");
// Trigger Feature CFR
@ -821,7 +821,7 @@ add_task(async function test_cfr_features_and_addon_show() {
add_task(async function test_cfr_addon_and_features_show() {
// addRecommendation checks that scheme starts with http and host matches
let browser = gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.browserLoaded(browser, false, "http://example.com/");
// Trigger Feature CFR
@ -919,17 +919,17 @@ add_task(async function test_onLocationChange_cb() {
"example.com",
]);
BrowserTestUtils.loadURI(browser, "about:blank");
await BrowserTestUtils.loadURI(browser, "about:blank");
await BrowserTestUtils.browserLoaded(browser, false, "about:blank");
BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.browserLoaded(browser, false, "http://example.com/");
Assert.equal(count, 1, "Count navigation to example.com");
// Anchor scroll triggers a location change event with the same document
// https://searchfox.org/mozilla-central/rev/8848b9741fc4ee4e9bc3ae83ea0fc048da39979f/uriloader/base/nsIWebProgressListener.idl#400-403
BrowserTestUtils.loadURI(browser, "http://example.com/#foo");
await BrowserTestUtils.loadURI(browser, "http://example.com/#foo");
await BrowserTestUtils.waitForLocationChange(
gBrowser,
"http://example.com/#foo"
@ -937,7 +937,7 @@ add_task(async function test_onLocationChange_cb() {
Assert.equal(count, 1, "It should ignore same page navigation");
BrowserTestUtils.loadURI(browser, TEST_URL);
await BrowserTestUtils.loadURI(browser, TEST_URL);
await BrowserTestUtils.browserLoaded(browser, false, TEST_URL);
Assert.equal(count, 2, "We moved to a new document");
@ -954,7 +954,7 @@ add_task(async function test_matchPattern() {
await frequentVisitsTrigger.init(triggerHandler, [], ["*://*.example.com/"]);
const browser = gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.browserLoaded(browser, false, "http://example.com/");
await BrowserTestUtils.waitForCondition(
@ -962,7 +962,7 @@ add_task(async function test_matchPattern() {
"Registered pattern matched the current location"
);
BrowserTestUtils.loadURI(browser, "about:config");
await BrowserTestUtils.loadURI(browser, "about:config");
await BrowserTestUtils.browserLoaded(browser, false, "about:config");
await BrowserTestUtils.waitForCondition(
@ -970,7 +970,7 @@ add_task(async function test_matchPattern() {
"Navigated to a new page but not a match"
);
BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.browserLoaded(browser, false, "http://example.com/");
await BrowserTestUtils.waitForCondition(
@ -978,7 +978,7 @@ add_task(async function test_matchPattern() {
"Navigated to a location that matches the pattern but within 15 mins"
);
BrowserTestUtils.loadURI(browser, "http://www.example.com/");
await BrowserTestUtils.loadURI(browser, "http://www.example.com/");
await BrowserTestUtils.browserLoaded(
browser,
false,
@ -1019,7 +1019,7 @@ add_task(async function test_providerNames() {
add_task(async function test_cfr_notification_keyboard() {
// addRecommendation checks that scheme starts with http and host matches
const browser = gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.loadURI(browser, "http://example.com/");
await BrowserTestUtils.browserLoaded(browser, false, "http://example.com/");
const response = await trigger_cfr_panel(browser, "example.com");

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

@ -119,7 +119,7 @@ add_task(async function test_heartbeat_tactic_2() {
Assert.ok(groupState.enabled, "Group is enabled");
let tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URL);
BrowserTestUtils.loadURI(tab1.linkedBrowser, TEST_URL);
await BrowserTestUtils.loadURI(tab1.linkedBrowser, TEST_URL);
let chiclet = document.getElementById("contextual-feature-recommendation");
Assert.ok(chiclet, "CFR chiclet element found (tab1)");
@ -138,7 +138,7 @@ add_task(async function test_heartbeat_tactic_2() {
BrowserTestUtils.removeTab(tab1);
let tab2 = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URL);
BrowserTestUtils.loadURI(tab2.linkedBrowser, TEST_URL);
await BrowserTestUtils.loadURI(tab2.linkedBrowser, TEST_URL);
Assert.ok(chiclet, "CFR chiclet element found (tab2)");
await BrowserTestUtils.waitForCondition(
@ -161,7 +161,7 @@ add_task(async function test_heartbeat_tactic_2() {
BrowserTestUtils.removeTab(tab2);
let tab3 = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URL);
BrowserTestUtils.loadURI(tab3.linkedBrowser, TEST_URL);
await BrowserTestUtils.loadURI(tab3.linkedBrowser, TEST_URL);
await BrowserTestUtils.waitForCondition(
() => chiclet.hidden,

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

@ -113,7 +113,7 @@ add_task(async function test_heartbeat_tactic_2() {
Assert.ok(ASRouter.isUnblockedMessage(msg), "Message is unblocked");
let tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URL);
BrowserTestUtils.loadURI(tab1.linkedBrowser, TEST_URL);
await BrowserTestUtils.loadURI(tab1.linkedBrowser, TEST_URL);
let chiclet = document.getElementById("contextual-feature-recommendation");
Assert.ok(chiclet, "CFR chiclet element found");
@ -135,7 +135,7 @@ add_task(async function test_heartbeat_tactic_2() {
);
let tab2 = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URL);
BrowserTestUtils.loadURI(tab2.linkedBrowser, TEST_URL);
await BrowserTestUtils.loadURI(tab2.linkedBrowser, TEST_URL);
await BrowserTestUtils.waitForCondition(
() => chiclet.hidden,

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

@ -98,7 +98,7 @@ async function waitForPreloaded(browser) {
// eslint-disable-next-line no-unused-vars
async function waitForUrlLoad(url) {
let browser = gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(browser, url);
await BrowserTestUtils.loadURI(browser, url);
await BrowserTestUtils.browserLoaded(browser, false, url);
}

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

@ -868,19 +868,13 @@ add_task(async function testContentBlockingReloadWarning() {
// if it is the only tab.
add_task(async function testContentBlockingReloadWarningSingleTab() {
Services.prefs.setStringPref(CAT_PREF, "standard");
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, PRIVACY_PAGE);
await BrowserTestUtils.browserLoaded(
gBrowser.selectedBrowser,
false,
PRIVACY_PAGE
);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, PRIVACY_PAGE);
let reloadWarnings = [
...gBrowser.contentDocument.querySelectorAll(
".content-blocking-warning.reload-tabs"
),
];
ok(reloadWarnings.length, "must have at least one reload warning");
ok(
reloadWarnings.every(el => el.hidden),
"all of the warnings to reload tabs are initially hidden"
@ -895,8 +889,7 @@ add_task(async function testContentBlockingReloadWarningSingleTab() {
"all of the warnings to reload tabs are still hidden"
);
Services.prefs.setStringPref(CAT_PREF, "standard");
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:newtab");
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:newtab");
});
// Checks that the reload tabs message reloads all tabs except the active tab.

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

@ -13,7 +13,7 @@ add_task(async function test() {
false,
BASE_URI
);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, BASE_URI);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, BASE_URI);
await loaded;
let blobURL;
@ -42,7 +42,7 @@ add_task(async function test() {
false,
BASE_URI
);
BrowserTestUtils.loadURI(privateTab, BASE_URI);
await BrowserTestUtils.loadURI(privateTab, BASE_URI);
await privateTabLoaded;
await SpecialPowers.spawn(privateTab, [blobURL], function(url) {

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

@ -37,7 +37,7 @@ add_task(async function test_private_popup_window_opens_private_tabs() {
// First, open a private browsing window, and load our
// testing page.
let privBrowser = privWin.gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(privBrowser, WINDOW_BODY);
await BrowserTestUtils.loadURI(privBrowser, WINDOW_BODY);
await BrowserTestUtils.browserLoaded(privBrowser);
// Next, click on the link in the testing page, and ensure

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

@ -35,7 +35,7 @@ add_task(async function test() {
async function testTabTitle(aWindow, url, insidePB, expected_title) {
let tab = await BrowserTestUtils.openNewForegroundTab(aWindow.gBrowser);
BrowserTestUtils.loadURI(tab.linkedBrowser, url);
await BrowserTestUtils.loadURI(tab.linkedBrowser, url);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
await BrowserTestUtils.waitForCondition(() => {

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

@ -19,19 +19,21 @@ add_task(async function test() {
});
}
async function promiseTestReady(aIsZoomedWindow, aWindow) {
function promiseTestReady(aIsZoomedWindow, aWindow) {
// Need to wait on two things, the ordering of which is not guaranteed:
// (1) the page load, and (2) FullZoom's update to the new page's zoom
// level. FullZoom broadcasts "browser-fullZoom:location-change" when its
// update is done. (See bug 856366 for details.)
let browser = aWindow.gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(browser, "about:blank");
await Promise.all([
BrowserTestUtils.browserLoaded(browser),
promiseLocationChange(),
]);
doTest(aIsZoomedWindow, aWindow);
return BrowserTestUtils.loadURI(browser, "about:blank")
.then(() => {
return Promise.all([
BrowserTestUtils.browserLoaded(browser),
promiseLocationChange(),
]);
})
.then(() => doTest(aIsZoomedWindow, aWindow));
}
function doTest(aIsZoomedWindow, aWindow) {

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

@ -216,7 +216,7 @@ add_task(async function test_track_ad_new_window() {
let win = await BrowserTestUtils.openNewBrowserWindow();
let url = getSERPUrl(getPageUrl(false, true));
BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser, url);
await BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser, url);
await BrowserTestUtils.browserLoaded(
win.gBrowser.selectedBrowser,
false,

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

@ -18,6 +18,11 @@ ChromeUtils.defineModuleGetter(
"Utils",
"resource://gre/modules/sessionstore/Utils.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"E10SUtils",
"resource://gre/modules/E10SUtils.jsm"
);
/**
* This module implements the content side of session restoration. The chrome
* side is handled by SessionStore.jsm. The functions in this module are called
@ -249,12 +254,56 @@ ContentRestoreInternal.prototype = {
if (loadArguments) {
// If the load was started in another process, and the in-flight channel
// was redirected into this process, resume that load within our process.
//
// NOTE: In this case `isRemotenessUpdate` must be true.
webNavigation.resumeRedirectedLoad(
loadArguments.redirectLoadSwitchId,
loadArguments.redirectHistoryIndex
if (loadArguments.redirectLoadSwitchId) {
webNavigation.resumeRedirectedLoad(
loadArguments.redirectLoadSwitchId,
loadArguments.redirectHistoryIndex
);
return true;
}
// A load has been redirected to a new process so get history into the
// same state it was before the load started then trigger the load.
// Referrer information is now stored as a referrerInfo property. We
// should also cope with the old format of passing `referrer` and
// `referrerPolicy` separately.
let referrerInfo = loadArguments.referrerInfo;
if (referrerInfo) {
referrerInfo = E10SUtils.deserializeReferrerInfo(referrerInfo);
} else {
let referrer = loadArguments.referrer
? Services.io.newURI(loadArguments.referrer)
: null;
let referrerPolicy =
"referrerPolicy" in loadArguments
? loadArguments.referrerPolicy
: Ci.nsIReferrerInfo.EMPTY;
let ReferrerInfo = Components.Constructor(
"@mozilla.org/referrer-info;1",
"nsIReferrerInfo",
"init"
);
referrerInfo = new ReferrerInfo(referrerPolicy, true, referrer);
}
let postData = loadArguments.postData
? E10SUtils.makeInputStream(loadArguments.postData)
: null;
let triggeringPrincipal = E10SUtils.deserializePrincipal(
loadArguments.triggeringPrincipal,
() => Services.scriptSecurityManager.createNullPrincipal({})
);
let csp = loadArguments.csp
? E10SUtils.deserializeCSP(loadArguments.csp)
: null;
let loadURIOptions = {
triggeringPrincipal,
loadFlags: loadArguments.flags,
referrerInfo,
postData,
csp,
};
webNavigation.loadURI(loadArguments.uri, loadURIOptions);
} else if (tabData.userTypedValue && tabData.userTypedClear) {
// If the user typed a URL into the URL bar and hit enter right before
// we crashed, we want to start loading that page again. A non-zero

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

@ -13,6 +13,7 @@ const TAB_CUSTOM_VALUES = new WeakMap();
const TAB_LAZY_STATES = new WeakMap();
const TAB_STATE_NEEDS_RESTORE = 1;
const TAB_STATE_RESTORING = 2;
const TAB_STATE_WILL_RESTORE = 3;
const TAB_STATE_FOR_BROWSER = new WeakMap();
const WINDOW_RESTORE_IDS = new WeakMap();
const WINDOW_RESTORE_ZINDICES = new WeakMap();
@ -429,6 +430,14 @@ var SessionStore = {
return SessionStoreInternal.reviveAllCrashedTabs();
},
navigateAndRestore(tab, loadArguments, historyIndex) {
return SessionStoreInternal.navigateAndRestore(
tab,
loadArguments,
historyIndex
);
},
updateSessionStoreFromTablistener(aBrowser, aBrowsingContext, aData) {
return SessionStoreInternal.updateSessionStoreFromTablistener(
aBrowser,
@ -595,6 +604,11 @@ var SessionStoreInternal = {
// reason about.
_saveableClosedWindowData: new WeakSet(),
// A map (xul:browser -> object) that maps a browser that is switching
// remoteness via navigateAndRestore, to the loadArguments that were
// most recently passed when calling navigateAndRestore.
_remotenessChangingBrowsers: new WeakMap(),
// whether a setBrowserState call is in progress
_browserSetState: false,
@ -3851,6 +3865,148 @@ var SessionStoreInternal = {
}
},
/**
* Navigate the given |tab| by first collecting its current state and then
* either changing only the index of the currently shown history entry,
* or restoring the exact same state again and passing the new URL to load
* in |loadArguments|. Use this method to seamlessly switch between pages
* loaded in the parent and pages loaded in the child process.
*
* This method might be called multiple times before it has finished
* flushing the browser tab. If that occurs, the loadArguments from
* the most recent call to navigateAndRestore will be used once the
* flush has finished.
*
* This method returns a promise which will be resolved when the browser
* element's process has been swapped. The load is not guaranteed to have
* been completed at this point.
*/
navigateAndRestore(tab, loadArguments, historyIndex) {
let window = tab.ownerGlobal;
if (!window.__SSi) {
Cu.reportError("Tab's window must be tracked.");
return Promise.reject();
}
let browser = tab.linkedBrowser;
// If we were alerady waiting for a flush from a previous call to
// navigateAndRestore on this tab, update the loadArguments stored, and
// asynchronously wait on the flush's promise.
if (this._remotenessChangingBrowsers.has(browser.permanentKey)) {
let opts = this._remotenessChangingBrowsers.get(browser.permanentKey);
// XXX(nika): In the existing logic, we always use the initial
// historyIndex value, and don't update it if multiple navigateAndRestore
// calls are made. Should we update it here?
opts.loadArguments = loadArguments;
return opts.promise;
}
// Begin the asynchronous NavigateAndRestore process, and store the current
// load arguments and promise in our _remotenessChangingBrowsers weakmap.
let promise = this._asyncNavigateAndRestore(tab);
this._remotenessChangingBrowsers.set(browser.permanentKey, {
loadArguments,
historyIndex,
promise,
});
// Set up the browser UI to look like we're doing something while waiting
// for a TabStateFlush from our frame scripts.
let uriObj;
try {
uriObj = Services.io.newURI(loadArguments.uri);
} catch (e) {}
// Start the throbber to pretend we're doing something while actually
// waiting for data from the frame script. This throbber is disabled
// if the URI is a local about: URI.
if (!uriObj || (uriObj && !uriObj.schemeIs("about"))) {
tab.setAttribute("busy", "true");
}
// Hack to ensure that the about:home, about:newtab, and about:welcome
// favicon is loaded instantaneously, to avoid flickering and improve
// perceived performance.
window.gBrowser.setDefaultIcon(tab, uriObj);
TAB_STATE_FOR_BROWSER.set(tab.linkedBrowser, TAB_STATE_WILL_RESTORE);
// Notify of changes to closed objects.
this._notifyOfClosedObjectsChange();
return promise;
},
/**
* Internal logic called by navigateAndRestore to flush tab state, and
* trigger a remoteness changing load with the most recent load arguments.
*
* This method's promise will resolve when the process for the given
* xul:browser element has successfully been swapped.
*
* @param tab to navigate and restore.
*/
async _asyncNavigateAndRestore(tab) {
let permanentKey = tab.linkedBrowser.permanentKey;
let browser = tab.linkedBrowser;
// NOTE: This is currently the only async operation used, but this is likely
// to change in the future.
await this.prepareToChangeRemoteness(browser);
// Now that we have flushed state, our loadArguments, etc. may have been
// overwritten by multiple calls to navigateAndRestore. Load the most
// recently stored one.
let { loadArguments, historyIndex } = this._remotenessChangingBrowsers.get(
permanentKey
);
this._remotenessChangingBrowsers.delete(permanentKey);
// The tab might have been closed/gone in the meantime.
if (tab.closing || !tab.linkedBrowser) {
return;
}
// The tab or its window might be gone.
let window = tab.ownerGlobal;
if (!window || !window.__SSi || window.closed) {
return;
}
let tabState = TabState.clone(tab, TAB_CUSTOM_VALUES.get(tab));
let options = {
restoreImmediately: true,
// We want to make sure that this information is passed to restoreTab
// whether or not a historyIndex is passed in. Thus, we extract it from
// the loadArguments.
newFrameloader: loadArguments.newFrameloader,
remoteType: loadArguments.remoteType,
// Make sure that SessionStore knows that this restoration is due
// to a navigation, as opposed to us restoring a closed window or tab.
restoreContentReason: RESTORE_TAB_CONTENT_REASON.NAVIGATE_AND_RESTORE,
};
if (historyIndex >= 0) {
tabState.index = historyIndex + 1;
tabState.index = Math.max(
1,
Math.min(tabState.index, tabState.entries.length)
);
} else {
options.loadArguments = loadArguments;
}
// Need to reset restoring tabs.
if (TAB_STATE_FOR_BROWSER.has(tab.linkedBrowser)) {
this._resetLocalTabRestoringState(tab);
}
// Restore the state into the tab.
this.restoreTab(tab, tabState, options);
},
/**
* Retrieves the latest session history information for a tab. The cached data
* is returned immediately, but a callback may be provided that supplies
@ -4787,6 +4943,9 @@ var SessionStoreInternal = {
let activeIndex = tabData.index - 1;
let activePageData = tabData.entries[activeIndex] || null;
let uri = activePageData ? activePageData.url || null : null;
if (loadArguments) {
uri = loadArguments.uri;
}
this.markTabAsRestoring(aTab);
@ -4794,10 +4953,22 @@ var SessionStoreInternal = {
// necessary.
let isRemotenessUpdate = aOptions.isRemotenessUpdate;
if (!isRemotenessUpdate) {
isRemotenessUpdate = tabbrowser.updateBrowserRemotenessByURL(
browser,
uri
);
let newFrameloader = aOptions.newFrameloader;
if (aOptions.remoteType !== undefined) {
// We already have a selected remote type so we update to that.
isRemotenessUpdate = tabbrowser.updateBrowserRemoteness(browser, {
remoteType: aOptions.remoteType,
newFrameloader,
});
} else {
isRemotenessUpdate = tabbrowser.updateBrowserRemotenessByURL(
browser,
uri,
{
newFrameloader,
}
);
}
if (isRemotenessUpdate) {
// We updated the remoteness, so we need to send the history down again.

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

@ -157,7 +157,7 @@ add_task(async function save_worthy_tabs_nonremote_final() {
ok(browser.isRemoteBrowser, "browser is remote");
// Replace about:blank with a non-remote entry.
BrowserTestUtils.loadURI(browser, "about:robots");
await BrowserTestUtils.loadURI(browser, "about:robots");
ok(!browser.isRemoteBrowser, "browser is not remote anymore");
// Switching remoteness caused a SessionRestore to begin, moving over history

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

@ -20,7 +20,7 @@ add_task(async function setup() {
let browserLoaded = BrowserTestUtils.browserLoaded(
window.gBrowser.selectedBrowser
);
BrowserTestUtils.loadURI(window.gBrowser.selectedBrowser, url);
await BrowserTestUtils.loadURI(window.gBrowser.selectedBrowser, url);
await browserLoaded;
// Capture the title.
gTestURLsMap.set(url, window.gBrowser.selectedTab.label);

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

@ -18,7 +18,7 @@ add_task(async function test_load_start() {
// Load a new URI.
let historyReplacePromise = promiseOnHistoryReplaceEntryInChild(browser);
BrowserTestUtils.loadURI(browser, PAGE);
await BrowserTestUtils.loadURI(browser, PAGE);
// Remove the tab before it has finished loading.
await historyReplacePromise;

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

@ -97,7 +97,7 @@ add_task(async function updateMainButtonInFullscreen() {
"chrome://browser/skin/search-glass.svg",
"OpenLocation should be displaying the search glass icon."
);
BrowserTestUtils.loadURI(
await BrowserTestUtils.loadURI(
gBrowser.selectedBrowser,
TEST_PATH + "video_test.html"
);

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

@ -195,7 +195,7 @@ add_task(async function pickHelpButton() {
Assert.ok(BrowserTestUtils.is_visible(helpButton));
EventUtils.synthesizeMouseAtCenter(helpButton, {});
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, helpUrl);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, helpUrl);
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
const scalars = TelemetryTestUtils.getProcessScalars("parent", true, true);

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

@ -157,7 +157,7 @@ add_task(async function pickButton_redirect() {
await setDefaultEngine("Google");
await BrowserTestUtils.withNewTab("about:blank", async () => {
await withDNSRedirect("www.google.com", "/", async url => {
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
await checkTip(window, UrlbarProviderSearchTips.TIP_TYPE.REDIRECT, false);
@ -327,7 +327,7 @@ add_task(async function clickInInput_redirect() {
await setDefaultEngine("Google");
await BrowserTestUtils.withNewTab("about:blank", async () => {
await withDNSRedirect("www.google.com", "/", async url => {
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
await checkTip(window, UrlbarProviderSearchTips.TIP_TYPE.REDIRECT, false);
@ -383,7 +383,7 @@ add_task(async function openLocation_redirect() {
await setDefaultEngine("Google");
await BrowserTestUtils.withNewTab("about:blank", async () => {
await withDNSRedirect("www.google.com", "/", async url => {
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
await checkTip(window, UrlbarProviderSearchTips.TIP_TYPE.REDIRECT, false);
@ -490,7 +490,7 @@ add_task(async function notification() {
// Give it a big persistence so it doesn't go away on page load.
note.persistence = 100;
await withDNSRedirect("www.google.com", "/", async url => {
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
await checkTip(window, UrlbarProviderSearchTips.TIP_TYPE.NONE);
box.removeNotification(note, true);
@ -516,7 +516,7 @@ add_task(async function ignoreEndsEngagement() {
await setDefaultEngine("Google");
await BrowserTestUtils.withNewTab("about:blank", async () => {
await withDNSRedirect("www.google.com", "/", async url => {
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
await checkTip(window, UrlbarProviderSearchTips.TIP_TYPE.REDIRECT, false);
// We're just looking for any target outside the Urlbar.

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

@ -81,7 +81,7 @@ add_task(async function newtabAndHome() {
// After example.com closes, about:newtab/home is selected again.
await checkOpensOnFocus();
// Load example.com in the same tab.
BrowserTestUtils.loadURI(
await BrowserTestUtils.loadURI(
gBrowser.selectedBrowser,
"http://example.com/"
);

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

@ -88,7 +88,7 @@ add_task(async function test_history_no_search_terms() {
// A page other than TEST_URL must be loaded, or the first Top Site
// result will be a switch-to-tab result and page won't be reloaded when
// the result is selected.
BrowserTestUtils.loadURI(selectedBrowser, "http://example.org/");
await BrowserTestUtils.loadURI(selectedBrowser, "http://example.org/");
await BrowserTestUtils.browserLoaded(selectedBrowser);
gURLBar.blur();
EventUtils.synthesizeMouseAtCenter(gURLBar.textbox, {});

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

@ -35,7 +35,7 @@ add_task(async function() {
) {
return loadedURL == "about:config";
});
BrowserTestUtils.loadURI(browser, "about:config");
await BrowserTestUtils.loadURI(browser, "about:config");
await didLoad;
gBrowser.goBack();

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

@ -268,7 +268,7 @@ add_task(async function test_tabSwitch_pageproxystate() {
registerCleanupFunction(PlacesUtils.history.clear);
let win = await BrowserTestUtils.openNewBrowserWindow();
BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser, "about:robots");
await BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser, "about:robots");
let tab1 = win.gBrowser.selectedTab;
info("Open a new tab and the empty search");

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

@ -38,7 +38,7 @@ add_task(async function test_back_forward() {
// Now navigate forward and make sure autofill autocomplete results are still attached
let loadPromise = BrowserTestUtils.browserLoaded(browser);
BrowserTestUtils.loadURI(browser, `${URL}?load=2`);
await BrowserTestUtils.loadURI(browser, `${URL}?load=2`);
info("expecting browser loaded");
await loadPromise;

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

@ -77,11 +77,11 @@ add_task(async function test_numberOfSiteOriginsMultipleNavigations() {
];
// Navigate to an interstitial page.
BrowserTestUtils.loadURI(tab.linkedBrowser, "about:blank");
await BrowserTestUtils.loadURI(tab.linkedBrowser, "about:blank");
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
// Navigate to another test page.
BrowserTestUtils.loadURI(tab.linkedBrowser, testPage);
await BrowserTestUtils.loadURI(tab.linkedBrowser, testPage);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
wgpDestroyedPromises.push(

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

@ -306,7 +306,7 @@ add_task(async function test_tabsHistogram() {
);
openedTabs.push(tab);
BrowserUsageTelemetry._lastRecordTabCount = 0;
BrowserTestUtils.loadURI(tab.linkedBrowser, "http://example.com/");
await BrowserTestUtils.loadURI(tab.linkedBrowser, "http://example.com/");
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
checkTabCountHistogram(
tabCountHist.snapshot(),
@ -382,7 +382,7 @@ add_task(async function test_tabsHistogram() {
Date.now() - MINIMUM_TAB_COUNT_INTERVAL_MS / 2;
{
let oldLastRecordTabCount = BrowserUsageTelemetry._lastRecordTabCount;
BrowserTestUtils.loadURI(tab.linkedBrowser, "http://example.com/");
await BrowserTestUtils.loadURI(tab.linkedBrowser, "http://example.com/");
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
checkTabCountHistogram(
tabCountHist.snapshot(),
@ -400,7 +400,7 @@ add_task(async function test_tabsHistogram() {
Date.now() - (MINIMUM_TAB_COUNT_INTERVAL_MS + 1000);
{
let oldLastRecordTabCount = BrowserUsageTelemetry._lastRecordTabCount;
BrowserTestUtils.loadURI(tab.linkedBrowser, "http://example.com/");
await BrowserTestUtils.loadURI(tab.linkedBrowser, "http://example.com/");
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
checkTabCountHistogram(
tabCountHist.snapshot(),

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

@ -83,7 +83,7 @@ add_task(async function test_URIAndDomainCounts() {
checkCounts({ totalURIs: 0, domainCount: 0, totalUnfilteredURIs: 0 });
// Open a different page and check the counts.
BrowserTestUtils.loadURI(firstTab.linkedBrowser, "http://example.com/");
await BrowserTestUtils.loadURI(firstTab.linkedBrowser, "http://example.com/");
await BrowserTestUtils.browserLoaded(firstTab.linkedBrowser);
checkCounts({ totalURIs: 1, domainCount: 1, totalUnfilteredURIs: 1 });
@ -98,7 +98,7 @@ add_task(async function test_URIAndDomainCounts() {
// Open a new window and set the tab to a new address.
let newWin = await BrowserTestUtils.openNewBrowserWindow();
BrowserTestUtils.loadURI(
await BrowserTestUtils.loadURI(
newWin.gBrowser.selectedBrowser,
"http://example.com/"
);
@ -123,7 +123,7 @@ add_task(async function test_URIAndDomainCounts() {
// Check that we're counting page fragments.
let loadingStopped = browserLocationChanged(newWin.gBrowser.selectedBrowser);
BrowserTestUtils.loadURI(
await BrowserTestUtils.loadURI(
newWin.gBrowser.selectedBrowser,
"http://example.com/#2"
);
@ -131,7 +131,7 @@ add_task(async function test_URIAndDomainCounts() {
checkCounts({ totalURIs: 3, domainCount: 1, totalUnfilteredURIs: 3 });
// Check that a different URI from the example.com domain doesn't increment the unique count.
BrowserTestUtils.loadURI(
await BrowserTestUtils.loadURI(
newWin.gBrowser.selectedBrowser,
"http://test1.example.com/"
);
@ -139,7 +139,7 @@ add_task(async function test_URIAndDomainCounts() {
checkCounts({ totalURIs: 4, domainCount: 1, totalUnfilteredURIs: 4 });
// Make sure that the unique domains counter is incrementing for a different domain.
BrowserTestUtils.loadURI(
await BrowserTestUtils.loadURI(
newWin.gBrowser.selectedBrowser,
"https://example.org/"
);
@ -169,7 +169,7 @@ add_task(async function test_URIAndDomainCounts() {
// Check that uncommon protocols get counted in the unfiltered URI probe.
const TEST_PAGE =
"data:text/html,<a id='target' href='%23par1'>Click me</a><a name='par1'>The paragraph.</a>";
BrowserTestUtils.loadURI(newWin.gBrowser.selectedBrowser, TEST_PAGE);
await BrowserTestUtils.loadURI(newWin.gBrowser.selectedBrowser, TEST_PAGE);
await BrowserTestUtils.browserLoaded(newWin.gBrowser.selectedBrowser);
checkCounts({ totalURIs: 5, domainCount: 2, totalUnfilteredURIs: 6 });

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

@ -32,7 +32,7 @@ add_task(async function test_privateMode() {
let privateWin = await BrowserTestUtils.openNewBrowserWindow({
private: true,
});
BrowserTestUtils.loadURI(
await BrowserTestUtils.loadURI(
privateWin.gBrowser.selectedBrowser,
"http://example.com/"
);

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

@ -416,7 +416,7 @@ add_task(async function() {
gInvalidFormPopup,
"popuphidden"
);
BrowserTestUtils.loadURI(browser, "data:text/html,<div>hello!</div>");
await BrowserTestUtils.loadURI(browser, "data:text/html,<div>hello!</div>");
await BrowserTestUtils.browserLoaded(browser);
await popupHiddenPromise;

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

@ -152,7 +152,7 @@ var TestRunner = {
.removeAttribute("remotecontrol");
let selectedBrowser = browserWindow.gBrowser.selectedBrowser;
BrowserTestUtils.loadURI(selectedBrowser, HOME_PAGE);
await BrowserTestUtils.loadURI(selectedBrowser, HOME_PAGE);
await BrowserTestUtils.browserLoaded(selectedBrowser);
for (let i = 0; i < this.combos.length; i++) {

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

@ -49,7 +49,7 @@ async function navigateBetweenProcesses(enableTargetSwitching) {
// So, fallback to BrowserTestUtils helpers in this test when
// the target-switching preference is turned off.
const onBrowserLoaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
BrowserTestUtils.loadURI(tab.linkedBrowser, URL_2);
await BrowserTestUtils.loadURI(tab.linkedBrowser, URL_2);
await onBrowserLoaded;
}

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

@ -83,7 +83,7 @@ async function navigateTo(uri, browser, animationInspector, inspector) {
const previousAnimationsFront = animationInspector.animationsFront;
const onReloaded = inspector.once("reloaded");
const onUpdated = inspector.once("inspector-updated");
BrowserTestUtils.loadURI(browser, uri);
await BrowserTestUtils.loadURI(browser, uri);
await waitUntil(
() => previousAnimationsFront !== animationInspector.animationsFront
);

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

@ -104,7 +104,10 @@ add_task(async function() {
await _selectSidebarPanel(inspector, "changesview");
info("Navigate to another page");
BrowserTestUtils.loadURI(tab.linkedBrowser, _toDataURL(TEST_ANOTHER_URI));
await BrowserTestUtils.loadURI(
tab.linkedBrowser,
_toDataURL(TEST_ANOTHER_URI)
);
info("Select the compatibility panel again");
const onSelectedNodePaneUpdated = waitForUpdateSelectedNodeAction(

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

@ -71,6 +71,6 @@ async function navigateTo(uri, tab, { store }) {
const onSelectedNodeUpdated = waitForUpdateSelectedNodeAction(store);
const onTopLevelTargetUpdated = waitForUpdateTopLevelTargetAction(store);
const onLoaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
await BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
await Promise.all([onLoaded, onSelectedNodeUpdated, onTopLevelTargetUpdated]);
}

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

@ -17,7 +17,7 @@ add_task(async function() {
// See next comments.
const browser = tab.linkedBrowser;
const onBrowserLoaded = BrowserTestUtils.browserLoaded(browser);
BrowserTestUtils.loadURI(browser, TEST_URL);
await BrowserTestUtils.loadURI(browser, TEST_URL);
await onBrowserLoaded;
// We do not want to wait for the inspector to be fully ready before testing

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

@ -19,7 +19,7 @@ add_task(async () => {
const { gToolbox: toolbox, gStore: store } = panel.panelWin;
info("Open a page running on the content process");
BrowserTestUtils.loadURI(tab.linkedBrowser, CONTENT_PROCESS_URI);
await BrowserTestUtils.loadURI(tab.linkedBrowser, CONTENT_PROCESS_URI);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
await takeAndWaitSnapshot(
panel.panelWin,
@ -80,7 +80,7 @@ function getNodeNames(snapshot) {
async function navigateTo(uri, toolbox, tab) {
const onSwitched = toolbox.targetList.once("switched-target");
const onLoaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
await BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
await onLoaded;
await onSwitched;
ok(true, "switched-target event is fired");

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

@ -41,11 +41,11 @@ add_task(async function() {
await PerformanceView.once(EVENTS.UI_RECORDING_PROFILER_STATUS_RENDERED);
info("Navigate to a page running on main process");
BrowserTestUtils.loadURI(tab.linkedBrowser, MAIN_PROCESS_URL);
await BrowserTestUtils.loadURI(tab.linkedBrowser, MAIN_PROCESS_URL);
await PerformanceView.once(EVENTS.UI_RECORDING_PROFILER_STATUS_RENDERED);
info("Return to a page running on content process again");
BrowserTestUtils.loadURI(tab.linkedBrowser, CONTENT_PROCESS_URL);
await BrowserTestUtils.loadURI(tab.linkedBrowser, CONTENT_PROCESS_URL);
await PerformanceView.once(EVENTS.UI_RECORDING_PROFILER_STATUS_RENDERED);
info("Stop recording");

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

@ -589,7 +589,7 @@ function waitForViewportScroll(ui) {
async function load(browser, url) {
const loaded = BrowserTestUtils.browserLoaded(browser, false, null, false);
BrowserTestUtils.loadURI(browser, url);
await BrowserTestUtils.loadURI(browser, url);
await loaded;
}

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

@ -485,7 +485,7 @@ async function navigateTo(uri, { isErrorPage = false } = {}) {
null,
isErrorPage
);
BrowserTestUtils.loadURI(browser, uri);
await BrowserTestUtils.loadURI(browser, uri);
info(`Waiting for page to be loaded…`);
await onBrowserLoaded;

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

@ -21,7 +21,7 @@ add_task(async function() {
const onBrowserLoaded = BrowserTestUtils.browserLoaded(
gBrowser.selectedBrowser
);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_URI_REPLACED);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_URI_REPLACED);
await onBrowserLoaded;
const toolbox = await openToolboxForTab(gBrowser.selectedTab, "webconsole");

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

@ -177,7 +177,7 @@ add_task(async function() {
const onBrowserLoaded = BrowserTestUtils.browserLoaded(
gBrowser.selectedBrowser
);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, URL2);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, URL2);
await onBrowserLoaded;
// Wait for all events to be received

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

@ -65,7 +65,7 @@ add_task(async function test_NavigationBetweenTwoDomains_NoDestroy() {
});
info("Go to .org page, wait for onAvailable to be called");
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, ORG_PAGE_URL);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, ORG_PAGE_URL);
await checkHooks(hooks, {
available: 2,
destroyed: 0,
@ -91,7 +91,7 @@ add_task(async function test_NavigationBetweenTwoDomains_NoDestroy() {
});
info("Go back to page 1");
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, COM_PAGE_URL);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, COM_PAGE_URL);
await checkHooks(hooks, {
available: 2,
destroyed: 1,
@ -150,7 +150,7 @@ add_task(async function test_NavigationBetweenTwoDomains_WithDestroy() {
});
info("Go to .org page, wait for onAvailable to be called");
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, ORG_PAGE_URL);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, ORG_PAGE_URL);
await checkHooks(hooks, {
available: 2,
destroyed: 1,
@ -170,7 +170,7 @@ add_task(async function test_NavigationBetweenTwoDomains_WithDestroy() {
await checkHooks(hooks, { available: 3, destroyed: 3, targets: [] });
info("Go back to page 1, wait for onDestroyed and onAvailable to be called");
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, COM_PAGE_URL);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, COM_PAGE_URL);
await checkHooks(hooks, {
available: 4,
destroyed: 3,
@ -241,7 +241,7 @@ async function testNavigationToPageWithExistingWorker({
await waitForRegistrationReady(tab, COM_PAGE_URL);
info("Navigate to another page");
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, ORG_PAGE_URL);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, ORG_PAGE_URL);
// Avoid TV failures, where target list still starts thinking that the
// current domain is .com .
@ -267,7 +267,7 @@ async function testNavigationToPageWithExistingWorker({
await checkHooks(hooks, { available: 1, destroyed: 1, targets: [] });
info("Go back .com page, wait for onAvailable to be called");
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, COM_PAGE_URL);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, COM_PAGE_URL);
await checkHooks(hooks, {
available: 2,
destroyed: 1,

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

@ -284,7 +284,7 @@ add_task(async function() {
);
info("Check that navigating away does destroy all targets");
BrowserTestUtils.loadURI(
await BrowserTestUtils.loadURI(
tab.linkedBrowser,
"data:text/html,<meta charset=utf8>Away"
);

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

@ -123,7 +123,7 @@ interface nsIURIFixup : nsISupports
/**
* Convert load flags from nsIWebNavigation to URI fixup flags for use in
* getFixupURIInfo.
* createFixupURI or getFixupURIInfo.
*
* @param aURIText Candidate URI; used for determining whether to
* allow keyword lookups.

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

@ -26,7 +26,7 @@ add_task(async function test() {
for (var uri of uris) {
await BrowserTestUtils.withNewTab({ gBrowser }, async function(newBrowser) {
let loadedPromise = BrowserTestUtils.browserLoaded(newBrowser);
BrowserTestUtils.loadURI(newBrowser, uri);
await BrowserTestUtils.loadURI(newBrowser, uri);
var prin = newBrowser.contentPrincipal;
isnot(

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

@ -69,7 +69,10 @@ add_task(async function() {
});
// Navigate tab 2 to a different page
BrowserTestUtils.loadURI(ctx.tab2Browser, testPath + "bug343515_pg3.html");
await BrowserTestUtils.loadURI(
ctx.tab2Browser,
testPath + "bug343515_pg3.html"
);
await BrowserTestUtils.browserLoaded(ctx.tab2Browser);
@ -166,7 +169,10 @@ add_task(async function() {
await BrowserTestUtils.switchTab(gBrowser, ctx.tab1);
// Navigate to page 3
BrowserTestUtils.loadURI(ctx.tab1Browser, testPath + "bug343515_pg3.html");
await BrowserTestUtils.loadURI(
ctx.tab1Browser,
testPath + "bug343515_pg3.html"
);
await BrowserTestUtils.browserLoaded(ctx.tab1Browser);

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

@ -85,7 +85,7 @@ add_task(async function() {
for (var i = 0; i < 4; i++) {
testPage = `data:text/html,<html id='html1'><body id='body1'>${i}</body></html>`;
let pagePromise = BrowserTestUtils.browserLoaded(browser);
BrowserTestUtils.loadURI(browser, testPage);
await BrowserTestUtils.loadURI(browser, testPage);
await pagePromise;
}
// 7. Wait for 'content viewer evicted' event to go off

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

@ -50,7 +50,7 @@ add_task(async function test() {
// ---------------------------------------------------
// Test 2: Try the same with a content top-level context)
BrowserTestUtils.loadURI(newBrowser, "http://example.com/");
await BrowserTestUtils.loadURI(newBrowser, "http://example.com/");
await BrowserTestUtils.browserLoaded(newBrowser);
let observerData = await SpecialPowers.spawn(

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

@ -37,7 +37,7 @@ add_task(async function() {
Services.console.registerListener(on_new_message);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, kTestURI);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, kTestURI);
await BrowserTestUtils.waitForCondition(() => seen_files.length === 0);
is(seen_files.length, 0, "All FTP subresources should be blocked");

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

@ -131,6 +131,11 @@ var waitForLoad = async function(uri) {
// Tests referrerInfo when navigating from a page in the remote process to main
// process and vice versa.
// The changing process code flow is (cpp) docshell.shouldLoadURI
// -> (JS) browser.shouldLoadURI -> E10sUtils.redirectLoad
// -> ContentRestore.restoreTabContent.
// Finally, docshell will do the load in correct process with the input
// referrerInfo and store an entry to SessionHistory
add_task(async function test_navigation() {
// Navigate from non remote to remote
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:blank");

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

@ -87,7 +87,7 @@ add_task(async function() {
});
Services.console.registerListener(on_new_message);
// 1. Upgrade page to https://
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, kTestURISuccess);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, kTestURISuccess);
// 2. Make an exempt http:// request
let xhr = new XMLHttpRequest();
xhr.open("GET", kTestURIExempt, true);

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

@ -22,7 +22,7 @@ add_task(async function() {
});
Services.console.registerListener(on_auto_upgrade_message);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, kTestURI);
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, kTestURI);
await BrowserTestUtils.waitForCondition(() => seenAutoUpgradeMessage);

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

@ -72,7 +72,7 @@ add_task(async function() {
let browserLoadedPromise = BrowserTestUtils.browserLoaded(
topTab.linkedBrowser
);
BrowserTestUtils.loadURI(topTab.linkedBrowser, TOP_EMPTY_PAGE);
await BrowserTestUtils.loadURI(topTab.linkedBrowser, TOP_EMPTY_PAGE);
await browserLoadedPromise;
// Create Iframe in the top-level page and verify its state.
@ -92,7 +92,7 @@ add_task(async function() {
// ## Cleanup
info("Loading the SW unregister page: " + SW_REGISTER_PAGE);
browserLoadedPromise = BrowserTestUtils.browserLoaded(topTab.linkedBrowser);
BrowserTestUtils.loadURI(topTab.linkedBrowser, SW_REGISTER_PAGE);
await BrowserTestUtils.loadURI(topTab.linkedBrowser, SW_REGISTER_PAGE);
await browserLoadedPromise;
await SpecialPowers.spawn(topTab.linkedBrowser, [], async function() {

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

@ -57,7 +57,7 @@ add_task(async function() {
let browserLoadedPromise = BrowserTestUtils.browserLoaded(
topTab.linkedBrowser
);
BrowserTestUtils.loadURI(topTab.linkedBrowser, TOP_EMPTY_PAGE);
await BrowserTestUtils.loadURI(topTab.linkedBrowser, TOP_EMPTY_PAGE);
await browserLoadedPromise;
// Create Iframe in the top-level page and verify its state.
@ -93,7 +93,7 @@ add_task(async function() {
info("Loading the SW unregister page: " + SW_REGISTER_PAGE);
browserLoadedPromise = BrowserTestUtils.browserLoaded(topTab.linkedBrowser);
BrowserTestUtils.loadURI(topTab.linkedBrowser, SW_REGISTER_PAGE);
await BrowserTestUtils.loadURI(topTab.linkedBrowser, SW_REGISTER_PAGE);
await browserLoadedPromise;
await SpecialPowers.spawn(topTab.linkedBrowser, [], async function() {

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

@ -79,7 +79,7 @@ function test() {
var tab = BrowserTestUtils.addTab(gBrowser);
var tabBrowser = gBrowser.getBrowserForTab(tab);
gBrowser.selectedTab = tab;
BrowserTestUtils.loadURI(gBrowser, url);
await BrowserTestUtils.loadURI(gBrowser, url);
}
);
}

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

@ -36,7 +36,7 @@ const CROSS_ORIGIN_REDIRECT_URL = `${TEST_ROOT}redirect.sjs?${CROSS_ORIGIN_URL}`
async function loadURI(aXULBrowser, aURI) {
const browserLoadedPromise = BrowserTestUtils.browserLoaded(aXULBrowser);
BrowserTestUtils.loadURI(aXULBrowser, aURI);
await BrowserTestUtils.loadURI(aXULBrowser, aURI);
return browserLoadedPromise;
}

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

@ -67,7 +67,7 @@ add_task(async function() {
await injectBeforeUnload(browser);
// Navigate to a chrome page.
let dialogShown1 = awaitAndCloseBeforeUnloadDialog(false);
BrowserTestUtils.loadURI(browser, "about:support");
await BrowserTestUtils.loadURI(browser, "about:support");
await Promise.all([dialogShown1, BrowserTestUtils.browserLoaded(browser)]);
is(beforeUnloadCount, 1, "Should have received one beforeunload event.");
@ -122,7 +122,7 @@ add_task(async function() {
// Navigate to a content page.
let dialogShown1 = awaitAndCloseBeforeUnloadDialog(false);
BrowserTestUtils.loadURI(browser, TEST_URL);
await BrowserTestUtils.loadURI(browser, TEST_URL);
await Promise.all([dialogShown1, BrowserTestUtils.browserLoaded(browser)]);
is(beforeUnloadCount, 1, "Should have received one beforeunload event.");
ok(browser.isRemoteBrowser, "Browser should be remote.");

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