diff --git a/lib/settingDefinitions.js b/lib/settingDefinitions.js index ecb11c8..628ffdd 100644 --- a/lib/settingDefinitions.js +++ b/lib/settingDefinitions.js @@ -149,7 +149,7 @@ }, { name: "storageVersion", - defaultValue: 0.2, + defaultValue: 0.3, fixed: true } ]; diff --git a/lib/settings.js b/lib/settings.js index 36258e1..4d350e3 100644 --- a/lib/settings.js +++ b/lib/settings.js @@ -493,31 +493,42 @@ var urlSettings = {}; - (oldStorage.blackList || "").split(",").forEach(function(url){ - var entry = urlSettings[url]; - if (!entry){ - entry = {url, blockMode: "block"}; - urlSettings[url] = entry; - newStorage.urlSettings.push(entry); - } - }); - (oldStorage.whiteList || "").split(",").forEach(function(url){ - var entry = urlSettings[url]; - if (!entry){ - entry = {url, blockMode: "allow"}; - urlSettings[url] = entry; - newStorage.urlSettings.push(entry); - } - }); - (oldStorage.ignoreList || "").split(",").forEach(function(url){ - var entry = urlSettings[url]; - if (!entry){ - entry = {url, showNotifications: false}; - urlSettings[url] = entry; - newStorage.urlSettings.push(entry); - } - else { - entry.showNotifications = false; + (oldStorage.blackList || "").split(",") + .filter(function(url){return !!url.trim();}) + .forEach(function(url){ + var entry = urlSettings[url]; + if (!entry){ + entry = {url, blockMode: "block"}; + urlSettings[url] = entry; + newStorage.urlSettings.push(entry); + } + }); + (oldStorage.whiteList || "").split(",") + .filter(function(url){return !!url.trim();}) + .forEach(function(url){ + var entry = urlSettings[url]; + if (!entry){ + entry = {url, blockMode: "allow"}; + urlSettings[url] = entry; + newStorage.urlSettings.push(entry); + } + }); + (oldStorage.ignoreList || "").split(",") + .filter(function(url){return !!url.trim();}) + .forEach(function(url){ + var entry = urlSettings[url]; + if (!entry){ + entry = {url, showNotifications: false}; + urlSettings[url] = entry; + newStorage.urlSettings.push(entry); + } + else { + entry.showNotifications = false; + } + }); + ["whiteList", "blackList", "ignoreList"].forEach(function(list){ + if (oldStorage.hasOwnProperty(list)){ + newStorage[list] = ""; } });