Closed Bug 1381410 Opened 8 years ago Closed 8 years ago

Add missing monitor enter in nsStringBundle::Format*()

Categories

(Core :: Internationalization, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: n.nethercote, Assigned: n.nethercote)

Details

Attachments

(5 files)

nsStringBundle::Get*() enter a monitor, but nsStringBundle::Format*() do not.
nsStringBundle has two public methods GetStringFrom{ID,Name}() and two very similar helper methods with the same name. It's easy to get confused between the two -- indeed, it may be the reason for the data race that this bug is about -- so this patch renames the helper functions by adding a "Helper" suffix.
Attachment #8886955 - Flags: review?(VYV03354)
Assignee: nobody → n.nethercote
Status: NEW → ASSIGNED
GetStringFromIDHelper() is very similar to GetSringFromNameHelper(). This patch removes the former, and changes GetStringFromID() to call GetStringFromName(), similar to how FormatStringFromID() calls FormatStringFromName().
Attachment #8886956 - Flags: review?(VYV03354)
Similar to the previous patch, this patch changes GetStringFromID() to call GetStringFromName(), but this time in nsExtensibleStringBundle.
Attachment #8886957 - Flags: review?(VYV03354)
GetStringFromName() enters mReentrantMonitor(), and the other Get*() functions go through GetStringFromName(). But none of the Format*() functions enter the monitor. This patch moves some repeated code from GetStringFromName() and FormatStringFromName() into GetStringFromNameHelper(), including the monitor entry. All the Get*() and Format*() functions now use GetStringFromNameHelper(), which means they now all enter the monitor.
Attachment #8886958 - Flags: review?(VYV03354)
This patch moves the destructor after the constructor, puts the NS_IMPL_ISUPPORTS line in a more sensible spot, and moves the Get*() functions before the Format*() functions in order to match the order in nsIStringBundle.idl.
Attachment #8886959 - Flags: review?(VYV03354)
Comment on attachment 8886955 [details] [diff] [review] (part 1) - Rename two protected methods in nsStringBundle Nice cleanup.
Attachment #8886955 - Flags: review?(VYV03354) → review+
Attachment #8886956 - Flags: review?(VYV03354) → review+
Attachment #8886957 - Flags: review?(VYV03354) → review+
Attachment #8886958 - Flags: review?(VYV03354) → review+
Attachment #8886959 - Flags: review?(VYV03354) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: