The default bug view has changed. See this FAQ.

Add Preferences API for getting default pref values

RESOLVED FIXED in mozilla7



Preferences: Backend
6 years ago
6 years ago


(Reporter: bz, Assigned: masayuki)


Mac OS X

Firefox Tracking Flags

(Not tracked)



(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...

Comment 1

6 years ago
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.  ;)

Comment 3

6 years ago
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...

Comment 5

6 years ago
Created attachment 540641 [details] [diff] [review]
Patch v1.0

How about these APIs? I don't have better idea for GetDefaultBool()...
Assignee: nobody → masayuki
Attachment #540641 - Flags: feedback?(bzbarsky)

Comment 6

6 years ago
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-

Comment 8

6 years ago
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+

Comment 10

6 years ago
Whiteboard: [inbound]
Whiteboard: [inbound]
Target Milestone: --- → mozilla7
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.