This commit is contained in:
gorhill 2015-06-03 09:51:24 -04:00
parent 013b077656
commit e8e14c7d70
1 changed files with 12 additions and 3 deletions

View File

@ -120,17 +120,26 @@
} }
var result = JSON.parse(JSON.stringify(µb.remoteBlacklists)); var result = JSON.parse(JSON.stringify(µb.remoteBlacklists));
var builtinPath; var entry, builtinPath, defaultState;
var defaultState;
for ( var path in result ) { for ( var path in result ) {
if ( result.hasOwnProperty(path) === false ) { if ( result.hasOwnProperty(path) === false ) {
continue; continue;
} }
entry = result[path];
// https://github.com/gorhill/uBlock/issues/277
// uBlock's filter lists are always enabled by default, so we
// have to include in backup only those which are turned off.
if ( path.lastIndexOf('assets/ublock/', 0) === 0 ) {
if ( entry.off !== true ) {
delete result[path];
}
continue;
}
builtinPath = path.replace(/^assets\/thirdparties\//, ''); builtinPath = path.replace(/^assets\/thirdparties\//, '');
defaultState = builtin.hasOwnProperty(builtinPath) === false || defaultState = builtin.hasOwnProperty(builtinPath) === false ||
builtin[builtinPath].off === true; builtin[builtinPath].off === true;
if ( result[path].off === true && result[path].off === defaultState ) { if ( entry.off === true && entry.off === defaultState ) {
delete result[path]; delete result[path];
} }
} }