commit 561fe48b33d3465846dfeeb97bdb1c680cf60f85
parent bfa896171b3ecbbf7711c1bc16c078aa2e87ce18
Author: Andrew McCreight <continuation@gmail.com>
Date: Tue, 7 Oct 2025 22:23:09 +0000
Bug 1976752 - Disable spammy warning in L10nRegistry::LoadSync(). r=platform-i18n-reviewers,nordzilla
There's a very frequent Necko message that is localized using necko.ftl,
which has a resource://gre/ URI. Unfortunately, the code always tries
a resource://app/ first, generating a warning, before succeeding. This
is one of the very most common warnings in the tree, so let's disable it.
Note that warnings don't even show up in opt builds, so people writing
Firefox frontend code won't see them.
Differential Revision: https://phabricator.services.mozilla.com/D267682
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/intl/l10n/L10nRegistry.cpp b/intl/l10n/L10nRegistry.cpp
@@ -380,9 +380,13 @@ nsresult L10nRegistry::LoadSync(const nsACString& aPath, void** aData,
nsIRequest::LOAD_NORMAL);
NS_ENSURE_SUCCESS(rv, rv);
+ // Don't warn on failure here, because it is triggered very frequently for
+ // necko.ftl which first tries and fails loading a resource://app/ URI before
+ // succeeding with a resource://gre/ URI.
nsCOMPtr<nsIInputStream> input;
- rv = channel->Open(getter_AddRefs(input));
- NS_ENSURE_SUCCESS(rv, NS_ERROR_INVALID_ARG);
+ if (NS_FAILED(channel->Open(getter_AddRefs(input)))) {
+ return NS_ERROR_INVALID_ARG;
+ }
return NS_ReadInputStreamToBuffer(input, aData, -1, aSize);
}