Add Preferences API for getting default pref values

RESOLVED FIXED in mozilla7

Status

()

Core
Preferences: Backend
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: bz, Assigned: masayuki)

Tracking

Trunk
mozilla7
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

I need to do some default value getting of prefs (the sort that getDefaultBranch on the prefservice would let me do), but there seems to not be Preferences API for it...
What do you need actually? Only Preferences::GetDefaultBranch()?

Or GetDefaultBool(), GetDefaultInt() and others? If many places use the default value, I think the latter is better.
For my current thing, I'd need to replace all uses of GetBool("ui.use_native_popup_windows") with something that uses only default prefs.

So yes, the latter would be nicer.  ;)
Okay, I'll try to write the APIs.
For what it's worth, it looks like I may be removing the pref usage altogether instead, so this is a lot less urgent...
Created attachment 540641 [details] [diff] [review]
Patch v1.0

How about these APIs? I don't have better idea for GetDefaultBool()...
Assignee: nobody → masayuki
Status: NEW → ASSIGNED
Attachment #540641 - Flags: feedback?(bzbarsky)
Comment on attachment 540641 [details] [diff] [review]
Patch v1.0

And requesting review to roc.
Attachment #540641 - Flags: review?(roc)
Comment on attachment 540641 [details] [diff] [review]
Patch v1.0

I really don't think we should add instances of values other than PR_FALSE and PR_TRUE being passed through PRBool, since the plan is to move to using bool at some point.

Can we require that GetDefaultBool take an argument that indicates what to return if the value is not set?
Attachment #540641 - Flags: feedback?(bzbarsky) → feedback-
Created attachment 540676 [details] [diff] [review]
Patch v2.0

How about this?
Attachment #540641 - Attachment is obsolete: true
Attachment #540641 - Flags: review?(roc)
Attachment #540676 - Flags: review?(roc)
Attachment #540676 - Flags: feedback?(bzbarsky)
Attachment #540676 - Flags: feedback?(bzbarsky) → feedback+
Comment on attachment 540676 [details] [diff] [review]
Patch v2.0

Review of attachment 540676 [details] [diff] [review]:
-----------------------------------------------------------------
Attachment #540676 - Flags: review?(roc) → review+
http://hg.mozilla.org/integration/mozilla-inbound/rev/b6e018a94db7
Whiteboard: [inbound]
http://hg.mozilla.org/mozilla-central/rev/b6e018a94db7
Whiteboard: [inbound]
Target Milestone: --- → mozilla7
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.