Closed Bug 1998284 Opened 7 months ago Closed 6 months ago

On startup: NS_ERROR_ILLEGAL_VALUE: Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [mozILocaleService.requestedLocales]

Categories

(GeckoView :: General, defect, P2)

All
Android
defect

Tracking

(firefox147 fixed)

RESOLVED FIXED
147 Branch
Tracking Status
firefox147 --- fixed

People

(Reporter: robwu, Assigned: olivia)

References

Details

(Whiteboard: [fxdroid][geckoview])

Attachments

(1 file)

When I attach a debugger (via about:debugging on desktop) to Firefox on Android (I tested Firefox Beta and Firefox Focus, latest versions as of today), I see the following error message in the console:

NS_ERROR_ILLEGAL_VALUE: Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [mozILocaleService.requestedLocales]

That error is emitted from the "GeckoView:SetLocale" handler in GeckoViewStartup.sys.mjs, thrown from the requestedLocales setter.

The locales are sent from GeckoRuntimeSettings.java, with locales sourced from Locale.toLanguageTag() in LocaleSettingUpdater.kt.

I suspect that this returns a language tag with a region (similar to bug 1847701), which will trip the requestedLocales setter.

The "GeckoView:SetLocale" handler is responsible for updating the data for Accept-Languages, so besides requestedLocales not being updated, I think that this bug also prevents the Accept-Languages header from updating.

Severity: -- → S4
Flags: needinfo?(ohall)
Priority: -- → P2

Thanks for reporting!

A couple of questions, would you mind to share:

  1. What device OS language(s) were set and the Fenix app language
  2. The OS version of the Android device you were testing with

I'm having a little trouble getting the same scenario. I tried a couple of language tags with regions.

My understanding is that log will show up in the Multiprocess Toolbox when Fenix is connected to about:debugging.

Flags: needinfo?(rob)

(In reply to Olivia Hall [:olivia] from comment #1)

  1. What device OS language(s) were set and the Fenix app language

I have only one language set, English (United States)
Not sure if relevant, but I also have Regional preferences set to Celsius.

  1. The OS version of the Android device you were testing with

Android 15, Google Pixel 8.

My understanding is that log will show up in the Multiprocess Toolbox when Fenix is connected to about:debugging.

Yes.

If you know how to pause the execution of Gecko until the debugger is connected, then I can give that a try, to print the relevant values.
In xpcshell tests, for example, we have logic to spin the event loop until the JS debugger is connected; if something similar exists for Gecko, that would be nice.

Flags: needinfo?(rob)

Thanks for the additional info! I was able to get the same error by setting Celsius as my preference on the OS level.

The error also shows up if I add/remove languages at runtime, which enables me to observe the value in the debugger. This is the value that causes the error:

{
  "acceptLanguages": "en-US-u-mu-celsius,en-US",
  "requestedLocales": [ "en-US-u-mu-celsius" ]
​​}

Interestingly, when I temporarily added "English (Netherlands)" as a language, my (newly started) Firefox Nightly has en-US,en-NL in intl.accept_languages, but when I remove the language, it does not get reverted. I'm not sure if en-US,en-NL was already there from before (in the profile directory), or whether it was set because of the language change that I did as part of the test.

In any case, it looks like this bug prevents Accept-Language HTTP header, navigator.languages and navigator.language from matching the user's preference. My situation (English with Celsius instead of Freedom units) doesn't feel too unusual, so I would have expected bug reports before. But I cannot find anything in Bugzilla for these keywords. In fact, bug 1948445 shows that at least for one user, the pref was updated.

would have expected bug reports before

Yeah, I would expect more too. Maybe where regional preferences are new to Android 14 it isn't common knowledge that it can be changed just yet. Definitely important to get ahead of it.

I also wonder if it could be happening some in the bug 1948445 -like reports. Accept-Languages is a part of how we decide when we offer translations/pre-populate dropdowns. I have been tracking that one and ones like it for a while trying to figure out exactly what is going haywire. Really glad you reported this because it is the first concrete actionable I've seen related to it so far.

Whiteboard: [fxdroid][geckoview]
Assignee: nobody → ohall
Flags: needinfo?(ohall)

Language tags on Android 14 and greater can have extended formatting cues.
This normalizes the tag the same way as Accept-Languages.

Attachment #9525404 - Attachment description: Bug 1998284 - Requested locales on Android 14 and greater need normalized r=m_kato → Bug 1998284 - Requested locales on Android 14+ need normalized r=m_kato
See Also: → 1948445
Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 147 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: