[Project_owners] Reset user preferences to default?

HJ bugs4hj at netscape.net
Thu Feb 9 17:23:07 EST 2006


David Duong wrote:
> Hi,
> 
> I'm trying to reset my extension's preferences to default values and 
> came accross the function "resetBranch" of "preferences-service".  ( 
> http://www.xulplanet.com/references/xpcomref/comps/c_preferencesservice1.html)
> 
> So something like:
>   var prefs = Components.classes["@mozilla.org/preferences-service;1 
> <http://mozilla.org/preferences-service;1>"].
>       getService(Components.interfaces.nsIPrefService);
>   prefs.resetBranch('extensions.myext.');
> 
> Should work, but it only causes a not implemented error.  What is the 
> best way to reset extension preferences?

Right, just replace 'nsIPrefService' with 'nsIPrefBranch' ;)

/HJ


More information about the Project_owners mailing list