Properly handle potential exception from webext API

Related feedback:
- https://github.com/uBlockOrigin/uAssets/discussions/16939#discussioncomment-5356808
This commit is contained in:
Raymond Hill 2023-03-19 07:25:06 -04:00
parent 6e87026d40
commit 2f42cf61ab
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 7 additions and 4 deletions

View File

@ -1383,10 +1383,13 @@ vAPI.adminStorage = (( ) => {
},
};
}
const cacheManagedStorage = ( ) => {
webext.storage.managed.get().then(store => {
webext.storage.local.set({ cachedManagedStorage: store || {} });
});
const cacheManagedStorage = async ( ) => {
let store;
try {
store = await webext.storage.managed.get();
} catch(ex) {
}
webext.storage.local.set({ cachedManagedStorage: store || {} });
};
return {