summaryrefslogtreecommitdiffstats
path: root/dom/indexedDB/IndexedDatabaseManager.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /dom/indexedDB/IndexedDatabaseManager.cpp
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/indexedDB/IndexedDatabaseManager.cpp')
-rw-r--r--dom/indexedDB/IndexedDatabaseManager.cpp45
1 files changed, 26 insertions, 19 deletions
diff --git a/dom/indexedDB/IndexedDatabaseManager.cpp b/dom/indexedDB/IndexedDatabaseManager.cpp
index 5ee16ec5e9..0558c38826 100644
--- a/dom/indexedDB/IndexedDatabaseManager.cpp
+++ b/dom/indexedDB/IndexedDatabaseManager.cpp
@@ -296,25 +296,6 @@ nsresult IndexedDatabaseManager::Init() {
Preferences::RegisterCallbackAndCall(MaxPreloadExtraRecordsPrefChangeCallback,
kPrefMaxPreloadExtraRecords);
- nsAutoCString acceptLang;
- Preferences::GetLocalizedCString("intl.accept_languages", acceptLang);
-
- // Split values on commas.
- for (const auto& lang :
- nsCCharSeparatedTokenizer(acceptLang, ',').ToRange()) {
- mozilla::intl::LocaleCanonicalizer::Vector asciiString{};
- auto result = mozilla::intl::LocaleCanonicalizer::CanonicalizeICULevel1(
- PromiseFlatCString(lang).get(), asciiString);
- if (result.isOk()) {
- mLocale.AssignASCII(asciiString);
- break;
- }
- }
-
- if (mLocale.IsEmpty()) {
- mLocale.AssignLiteral("en_US");
- }
-
return NS_OK;
}
@@ -652,11 +633,37 @@ void IndexedDatabaseManager::LoggingModePrefChangedCallback(
}
}
+nsresult IndexedDatabaseManager::EnsureLocale() {
+ MOZ_ASSERT(NS_IsMainThread());
+
+ nsAutoCString acceptLang;
+ Preferences::GetLocalizedCString("intl.accept_languages", acceptLang);
+
+ // Split values on commas.
+ for (const auto& lang :
+ nsCCharSeparatedTokenizer(acceptLang, ',').ToRange()) {
+ mozilla::intl::LocaleCanonicalizer::Vector asciiString{};
+ auto result = mozilla::intl::LocaleCanonicalizer::CanonicalizeICULevel1(
+ PromiseFlatCString(lang).get(), asciiString);
+ if (result.isOk()) {
+ mLocale.AssignASCII(asciiString);
+ break;
+ }
+ }
+
+ if (mLocale.IsEmpty()) {
+ mLocale.AssignLiteral("en_US");
+ }
+
+ return NS_OK;
+}
+
// static
const nsCString& IndexedDatabaseManager::GetLocale() {
IndexedDatabaseManager* idbManager = Get();
MOZ_ASSERT(idbManager, "IDBManager is not ready!");
+ MOZ_ASSERT(!idbManager->mLocale.IsEmpty());
return idbManager->mLocale;
}