From 2aec173c94831dedd4b2c76b15e2046cda1ecae6 Mon Sep 17 00:00:00 2001 From: ysard Date: Sun, 11 Nov 2018 04:39:50 +0100 Subject: [PATCH] Last fix for #44; default value for undefined variable --- src/api.js | 5 ++++- src/background-script.js | 6 ++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/api.js b/src/api.js index ccef393..30c8a37 100644 --- a/src/api.js +++ b/src/api.js @@ -220,6 +220,8 @@ vAPI.get_all_cookies = function(storeIds) { // because it is less complex and removes much more items let filtered_cookies = []; if (vAPI.query_domain == "") { + // vAPI.query_domain is empty: get_all_cookies() is called from background script + // in case of deletion on boot or there is no domain searched. filtered_cookies = cookies; } else { for (let cookie of cookies) { @@ -235,6 +237,7 @@ vAPI.get_all_cookies = function(storeIds) { } else reject("all_cookies-NoCookies"); }) + .catch(err => console.error(err)); }); } @@ -740,7 +743,7 @@ vAPI.date_format = "DD-MM-YYYY HH:mm:ss"; vAPI.optimal_window_width = 1095; vAPI.optimal_window_height = 585; -vAPI.query_domain; +vAPI.query_domain = ""; vAPI.query_names; vAPI.query_values; diff --git a/src/background-script.js b/src/background-script.js index 0b99803..a60a128 100644 --- a/src/background-script.js +++ b/src/background-script.js @@ -49,8 +49,6 @@ function init_options() { delete_all_on_restart: false, }); get_settings.then((items) => { - console.log({storage_data: items}); - // Load protected_cookies protected_cookies = vAPI.get_and_patch_protected_cookies(items); @@ -59,8 +57,8 @@ function init_options() { if (items.delete_all_on_restart) setTimeout(function() { vAPI.get_stores().then((stores) => { - let deletion_promise = vAPI.delete_cookies(vAPI.get_all_cookies()); - deletion_promise.then(null, vAPI.onError); + vAPI.delete_cookies(vAPI.get_all_cookies()) + .catch(vAPI.onError); }); }, 2000); });