Pier Angelo Vendrame pushed to branch tor-browser-115.6.0esr-13.5-1 at The Tor Project / Applications / Tor Browser
Commits: 05d20cc1 by Pier Angelo Vendrame at 2024-01-15T09:46:08+01:00 dropme! Bug 40458: Implement .tor.onion aliases
Bug 42354: Upstreamed the ShouldSanitizePreference refactor
Drop this commit on the rebase.
- - - - - d548b69e by Tom Ritter at 2024-01-15T09:54:34+01:00 Bug 1873526: Refactor the restriction override list from a big if statement to a list r=KrisWright
Differential Revision: https://phabricator.services.mozilla.com/D198081
- - - - - 5cbefa67 by guest475646844 at 2024-01-15T09:57:16+01:00 fixup! Bug 40458: Implement .tor.onion aliases
- - - - -
1 changed file:
- modules/libpref/Preferences.cpp
Changes:
===================================== modules/libpref/Preferences.cpp ===================================== @@ -6024,7 +6024,8 @@ struct PrefListEntry { // StaticPrefList.yml), a string pref, and it is NOT exempted in // sDynamicPrefOverrideList // -// This behavior is codified in ShouldSanitizePreference() below +// This behavior is codified in ShouldSanitizePreference() below. +// Exclusions of preferences can be defined in sOverrideRestrictionsList[]. static const PrefListEntry sRestrictFromWebContentProcesses[] = { // Remove prefs with user data PREF_LIST_ENTRY("datareporting.policy."), @@ -6073,6 +6074,18 @@ static const PrefListEntry sRestrictFromWebContentProcesses[] = { PREF_LIST_ENTRY("toolkit.telemetry.previousBuildID"), };
+// Allowlist for prefs and branches blocklisted in +// sRestrictFromWebContentProcesses[], including prefs from +// StaticPrefList.yaml and *.js, to let them pass. +static const PrefListEntry sOverrideRestrictionsList[]{ + PREF_LIST_ENTRY("services.settings.clock_skew_seconds"), + PREF_LIST_ENTRY("services.settings.last_update_seconds"), + PREF_LIST_ENTRY("services.settings.server"), + // tor-browser#41165, tor-browser!765: leave this static pref in + // gSharedMap to prevent a crash in gpu process in debug builds. + PREF_LIST_ENTRY("browser.urlbar.onionRewrites.enabled"), +}; + // These prefs are dynamically-named (i.e. not specified in prefs.js or // StaticPrefList) and would normally by blocklisted but we allow them through // anyway, so this override list acts as an allowlist @@ -6168,13 +6181,12 @@ static bool ShouldSanitizePreference(const Pref* const aPref) { // pref through. for (const auto& entry : sRestrictFromWebContentProcesses) { if (strncmp(entry.mPrefBranch, prefName, entry.mLen) == 0) { - const auto* p = prefName; // This avoids clang-format doing ugly things. - return !(strncmp("services.settings.clock_skew_seconds", p, 36) == 0 || - strncmp("services.settings.last_update_seconds", p, 37) == 0 || - strncmp("services.settings.server", p, 24) == 0 || - // Prevent a crash in debug builds. Please refer to - // StaticPrefList.yaml, tor-browser#41165 and tor-browser!765 for details. - strncmp("browser.urlbar.onionRewrites.enabled", p, 36) == 0); + for (const auto& pasEnt : sOverrideRestrictionsList) { + if (strncmp(pasEnt.mPrefBranch, prefName, pasEnt.mLen) == 0) { + return false; + } + } + return true; } }
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/0c55a36...