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,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)];

View file

@ -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;
});
}