From c71646d2952feedd36f7b1e9b4239d091f027d30 Mon Sep 17 00:00:00 2001 From: Ray Lothian Date: Sun, 6 Sep 2020 09:57:47 +0200 Subject: [PATCH] fixes #90 --- extension/common.js | 30 +++++++++++++++++------------- extension/data/popup/index.js | 3 ++- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/extension/common.js b/extension/common.js index 38cd2f0..98b3e4c 100644 --- a/extension/common.js +++ b/extension/common.js @@ -89,18 +89,23 @@ chrome.storage.local.get(prefs, ps => { }); // update prefs.ua from the managed storage - chrome.storage.managed.get({ - ua: '' - }, rps => { - if (!chrome.runtime.lastError && rps.ua) { - chrome.storage.local.set({ - ua: rps.ua - }); - } - else { - ua.update(undefined, undefined, DCSI); - } - }); + try { + chrome.storage.managed.get({ + ua: '' + }, rps => { + if (!chrome.runtime.lastError && rps.ua) { + chrome.storage.local.set({ + ua: rps.ua + }); + } + else { + ua.update(undefined, undefined, DCSI); + } + }); + } + catch (e) { + ua.update(undefined, undefined, DCSI); + } }); if (chrome.browserAction.setBadgeBackgroundColor) { // FF for Android @@ -409,7 +414,6 @@ function match({url, tabId, cookieStoreId = DCSI}) { s = s || expand.rules[key]; // use '*' when the hostname specific key is not found s = s || expand.rules['*']; - console.log(s); // if s is an array select a random string if (Array.isArray(s)) { s = s[Math.floor(Math.random() * s.length)]; diff --git a/extension/data/popup/index.js b/extension/data/popup/index.js index 8526da9..6e7f778 100644 --- a/extension/data/popup/index.js +++ b/extension/data/popup/index.js @@ -146,7 +146,8 @@ function update(ua) { else { throw Error('OS is not found'); } - }).finally(() => { + // FF 55.0 does not support finally + }).catch(() => {}).then(() => { parent.dataset.loading = false; }); }