From 8cea2c95be4d3b8623275296fc390c743da691cc Mon Sep 17 00:00:00 2001 From: isaacylee Date: Sat, 31 Aug 2024 22:00:59 +0000 Subject: [PATCH] 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 --- browser/base/content/browser.js | 2 +- .../tabbrowser/content/tabbrowser.js | 26 +++++++++---------- .../tabs/browser_e10s_switchbrowser.js | 10 +++---- browser/modules/URILoadingHelper.sys.mjs | 18 ++++++------- .../components/extensions/ext-android.js | 4 +-- .../shared/components/extensions/ext-tabs.js | 6 ++--- .../geckoview/GeckoViewNavigation.sys.mjs | 2 +- 7 files changed, 34 insertions(+), 34 deletions(-) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 7bb0ab4f95ca..ccd83c15d0d7 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -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, }); }, }; diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js index a9da4372a3e9..c89ae2cbb978 100644 --- a/browser/components/tabbrowser/content/tabbrowser.js +++ b/browser/components/tabbrowser/content/tabbrowser.js @@ -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, diff --git a/browser/components/tabbrowser/test/browser/tabs/browser_e10s_switchbrowser.js b/browser/components/tabbrowser/test/browser/tabs/browser_e10s_switchbrowser.js index 36d6bfbece85..ad277a17f14d 100644 --- a/browser/components/tabbrowser/test/browser/tabs/browser_e10s_switchbrowser.js +++ b/browser/components/tabbrowser/test/browser/tabs/browser_e10s_switchbrowser.js @@ -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++; diff --git a/browser/modules/URILoadingHelper.sys.mjs b/browser/modules/URILoadingHelper.sys.mjs index 9a226943c73d..f85b68dbb719 100644 --- a/browser/modules/URILoadingHelper.sys.mjs +++ b/browser/modules/URILoadingHelper.sys.mjs @@ -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, diff --git a/mobile/shared/components/extensions/ext-android.js b/mobile/shared/components/extensions/ext-android.js index 13f91fb617f5..75f9ba44a480 100644 --- a/mobile/shared/components/extensions/ext-android.js +++ b/mobile/shared/components/extensions/ext-android.js @@ -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, }); diff --git a/mobile/shared/components/extensions/ext-tabs.js b/mobile/shared/components/extensions/ext-tabs.js index 70c1cff8a04d..d5963c1bd625 100644 --- a/mobile/shared/components/extensions/ext-tabs.js +++ b/mobile/shared/components/extensions/ext-tabs.js @@ -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, }); } diff --git a/mobile/shared/modules/geckoview/GeckoViewNavigation.sys.mjs b/mobile/shared/modules/geckoview/GeckoViewNavigation.sys.mjs index 10ed8940c50f..b2abe194516a 100644 --- a/mobile/shared/modules/geckoview/GeckoViewNavigation.sys.mjs +++ b/mobile/shared/modules/geckoview/GeckoViewNavigation.sys.mjs @@ -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,