Skip to content

Commit c7286a7

Browse files
committed
Bug 1839845 - Add about:settings as alias of about:preferences. r=Gijs,settings-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D202594
1 parent 790c008 commit c7286a7

File tree

6 files changed

+21
-7
lines changed

6 files changed

+21
-7
lines changed

browser/components/about/AboutRedirector.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ static const RedirEntry kRedirMap[] = {
141141
nsIAboutModule::URI_MUST_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT |
142142
nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS |
143143
nsIAboutModule::HIDE_FROM_ABOUTABOUT},
144+
{"settings", "chrome://browser/content/preferences/preferences.xhtml",
145+
nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::IS_SECURE_CHROME_UI |
146+
nsIAboutModule::HIDE_FROM_ABOUTABOUT},
144147
{"preferences", "chrome://browser/content/preferences/preferences.xhtml",
145148
nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::IS_SECURE_CHROME_UI},
146149
{"downloads",

browser/components/about/components.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pages = [
3131
'rights',
3232
'robots',
3333
'sessionrestore',
34+
'settings',
3435
'shoppingsidebar',
3536
'tabcrashed',
3637
'unloads',

browser/components/preferences/home.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,12 +344,15 @@ var gHomePane = {
344344
},
345345

346346
/**
347-
* _isTabAboutPreferences: Is a given tab set to about:preferences?
347+
* _isTabAboutPreferencesOrSettings: Is a given tab set to about:preferences or about:settings?
348348
* @param {Element} aTab A tab element
349-
* @returns {bool} Is the linkedBrowser of aElement set to about:preferences?
349+
* @returns {bool} Is the linkedBrowser of aElement set to about:preferences or about:settings?
350350
*/
351-
_isTabAboutPreferences(aTab) {
352-
return aTab.linkedBrowser.currentURI.spec.startsWith("about:preferences");
351+
_isTabAboutPreferencesOrSettings(aTab) {
352+
return (
353+
aTab.linkedBrowser.currentURI.spec.startsWith("about:preferences") ||
354+
aTab.linkedBrowser.currentURI.spec.startsWith("about:settings")
355+
);
353356
},
354357

355358
/**
@@ -367,7 +370,7 @@ var gHomePane = {
367370
"navigator:browser"
368371
) {
369372
tabs = win.gBrowser.visibleTabs.slice(win.gBrowser._numPinnedTabs);
370-
tabs = tabs.filter(tab => !this._isTabAboutPreferences(tab));
373+
tabs = tabs.filter(tab => !this._isTabAboutPreferencesOrSettings(tab));
371374
// XXX: Bug 1441637 - Fix tabbrowser to report tab.closing before it blurs it
372375
tabs = tabs.filter(tab => !tab.closing);
373376
}

browser/components/preferences/main.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,10 @@ var gMainPane = {
278278
let uri = win.gBrowser.currentURI.spec;
279279

280280
if (
281-
(uri == "about:preferences" || uri == "about:preferences#general") &&
281+
(uri == "about:preferences" ||
282+
uri == "about:preferences#general" ||
283+
uri == "about:settings" ||
284+
uri == "about:settings#general") &&
282285
document.visibilityState == "visible"
283286
) {
284287
this.updateSetDefaultBrowser();

dom/security/nsContentSecurityUtils.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1365,6 +1365,7 @@ void nsContentSecurityUtils::AssertAboutPageHasCSP(Document* aDocument) {
13651365
// preferences and downloads allow legacy inline scripts through hash src.
13661366
MOZ_ASSERT(!foundScriptSrc ||
13671367
StringBeginsWith(aboutSpec, "about:preferences"_ns) ||
1368+
StringBeginsWith(aboutSpec, "about:settings"_ns) ||
13681369
StringBeginsWith(aboutSpec, "about:downloads"_ns) ||
13691370
StringBeginsWith(aboutSpec, "about:asrouter"_ns) ||
13701371
StringBeginsWith(aboutSpec, "about:newtab"_ns) ||
@@ -1383,6 +1384,7 @@ void nsContentSecurityUtils::AssertAboutPageHasCSP(Document* aDocument) {
13831384
// remote web resources
13841385
MOZ_ASSERT(!foundWebScheme ||
13851386
StringBeginsWith(aboutSpec, "about:preferences"_ns) ||
1387+
StringBeginsWith(aboutSpec, "about:settings"_ns) ||
13861388
StringBeginsWith(aboutSpec, "about:addons"_ns) ||
13871389
StringBeginsWith(aboutSpec, "about:newtab"_ns) ||
13881390
StringBeginsWith(aboutSpec, "about:debugging"_ns) ||
@@ -1411,6 +1413,7 @@ void nsContentSecurityUtils::AssertAboutPageHasCSP(Document* aDocument) {
14111413
// Bug 1579160: Remove 'unsafe-inline' from style-src within
14121414
// about:preferences
14131415
"about:preferences"_ns,
1416+
"about:settings"_ns,
14141417
// Bug 1571346: Remove 'unsafe-inline' from style-src within about:addons
14151418
"about:addons"_ns,
14161419
// Bug 1584485: Remove 'unsafe-inline' from style-src within:
@@ -1553,7 +1556,7 @@ bool nsContentSecurityUtils::ValidateScriptFilename(JSContext* cx,
15531556
// and this is the most reasonable. See 1727770
15541557
u"about:downloads"_ns,
15551558
// We think this is the same problem as about:downloads
1556-
u"about:preferences"_ns,
1559+
u"about:preferences"_ns, u"about:settings"_ns,
15571560
// Browser console will give a filename of 'debugger' See 1763943
15581561
// Sometimes it's 'debugger eager eval code', other times just 'debugger
15591562
// eval code'

toolkit/modules/BrowserUtils.sys.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ export var BrowserUtils = {
112112
canFindInPage(location) {
113113
return (
114114
!location.startsWith("about:preferences") &&
115+
!location.startsWith("about:settings") &&
115116
!location.startsWith("about:logins") &&
116117
!(location.startsWith("about:firefoxview") && lazy.FXVIEW_SEARCH_ENABLED)
117118
);

0 commit comments

Comments
 (0)