fixes #90
This commit is contained in:
parent
486629ad0c
commit
c71646d295
2 changed files with 19 additions and 14 deletions
|
@ -89,18 +89,23 @@ chrome.storage.local.get(prefs, ps => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// update prefs.ua from the managed storage
|
// update prefs.ua from the managed storage
|
||||||
chrome.storage.managed.get({
|
try {
|
||||||
ua: ''
|
chrome.storage.managed.get({
|
||||||
}, rps => {
|
ua: ''
|
||||||
if (!chrome.runtime.lastError && rps.ua) {
|
}, rps => {
|
||||||
chrome.storage.local.set({
|
if (!chrome.runtime.lastError && rps.ua) {
|
||||||
ua: rps.ua
|
chrome.storage.local.set({
|
||||||
});
|
ua: rps.ua
|
||||||
}
|
});
|
||||||
else {
|
}
|
||||||
ua.update(undefined, undefined, DCSI);
|
else {
|
||||||
}
|
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)];
|
||||||
|
|
|
@ -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;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue