From e8e14c7d705488f6e3606e1158feffb1a9fbbedd Mon Sep 17 00:00:00 2001 From: gorhill Date: Wed, 3 Jun 2015 09:51:24 -0400 Subject: [PATCH] this fixes #277 --- src/js/storage.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/js/storage.js b/src/js/storage.js index f8d94074e..f3ab6a6c1 100644 --- a/src/js/storage.js +++ b/src/js/storage.js @@ -120,17 +120,26 @@ } var result = JSON.parse(JSON.stringify(µb.remoteBlacklists)); - var builtinPath; - var defaultState; + var entry, builtinPath, defaultState; for ( var path in result ) { if ( result.hasOwnProperty(path) === false ) { 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\//, ''); defaultState = builtin.hasOwnProperty(builtinPath) === false || builtin[builtinPath].off === true; - if ( result[path].off === true && result[path].off === defaultState ) { + if ( entry.off === true && entry.off === defaultState ) { delete result[path]; } }