New issue
Advanced search Search tips

Issue 901200 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug



Sign in to add a comment

Extensions: Potential extraneous read of messages.json during ExtensionHostMsg_GetMessageBundle

Project Member Reported by lazyboy@chromium.org, Nov 2

Issue description

@tott, also note that this is orthogonal to Michael's "Use preferred language in extension i18n" CL at https://chromium.googlesource.com/chromium/src/+/693d01a674be72cb5ee4bf1f0c622189e7e05b37

In my machine (and karandeepb@'s) it seems LoadMessageCatalogs gets two instances "en" through GetAllFallbackLocales. And that results in two file reads of messages.json. This seems suboptimal.

https://cs.chromium.org/chromium/src/extensions/common/extension_l10n_util.cc?rcl=ba96c018682416a7b2ec77876404b14322aa1b54&l=366
(disregard the preferred locale change)

app_locale = en_US, default_local = en
GetParentLocales = { en_US, en}
Then we add default locale (en) to it on line 367, resulting {en_US, en, en}

The caller goes through each of the "en" entries and reads the messages.json file from disk.

I think std::set or sort+unique the vector would be the way to go.

Some notes:
- As michaelpg@ is dealing with regression around same area ( crbug.com/898191 ), I wouldn't touch this until that settles.
- I would think this is the state most of our users are in terms of locales? Though I can't prove that :), that's why wanted to check w/ karandeepb@'s machine and put "Potential" in the bug title. Locales are tricky :/
 
https://chromium-review.googlesource.com/c/chromium/src/+/1313335/1 is a sample CL to show the logs to ReadFileToString. It might not patch properly atm.

Sign in to add a comment