var $Prefs = { _getBranch : Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch), _getService : Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService), set : function(pref_name, pref_value) { var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString); str.data = pref_value.replace(/^\s*|\s*$/g,''); (this._getBranch).setComplexValue(pref_name, Components.interfaces.nsISupportsString, str); }, get : function(pref_name){ try{ return (this._getBranch).getComplexValue(pref_name,Components.interfaces.nsISupportsString).data; } catch(e){ return false;} }, remove : function(pref_name){ try{ (this._getBranch).clearUserPref(pref_name) } catch(e){} }, remove_all : function(pref_name){ try{ (this._getBranch).deleteBranch(pref_name,'') } catch(e){} }, branch : function(pref_name){ var serialBranch = (this._getService).getBranch(pref_name+'.'); return serialBranch.getChildList("",{}); } }