Closed Bug 807231 Opened 13 years ago Closed 13 years ago

Add functions to manage date preferences

Categories

(Cloud Services :: Firefox: Common, defect)

defect
Not set
normal

Tracking

(firefox18 fixed, firefox19 fixed, firefox20 fixed)

RESOLVED FIXED
mozilla20
Tracking Status
firefox18 --- fixed
firefox19 --- fixed
firefox20 --- fixed

People

(Reporter: gps, Assigned: gps)

Details

Attachments

(1 file, 1 obsolete file)

For FHR I wrote functions for savings Date instances to and from prefs. I needed to use these in multiple modules and figured they'd make a good addition to CommonUtils.
Attachment #676912 - Flags: review?(rnewman)
Comment on attachment 676912 [details] [diff] [review] Functions to manage date prefs, v1 Review of attachment 676912 [details] [diff] [review]: ----------------------------------------------------------------- ::: services/common/utils.js @@ +531,5 @@ > + > + valueInt = def; > + } > + } else { > + valueInt = def; Rather than doing this, split into getEpochPref, use returns instead of variable assignments, and define getDatePref in terms of it. I'm sure there's a use for getEpochPref, and it avoids valueInt. @@ +556,5 @@ > + * If the range check fails, an Error will be thrown instead of a default > + * value silently being used. > + * > + * @param branch > + * (Preference) Branch to use to save preference in. "Branch in which to save preference value".
Attachment #676912 - Flags: review?(rnewman) → review+
Incorporated review feedback.
Assignee: nobody → gps
Attachment #676912 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #677164 - Flags: review?(rnewman)
Comment on attachment 677164 [details] [diff] [review] Functions to manage date prefs, v2 Review of attachment 677164 [details] [diff] [review]: ----------------------------------------------------------------- ::: services/common/utils.js @@ +506,5 @@ > + * (Number) The default value to use if the preference is not defined. > + * @param thisObj > + * (Object) Object to log warnings > + */ > + getEpochPref: function getDatePref(branch, pref, def=0, thisObj=null) { Function name is wrong. @@ +548,5 @@ > + * (Number) The default value (in milliseconds) if the preference is > + * not defined or invalid. > + * @param thisObj > + * (Object) Object to use for logging. If defined and it has a `_log` > + * property, that Log4Moz logger will be used to record warnings. Let's just pass in an optional `logger` instead.
Attachment #677164 - Flags: review?(rnewman) → review+
Whiteboard: [fixed-in-larch]
Comment on attachment 677164 [details] [diff] [review] Functions to manage date prefs, v2 Bulk-setting approval flags for FHR landing for FxOS ADU ping (Bug 788894).
Attachment #677164 - Flags: approval-mozilla-beta?
Attachment #677164 - Flags: approval-mozilla-aurora?
Target Milestone: --- → mozilla20
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Comment on attachment 677164 [details] [diff] [review] Functions to manage date prefs, v2 FHR for B2G ADU ping, won't be built/enabled for Mobile/Desktop.
Attachment #677164 - Flags: approval-mozilla-beta?
Attachment #677164 - Flags: approval-mozilla-beta+
Attachment #677164 - Flags: approval-mozilla-aurora?
Attachment #677164 - Flags: approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: