Closed Bug 1464520 Opened 6 years ago Closed 6 years ago

avoid a localization dependency in nsNSSComponent by hard-coding the builtin root module name

Categories

(Core :: Security: PSM, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox62 --- fixed

People

(Reporter: keeler, Assigned: keeler)

Details

(Whiteboard: [psm-assigned])

Attachments

(1 file)

Historically, part of what has made nsNSSComponent initialization difficult is the localized string bundles nsNSSComponent creates and holds on to. Eventually it would be best to not need these at all. Currently, we localize the name of the builtin roots module. It's fairly easy to remove this dependency - we can just hard-code an internal name that we map to the localized version whenever we display it to the user (of course, we have to reverse the mapping when going the other direction).
Comment on attachment 8980775 [details]
bug 1464520 - hard-code the builtin roots module name to avoid a dependency on l10n in nsNSSComponent

https://reviewboard.mozilla.org/r/246960/#review253276

lgtm, except for that one nit.

::: security/manager/ssl/nsPKCS11Slot.cpp:196
(Diff revision 1)
> +// must map to the localized version when we display it to the user.
> +static nsresult
> +NormalizeModuleNameOut(const char* moduleNameIn, nsACString& moduleNameOut)
> +{
> +  // Easy case: this isn't the builtin roots module.
> +  if (strcmp(kRootModuleName, moduleNameIn) != 0) {

I don't like `strcmp`, how about `strncmp`? :)
Attachment #8980775 - Flags: review?(franziskuskiefer)
Comment on attachment 8980775 [details]
bug 1464520 - hard-code the builtin roots module name to avoid a dependency on l10n in nsNSSComponent

https://reviewboard.mozilla.org/r/246960/#review253710

LGTM w/ nit addressed. Nice cleanup!

::: security/manager/ssl/nsPKCS11Slot.cpp:196
(Diff revision 2)
> +// must map to the localized version when we display it to the user.
> +static nsresult
> +NormalizeModuleNameOut(const char* moduleNameIn, nsACString& moduleNameOut)
> +{
> +  // Easy case: this isn't the builtin roots module.
> +  if (strlen(moduleNameIn) != kRootModuleNameLen ||

`strnlen(moduleNameIn, kRootModuleNameLen) != kRootModuleNameLen ||` maybe?
Attachment #8980775 - Flags: review?(jjones) → review+
Comment on attachment 8980775 [details]
bug 1464520 - hard-code the builtin roots module name to avoid a dependency on l10n in nsNSSComponent

https://reviewboard.mozilla.org/r/246960/#review253710

> `strnlen(moduleNameIn, kRootModuleNameLen) != kRootModuleNameLen ||` maybe?

strnlen(moduleNameIn, kRootModuleNameLen + 1) as discussed on irc.
Comment on attachment 8980775 [details]
bug 1464520 - hard-code the builtin roots module name to avoid a dependency on l10n in nsNSSComponent

https://reviewboard.mozilla.org/r/246960/#review253918

shipt it!
Attachment #8980775 - Flags: review?(franziskuskiefer) → review+
Pushed by dkeeler@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f9132bdb0177
hard-code the builtin roots module name to avoid a dependency on l10n in nsNSSComponent r=fkiefer,jcj
https://hg.mozilla.org/mozilla-central/rev/f9132bdb0177
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: