Bug 1839845 - Add about:settings as alias of about:preferences. r=Gijs,settings-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D202594
This commit is contained in:
Bojidar Marinov
2024-02-29 10:09:58 +00:00
parent e67392e8c4
commit a02f6a1df5
6 changed files with 21 additions and 7 deletions

View File

@@ -141,6 +141,9 @@ static const RedirEntry kRedirMap[] = {
nsIAboutModule::URI_MUST_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::URI_MUST_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT |
nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS | nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS |
nsIAboutModule::HIDE_FROM_ABOUTABOUT}, nsIAboutModule::HIDE_FROM_ABOUTABOUT},
{"settings", "chrome://browser/content/preferences/preferences.xhtml",
nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::IS_SECURE_CHROME_UI |
nsIAboutModule::HIDE_FROM_ABOUTABOUT},
{"preferences", "chrome://browser/content/preferences/preferences.xhtml", {"preferences", "chrome://browser/content/preferences/preferences.xhtml",
nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::IS_SECURE_CHROME_UI}, nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::IS_SECURE_CHROME_UI},
{"downloads", {"downloads",

View File

@@ -31,6 +31,7 @@ pages = [
'rights', 'rights',
'robots', 'robots',
'sessionrestore', 'sessionrestore',
'settings',
'shoppingsidebar', 'shoppingsidebar',
'tabcrashed', 'tabcrashed',
'unloads', 'unloads',

View File

@@ -344,12 +344,15 @@ var gHomePane = {
}, },
/** /**
* _isTabAboutPreferences: Is a given tab set to about:preferences? * _isTabAboutPreferencesOrSettings: Is a given tab set to about:preferences or about:settings?
* @param {Element} aTab A tab element * @param {Element} aTab A tab element
* @returns {bool} Is the linkedBrowser of aElement set to about:preferences? * @returns {bool} Is the linkedBrowser of aElement set to about:preferences or about:settings?
*/ */
_isTabAboutPreferences(aTab) { _isTabAboutPreferencesOrSettings(aTab) {
return aTab.linkedBrowser.currentURI.spec.startsWith("about:preferences"); return (
aTab.linkedBrowser.currentURI.spec.startsWith("about:preferences") ||
aTab.linkedBrowser.currentURI.spec.startsWith("about:settings")
);
}, },
/** /**
@@ -367,7 +370,7 @@ var gHomePane = {
"navigator:browser" "navigator:browser"
) { ) {
tabs = win.gBrowser.visibleTabs.slice(win.gBrowser._numPinnedTabs); tabs = win.gBrowser.visibleTabs.slice(win.gBrowser._numPinnedTabs);
tabs = tabs.filter(tab => !this._isTabAboutPreferences(tab)); tabs = tabs.filter(tab => !this._isTabAboutPreferencesOrSettings(tab));
// XXX: Bug 1441637 - Fix tabbrowser to report tab.closing before it blurs it // XXX: Bug 1441637 - Fix tabbrowser to report tab.closing before it blurs it
tabs = tabs.filter(tab => !tab.closing); tabs = tabs.filter(tab => !tab.closing);
} }

View File

@@ -278,7 +278,10 @@ var gMainPane = {
let uri = win.gBrowser.currentURI.spec; let uri = win.gBrowser.currentURI.spec;
if ( if (
(uri == "about:preferences" || uri == "about:preferences#general") && (uri == "about:preferences" ||
uri == "about:preferences#general" ||
uri == "about:settings" ||
uri == "about:settings#general") &&
document.visibilityState == "visible" document.visibilityState == "visible"
) { ) {
this.updateSetDefaultBrowser(); this.updateSetDefaultBrowser();

View File

@@ -1365,6 +1365,7 @@ void nsContentSecurityUtils::AssertAboutPageHasCSP(Document* aDocument) {
// preferences and downloads allow legacy inline scripts through hash src. // preferences and downloads allow legacy inline scripts through hash src.
MOZ_ASSERT(!foundScriptSrc || MOZ_ASSERT(!foundScriptSrc ||
StringBeginsWith(aboutSpec, "about:preferences"_ns) || StringBeginsWith(aboutSpec, "about:preferences"_ns) ||
StringBeginsWith(aboutSpec, "about:settings"_ns) ||
StringBeginsWith(aboutSpec, "about:downloads"_ns) || StringBeginsWith(aboutSpec, "about:downloads"_ns) ||
StringBeginsWith(aboutSpec, "about:asrouter"_ns) || StringBeginsWith(aboutSpec, "about:asrouter"_ns) ||
StringBeginsWith(aboutSpec, "about:newtab"_ns) || StringBeginsWith(aboutSpec, "about:newtab"_ns) ||
@@ -1383,6 +1384,7 @@ void nsContentSecurityUtils::AssertAboutPageHasCSP(Document* aDocument) {
// remote web resources // remote web resources
MOZ_ASSERT(!foundWebScheme || MOZ_ASSERT(!foundWebScheme ||
StringBeginsWith(aboutSpec, "about:preferences"_ns) || StringBeginsWith(aboutSpec, "about:preferences"_ns) ||
StringBeginsWith(aboutSpec, "about:settings"_ns) ||
StringBeginsWith(aboutSpec, "about:addons"_ns) || StringBeginsWith(aboutSpec, "about:addons"_ns) ||
StringBeginsWith(aboutSpec, "about:newtab"_ns) || StringBeginsWith(aboutSpec, "about:newtab"_ns) ||
StringBeginsWith(aboutSpec, "about:debugging"_ns) || StringBeginsWith(aboutSpec, "about:debugging"_ns) ||
@@ -1411,6 +1413,7 @@ void nsContentSecurityUtils::AssertAboutPageHasCSP(Document* aDocument) {
// Bug 1579160: Remove 'unsafe-inline' from style-src within // Bug 1579160: Remove 'unsafe-inline' from style-src within
// about:preferences // about:preferences
"about:preferences"_ns, "about:preferences"_ns,
"about:settings"_ns,
// Bug 1571346: Remove 'unsafe-inline' from style-src within about:addons // Bug 1571346: Remove 'unsafe-inline' from style-src within about:addons
"about:addons"_ns, "about:addons"_ns,
// Bug 1584485: Remove 'unsafe-inline' from style-src within: // Bug 1584485: Remove 'unsafe-inline' from style-src within:
@@ -1553,7 +1556,7 @@ bool nsContentSecurityUtils::ValidateScriptFilename(JSContext* cx,
// and this is the most reasonable. See 1727770 // and this is the most reasonable. See 1727770
u"about:downloads"_ns, u"about:downloads"_ns,
// We think this is the same problem as about:downloads // We think this is the same problem as about:downloads
u"about:preferences"_ns, u"about:preferences"_ns, u"about:settings"_ns,
// Browser console will give a filename of 'debugger' See 1763943 // Browser console will give a filename of 'debugger' See 1763943
// Sometimes it's 'debugger eager eval code', other times just 'debugger // Sometimes it's 'debugger eager eval code', other times just 'debugger
// eval code' // eval code'

View File

@@ -112,6 +112,7 @@ export var BrowserUtils = {
canFindInPage(location) { canFindInPage(location) {
return ( return (
!location.startsWith("about:preferences") && !location.startsWith("about:preferences") &&
!location.startsWith("about:settings") &&
!location.startsWith("about:logins") && !location.startsWith("about:logins") &&
!(location.startsWith("about:firefoxview") && lazy.FXVIEW_SEARCH_ENABLED) !(location.startsWith("about:firefoxview") && lazy.FXVIEW_SEARCH_ENABLED)
); );