Merge pull request #429 from saneyuki/pref

Restore the backuped user pref when this addon is disabled or removed.
This commit is contained in:
YUKI "Piro" Hiroshi 2013-01-01 15:57:32 -08:00
commit e95b4c0692

View File

@ -405,12 +405,16 @@ TreeStyleTabWindow.prototype = {
'browser.tabs.insertRelatedAfterCurrent', 'browser.tabs.insertRelatedAfterCurrent',
'extensions.stm.tabBarMultiRows' // Super Tab Mode 'extensions.stm.tabBarMultiRows' // Super Tab Mode
]; ];
for (let i = 0, maxi = pref.length; i < maxi; i++) for (let i = 0, maxi = restorePrefs.length; i < maxi; i++)
{ {
let pref = restorePrefs[i]; let pref = restorePrefs[i];
let backup = prefs.getPref(pref+'.backup'); let backup = prefs.getPref(pref+'.backup');
if (backup === null) continue; if (backup === null) continue;
prefs.setPref(pref+'.override', backup); // we have to set to ".override" pref, to avoid unexpectedly reset by the preference listener. // we have to set to ".override" pref, to avoid unexpectedly reset by the preference listener.
prefs.setPref(pref+'.override', backup);
// restore user preference.
prefs.setPref(pref, backup);
// clear backup pref.
prefs.clearPref(pref+'.backup'); prefs.clearPref(pref+'.backup');
} }
}; };