Pier Angelo Vendrame pushed to branch tor-browser-115.6.0esr-13.5-1 at The Tor Project / Applications / Tor Browser

Commits:

1 changed file:

Changes:

  • modules/libpref/Preferences.cpp
    ... ... @@ -6024,7 +6024,8 @@ struct PrefListEntry {
    6024 6024
     //      StaticPrefList.yml), a string pref, and it is NOT exempted in
    
    6025 6025
     //      sDynamicPrefOverrideList
    
    6026 6026
     //
    
    6027
    -// This behavior is codified in ShouldSanitizePreference() below
    
    6027
    +// This behavior is codified in ShouldSanitizePreference() below.
    
    6028
    +// Exclusions of preferences can be defined in sOverrideRestrictionsList[].
    
    6028 6029
     static const PrefListEntry sRestrictFromWebContentProcesses[] = {
    
    6029 6030
         // Remove prefs with user data
    
    6030 6031
         PREF_LIST_ENTRY("datareporting.policy."),
    
    ... ... @@ -6073,6 +6074,18 @@ static const PrefListEntry sRestrictFromWebContentProcesses[] = {
    6073 6074
         PREF_LIST_ENTRY("toolkit.telemetry.previousBuildID"),
    
    6074 6075
     };
    
    6075 6076
     
    
    6077
    +// Allowlist for prefs and branches blocklisted in
    
    6078
    +// sRestrictFromWebContentProcesses[], including prefs from
    
    6079
    +// StaticPrefList.yaml and *.js, to let them pass.
    
    6080
    +static const PrefListEntry sOverrideRestrictionsList[]{
    
    6081
    +    PREF_LIST_ENTRY("services.settings.clock_skew_seconds"),
    
    6082
    +    PREF_LIST_ENTRY("services.settings.last_update_seconds"),
    
    6083
    +    PREF_LIST_ENTRY("services.settings.server"),
    
    6084
    +    // tor-browser#41165, tor-browser!765: leave this static pref in
    
    6085
    +    // gSharedMap to prevent a crash in gpu process in debug builds.
    
    6086
    +    PREF_LIST_ENTRY("browser.urlbar.onionRewrites.enabled"),
    
    6087
    +};
    
    6088
    +
    
    6076 6089
     // These prefs are dynamically-named (i.e. not specified in prefs.js or
    
    6077 6090
     // StaticPrefList) and would normally by blocklisted but we allow them through
    
    6078 6091
     // anyway, so this override list acts as an allowlist
    
    ... ... @@ -6168,13 +6181,12 @@ static bool ShouldSanitizePreference(const Pref* const aPref) {
    6168 6181
       // pref through.
    
    6169 6182
       for (const auto& entry : sRestrictFromWebContentProcesses) {
    
    6170 6183
         if (strncmp(entry.mPrefBranch, prefName, entry.mLen) == 0) {
    
    6171
    -      const auto* p = prefName;  // This avoids clang-format doing ugly things.
    
    6172
    -      return !(strncmp("services.settings.clock_skew_seconds", p, 36) == 0 ||
    
    6173
    -               strncmp("services.settings.last_update_seconds", p, 37) == 0 ||
    
    6174
    -               strncmp("services.settings.server", p, 24) == 0 ||
    
    6175
    -               // Prevent a crash in debug builds. Please refer to
    
    6176
    -               // StaticPrefList.yaml, tor-browser#41165 and tor-browser!765 for details.
    
    6177
    -               strncmp("browser.urlbar.onionRewrites.enabled", p, 36) == 0);
    
    6184
    +      for (const auto& pasEnt : sOverrideRestrictionsList) {
    
    6185
    +        if (strncmp(pasEnt.mPrefBranch, prefName, pasEnt.mLen) == 0) {
    
    6186
    +          return false;
    
    6187
    +        }
    
    6188
    +      }
    
    6189
    +      return true;
    
    6178 6190
         }
    
    6179 6191
       }
    
    6180 6192