mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-03 09:39:38 +02:00
code review for #292
This commit is contained in:
parent
987a8d2b64
commit
48264e1fd7
@ -116,20 +116,25 @@ vAPI.browserSettings = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
clear: function(branch, setting) {
|
clear: function(branch, setting) {
|
||||||
var value = this.originalValues[branch + '.' + setting];
|
var key = branch + '.' + setting;
|
||||||
if (
|
// Value was not overriden -- nothing to restore
|
||||||
value === undefined &&
|
if ( this.originalValues.hasOwnProperty(key) === false ) {
|
||||||
this.originalValues.hasOwnProperty(branch + '.' + setting)
|
return;
|
||||||
) {
|
}
|
||||||
|
var value = this.originalValues[key];
|
||||||
|
// Original value was a default one
|
||||||
|
if ( value === undefined ) {
|
||||||
try {
|
try {
|
||||||
Services.prefs.getBranch(branch + '.').clearUserPref(setting);
|
Services.prefs.getBranch(branch + '.').clearUserPref(setting);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Current value is same as original
|
||||||
if ( this.getBool(branch, setting) === value ) {
|
if ( this.getBool(branch, setting) === value ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Reset to original value
|
||||||
try {
|
try {
|
||||||
Services.prefs.getBranch(branch + '.').setBoolPref(setting, value);
|
Services.prefs.getBranch(branch + '.').setBoolPref(setting, value);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
Loading…
Reference in New Issue
Block a user