Closed Bug 1574930 Opened 5 years ago Closed 5 years ago

[Protections Panel] Blocked trackers count isn't locale-formatted

Categories

(Firefox :: Site Identity, defect, P1)

defect

Tracking

()

RESOLVED FIXED
Firefox 70
Tracking Status
firefox70 --- fixed

People

(Reporter: nhnt11, Assigned: timhuang)

References

Details

(Whiteboard: [privacy-panel][skyline])

Attachments

(3 files)

Please note that toLocaleString() by default (unless passed an explicit locale argument) uses the locale of the OS not that of the Firefox UI, so if for example the user is running an en-US build on an OS set to use Arabic locale information by default, using toLocaleString() without an explicit locale argument produces the wrong results. The only correct way to use it would be to pass the %AB_CD% locale arguments we receive from the build system to the function, I think...

(In reply to :Ehsan Akhgari from comment #1)

Please note that toLocaleString() by default (unless passed an explicit locale argument) uses the locale of the OS not that of the Firefox UI, so if for example the user is running an en-US build on an OS set to use Arabic locale information by default, using toLocaleString() without an explicit locale argument produces the wrong results. The only correct way to use it would be to pass the %AB_CD% locale arguments we receive from the build system to the function, I think...

Thanks for this hint. I think [3] might be a good example of this...

[3] https://searchfox.org/mozilla-central/rev/428cf94f4ddfb80eebc6028023a7d89eb277791b/toolkit/content/widgets/datetimebox.js#1044

If the example in [3] proves not to be useful and it turns out to be difficult/complicated to get this perfectly right, I would not be against landing a simple toLocaleString() fix with a follow-up filed to figure out the OS/Firefox locale disparity situation.

Note that the example you gave uses the getWebExposedLocales() API. That is useful for cases where we want to expose our locale information to web pages (which is the case for the <input type=date/time> controls. But this isn't exactly the same case. For example the aforementioned API honours the privacy.spoof_english and intl.regional_prefs.use_os_locales prefs.

(In reply to Nihanth Subramanya [:nhnt11] from comment #3)

I would not be against landing a simple toLocaleString() fix with a follow-up filed to figure out the OS/Firefox locale disparity situation.

If by "simple" here you mean omitting the locales argument to that function, that will certainly do the wrong thing for all of our users who are on builds which do not match their Firefox UI locale. (The fact that maybe a large portion of our developers use en-US builds on English OS locales is a very sad coincidence but it doesn't represent what our users see.)

intl/docs/locale.rst explains how to do this correctly (see "Language Negotiation" onwards).

Assignee: nobody → tihuang
Status: NEW → ASSIGNED
Flags: needinfo?(tihuang)

There is an issue that the tracker counter will be shown even if the number of blocked trackers is zero. I will also fix this in this bug.

We use the locale of the application to show the number of the trakcer
counter.

By adding a check for ensuring the counter will be only shown when the
count is not zero.

Depends on D42716

This patch adds a test case to check the visibility of the track counter
is correct in different situations, including zero tracker, one tracker
and multiple trackers.

Also, this patch fixes an issue that the
BrowserTestUtils.waitForAttributes() won't work if the waiting
attributes doesn't have a value or has an empty string as its value.
We check the value of the observing attribute to verify if it is
existing, however an empty string will be treated as a false, so it
won't pass the check if the attribute doesn't have a value. Hence, we
should use hasAttribute() instead of getAttribute() to check the
existence of the attribute.

Depends on D42717

Attachment #9086812 - Attachment description: Bug 1574930 - Add a test case for making sure that the track counter displays properly and fix an issue for BrowserTestUtils.waitForAttribute(). r?nhnt11!,johannh! → Bug 1574930 - Part 3: Add a test case for making sure that the track counter displays properly and fix an issue for BrowserTestUtils.waitForAttribute(). r?nhnt11!,johannh!
Pushed by tihuang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/085122dae600 Part 1: Use the app locale for the tracker counter number in protections panel. r=nhnt11,Ehsan https://hg.mozilla.org/integration/autoland/rev/96854f5ed90d Part 2: Fix the issue the the number of blocked trackers is still shown if the count is zero. r=nhnt11 https://hg.mozilla.org/integration/autoland/rev/5dbac06bc222 Part 3: Add a test case for making sure that the track counter displays properly and fix an issue for BrowserTestUtils.waitForAttribute(). r=nhnt11,johannh
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: