Bug 1558149 - Use 'loadFlags' instead of 'flags' for flags eventually passed to 'loadURI' or 'fixupAndLoadURIString' r=Gijs,geckoview-reviewers,tabbrowser-reviewers,dao,owlish

Differential Revision: https://phabricator.services.mozilla.com/D216324
This commit is contained in:
isaacylee 2024-08-31 22:00:59 +00:00
parent c54944f337
commit 8cea2c95be
7 changed files with 34 additions and 34 deletions

View File

@ -1619,7 +1619,7 @@ var BrowserOnClick = {
browsingContext.fixupAndLoadURIString(blockedInfo.uri, {
triggeringPrincipal,
flags: Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CLASSIFIER,
loadFlags: Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CLASSIFIER,
});
},
};

View File

@ -1929,20 +1929,20 @@
browser = this.selectedBrowser;
targetTabIndex = this.tabContainer.selectedIndex;
}
let flags = LOAD_FLAGS_NONE;
let loadFlags = LOAD_FLAGS_NONE;
if (allowThirdPartyFixup) {
flags |=
loadFlags |=
LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP | LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
}
if (!allowInheritPrincipal) {
flags |= LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL;
loadFlags |= LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL;
}
if (fromExternal) {
flags |= LOAD_FLAGS_FROM_EXTERNAL;
loadFlags |= LOAD_FLAGS_FROM_EXTERNAL;
}
try {
browser.fixupAndLoadURIString(aURIs[0], {
flags,
loadFlags,
postData: postDatas && postDatas[0],
triggeringPrincipal,
csp,
@ -3193,30 +3193,30 @@
browser.userTypedValue = uriString;
}
let flags = LOAD_FLAGS_NONE;
let loadFlags = LOAD_FLAGS_NONE;
if (allowThirdPartyFixup) {
flags |=
loadFlags |=
LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP | LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
}
if (fromExternal) {
flags |= LOAD_FLAGS_FROM_EXTERNAL;
loadFlags |= LOAD_FLAGS_FROM_EXTERNAL;
} else if (!triggeringPrincipal.isSystemPrincipal) {
// XXX this code must be reviewed and changed when bug 1616353
// lands.
flags |= LOAD_FLAGS_FIRST_LOAD;
loadFlags |= LOAD_FLAGS_FIRST_LOAD;
}
if (!allowInheritPrincipal) {
flags |= LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL;
loadFlags |= LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL;
}
if (disableTRR) {
flags |= LOAD_FLAGS_DISABLE_TRR;
loadFlags |= LOAD_FLAGS_DISABLE_TRR;
}
if (forceAllowDataURI) {
flags |= LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
loadFlags |= LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
}
try {
browser.fixupAndLoadURIString(uriString, {
flags,
loadFlags,
triggeringPrincipal,
referrerInfo,
charset,

View File

@ -115,17 +115,17 @@ var waitForLoad = async function (uriString) {
// Waits for a load and updates the known history
var waitForLoadWithFlags = async function (
uriString,
flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE
loadFlags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE
) {
info("Loading " + uriString + " flags = " + flags);
info("Loading " + uriString + " flags = " + loadFlags);
gBrowser.selectedBrowser.loadURI(Services.io.newURI(uriString), {
flags,
loadFlags,
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
await BrowserTestUtils.browserStopped(gBrowser, uriString);
if (!(flags & Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY)) {
if (flags & Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY) {
if (!(loadFlags & Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY)) {
if (loadFlags & Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY) {
gExpectedHistory.entries.pop();
} else {
gExpectedHistory.index++;

View File

@ -216,30 +216,30 @@ function openInWindow(url, params, sourceWindow) {
}
function openInCurrentTab(targetBrowser, url, uriObj, params) {
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
let loadFlags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
if (params.allowThirdPartyFixup) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
loadFlags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
loadFlags |= Ci.nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
}
// LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL isn't supported for javascript URIs,
// i.e. it causes them not to load at all. Callers should strip
// "javascript:" from pasted strings to prevent blank tabs
if (!params.allowInheritPrincipal) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL;
loadFlags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL;
}
if (params.allowPopups) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_POPUPS;
loadFlags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_POPUPS;
}
if (params.indicateErrorPageLoad) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ERROR_LOAD_CHANGES_RV;
loadFlags |= Ci.nsIWebNavigation.LOAD_FLAGS_ERROR_LOAD_CHANGES_RV;
}
if (params.forceAllowDataURI) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
loadFlags |= Ci.nsIWebNavigation.LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
}
if (params.fromExternal) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL;
loadFlags |= Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL;
}
let { URI_INHERITS_SECURITY_CONTEXT } = Ci.nsIProtocolHandler;
@ -272,7 +272,7 @@ function openInCurrentTab(targetBrowser, url, uriObj, params) {
targetBrowser.fixupAndLoadURIString(url, {
triggeringPrincipal,
csp,
flags,
loadFlags,
referrerInfo,
postData,
userContextId,

View File

@ -634,10 +634,10 @@ global.openOptionsPage = async extension => {
});
const { browser } = tab;
const flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
const loadFlags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
browser.fixupAndLoadURIString(optionsPageProperties.page, {
flags,
loadFlags,
triggeringPrincipal: extension.principal,
});

View File

@ -261,7 +261,7 @@ this.tabs = class extends ExtensionAPIPersistent {
function loadURIInTab(nativeTab, url) {
const { browser } = nativeTab;
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
let loadFlags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
let { principal } = context;
const isAboutUrl = url.startsWith("about:");
if (
@ -279,11 +279,11 @@ this.tabs = class extends ExtensionAPIPersistent {
if (isAboutUrl) {
// Make sure things like about:blank and other about: URIs never
// inherit, and instead always get a NullPrincipal.
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL;
loadFlags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL;
}
browser.fixupAndLoadURIString(url, {
flags,
loadFlags,
triggeringPrincipal: principal,
});
}

View File

@ -260,7 +260,7 @@ export class GeckoViewNavigation extends GeckoViewModule {
//
// csp is only present if we have a referring document, null otherwise.
this.browser.fixupAndLoadURIString(uri, {
flags: navFlags,
loadFlags: navFlags,
referrerInfo,
triggeringPrincipal,
headers: additionalHeaders,