Closed Bug 329969 Opened 20 years ago Closed 13 years ago

create a pref-reflector

Categories

(Toolkit :: Safe Browsing, defect)

defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: fritz, Assigned: tony)

Details

There are several places (listmanager, phishwarden, etc) where we go through a bunch of boilerplate code designed to reflect preferences into objects. This is lame. We can do better, and should. We should createa PrefReflector class that does all this boilerplate for us. Specifically: - acts an object's getter for the preference in question - the first time it is called, gets it from preferences and caches it - registers to hear about pref changes and caches these changes - takes a function to call when the pref value changes Interface might be: PrefReflector(prefName, opt_callOnChange) // callOnChange's signature is: function(prefName, oldVal, newVal) PrefReflector.get() And might be used like: function MyObject() { var callback = BindToObject(this.onChange, this); this.configPref = new PrefReflector("my.extension.enabled", callback); } MyObject.prototype.onChange = function(prefName, oldval, newval) { ... } // get the pref value: var myobj = new MyObject(); var prefVal = myobj.configPref.get(); This should go into preferences.js I guess, or maybe a new file. (And bring it back in-house when you're done!)
Reporter, can you still reproduce this bug in Firefox 10.0.2? Please update to Firefox 10.0.2 or later, update your plugins, and retest in a new profile. If you still see the issue with the updated version of Firefox, please post here. Otherwise, please close as RESOLVED > WORKSFORME. http://getfirefox.com/ http://support.mozilla.com/kb/Managing+profiles
Whiteboard: [CLOSEME 06-01-2012]
Resolved per whiteboard
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → INCOMPLETE
Whiteboard: [CLOSEME 06-01-2012]
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.