From f792087171175d70f660aa9d400a67f3a9cb36f3 Mon Sep 17 00:00:00 2001 From: Ray Lothian Date: Thu, 6 Aug 2020 07:14:37 +0200 Subject: [PATCH] fixes https://add0n.com/useragent-switcher.html#IDComment1092262901 --- extension/data/popup/index.js | 21 ++++++++++----------- extension/manifest.json | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/extension/data/popup/index.js b/extension/data/popup/index.js index fd1c5af..750f3d5 100644 --- a/extension/data/popup/index.js +++ b/extension/data/popup/index.js @@ -60,18 +60,19 @@ function sort(arr) { } function get(path) { + const cf = Promise.resolve({ + match() { + return Promise.resolve(); + }, + add() { + return Promise.resolve(); + } + }); return (typeof caches !== 'undefined' ? caches : { open() { - return Promise.resolve({ - match() { - return Promise.resolve(); - }, - add() { - return Promise.resolve(); - } - }); + return cf; } - }).open('agents').then(cache => { + }).open('agents').catch(() => cf).then(cache => { const link = 'https://cdn.jsdelivr.net/gh/ray-lothian/UserAgent-Switcher/node/' + path; // updating agents once per 7 days chrome.storage.local.get({ @@ -255,7 +256,6 @@ document.addEventListener('click', ({target}) => { } if (value !== navigator.userAgent) { // prevent a container ua string from overwriting the default one - console.log(tab); if ('cookieStoreId' in tab && tab.cookieStoreId !== DCSI) { chrome.runtime.getBackgroundPage(bg => bg.ua.update(value, undefined, tab.cookieStoreId)); chrome.storage.local.get({ @@ -263,7 +263,6 @@ document.addEventListener('click', ({target}) => { }, prefs => { prefs['container-uas'][tab.cookieStoreId] = value; chrome.storage.local.set(prefs); - console.log(prefs); }); } else { diff --git a/extension/manifest.json b/extension/manifest.json index f0313f6..1522d4a 100755 --- a/extension/manifest.json +++ b/extension/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "User-Agent Switcher and Manager", "short_name": "useragent-switcher", - "version": "0.4.0", + "version": "0.4.0.1", "description": "Spoof websites trying to gather information about your web navigation to deliver distinct content you may not want",