This commit is contained in:
Ray Lothian 2020-09-06 09:57:47 +02:00
parent 486629ad0c
commit c71646d295
2 changed files with 19 additions and 14 deletions

View file

@ -89,6 +89,7 @@ chrome.storage.local.get(prefs, ps => {
}); });
// update prefs.ua from the managed storage // update prefs.ua from the managed storage
try {
chrome.storage.managed.get({ chrome.storage.managed.get({
ua: '' ua: ''
}, rps => { }, rps => {
@ -101,6 +102,10 @@ chrome.storage.local.get(prefs, ps => {
ua.update(undefined, undefined, DCSI); ua.update(undefined, undefined, DCSI);
} }
}); });
}
catch (e) {
ua.update(undefined, undefined, DCSI);
}
}); });
if (chrome.browserAction.setBadgeBackgroundColor) { // FF for Android if (chrome.browserAction.setBadgeBackgroundColor) { // FF for Android
@ -409,7 +414,6 @@ function match({url, tabId, cookieStoreId = DCSI}) {
s = s || expand.rules[key]; s = s || expand.rules[key];
// use '*' when the hostname specific key is not found // use '*' when the hostname specific key is not found
s = s || expand.rules['*']; s = s || expand.rules['*'];
console.log(s);
// if s is an array select a random string // if s is an array select a random string
if (Array.isArray(s)) { if (Array.isArray(s)) {
s = s[Math.floor(Math.random() * s.length)]; s = s[Math.floor(Math.random() * s.length)];

View file

@ -146,7 +146,8 @@ function update(ua) {
else { else {
throw Error('OS is not found'); throw Error('OS is not found');
} }
}).finally(() => { // FF 55.0 does not support finally
}).catch(() => {}).then(() => {
parent.dataset.loading = false; parent.dataset.loading = false;
}); });
} }