commit 7de6069b192fedf00e5a25031dfa8d62e7043e9f parent 554bf7f7d2ee2cc8f335353833d879de2b3d55fc Author: Tim Huang <tihuang@mozilla.com> Date: Thu, 16 Oct 2025 21:38:56 +0000 Bug 1992978 - Sort the providers before we process the tables in nsUrlClassifierUtils::ReadProvidersFromPrefs(). r=dimi Differential Revision: https://phabricator.services.mozilla.com/D268890 Diffstat:
| M | toolkit/components/url-classifier/nsUrlClassifierUtils.cpp | | | 13 | ++++++++++--- |
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp b/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp @@ -1022,15 +1022,22 @@ nsresult nsUrlClassifierUtils::ReadProvidersFromPrefs(ProviderDictType& aDict) { providers.Insert(provider); } + // Sort the providers to ensure the google5 provider is always after the + // google4 provider. + nsTArray<nsCString> sortedProviders; + for (auto& provider : providers) { + sortedProviders.AppendElement(provider); + } + sortedProviders.Sort(); + bool isGoogle5Enabled = mozilla::Preferences::GetBool( "browser.safebrowsing.provider.google5.enabled"); // Now we have all providers. Check which one owns |aTableName|. // e.g. The owning lists of provider "google" is defined in // "browser.safebrowsing.provider.google.lists". - for (const auto& provider : providers) { - nsPrintfCString owninListsPref("%s.lists", - nsPromiseFlatCString{provider}.get()); + for (const auto& provider : sortedProviders) { + nsPrintfCString owninListsPref("%s.lists", provider.get()); nsAutoCString owningLists; nsresult rv = prefBranch->GetCharPref(owninListsPref.get(), owningLists);