mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-02 00:42:45 +01:00
Properly handle promise rejection from webext.storage.local() API
Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/2604
This commit is contained in:
parent
8939a68e6d
commit
54cb5e2232
@ -63,10 +63,26 @@ const storageLocal = webext.storage.local;
|
||||
|
||||
const cacheStorage = {
|
||||
name: 'browser.storage.local',
|
||||
get: storageLocal.get.bind(storageLocal),
|
||||
set: storageLocal.set.bind(storageLocal),
|
||||
remove: storageLocal.remove.bind(storageLocal),
|
||||
clear: storageLocal.clear.bind(storageLocal),
|
||||
get: (...args) => {
|
||||
return storageLocal.get(...args).catch(reason => {
|
||||
console.log(reason);
|
||||
});
|
||||
},
|
||||
set: (...args) => {
|
||||
return storageLocal.set(...args).catch(reason => {
|
||||
console.log(reason);
|
||||
});
|
||||
},
|
||||
remove: (...args) => {
|
||||
return storageLocal.remove(...args).catch(reason => {
|
||||
console.log(reason);
|
||||
});
|
||||
},
|
||||
clear: (...args) => {
|
||||
return storageLocal.clear(...args).catch(reason => {
|
||||
console.log(reason);
|
||||
});
|
||||
},
|
||||
// Not all platforms support getBytesInUse
|
||||
getBytesInUse: storageLocal.getBytesInUse
|
||||
? storageLocal.getBytesInUse.bind(storageLocal)
|
||||
|
@ -265,7 +265,7 @@ const onUserSettingsReady = fetched => {
|
||||
// https://github.com/uBlockOrigin/uBlock-issues/issues/1365
|
||||
// Wait for removal of invalid cached data to be completed.
|
||||
|
||||
const onCacheSettingsReady = async fetched => {
|
||||
const onCacheSettingsReady = async (fetched = {}) => {
|
||||
if ( fetched.compiledMagic !== µb.systemSettings.compiledMagic ) {
|
||||
µb.compiledFormatChanged = true;
|
||||
µb.selfieIsInvalid = true;
|
||||
|
Loading…
Reference in New Issue
Block a user