Closed GoogleCodeExporter closed 9 years ago
Original comment by igor.zc
on 23 Apr 2012 at 4:06
//
// Andrew Williamson awilliamson@mozilla.com
//
I remember but I don't have the snippet. This is what I did in my extension
(slightly modified so untested in this state!):
function convertPrefs() {
let prefService= Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService);
let old=prefService.getBranch('extname.');
let mew=prefService.getBranch('extensions.extname.');
if (mew.getPrefType('prefsmigrated')==mew.PREF_BOOL && mew.getBoolPref('prefsmigrated')) return;
var children=old.getChildList("", {});
for (var i=0;i<children.length;i++) {
if (old.prefHasUserValue(children[i])) {
let type= old.getPrefType(children[i]);
if (type==old.PREF_BOOL) mew.setBoolPref(children[i],old.getBoolPref(children[i]));
if (type==old.PREF_INT) mew.setIntPref (children[i],old.getIntPref (children[i]));
if (type==old.PREF_STRING) mew.setCharPref(children[i],old.getCharPref(children[i]));
old.clearUserPref(children[i]);
}
}
mew.setBoolPref('prefsmigrated',true);
Original comment by igor.zc
on 26 Apr 2012 at 9:01
fixed in 1.0.6.0
Original comment by igor.zc
on 26 Apr 2012 at 10:29
Original issue reported on code.google.com by
igor.zc
on 22 Apr 2012 at 9:03