From 2f42cf61abd4b7ccc51d79ccb6924220db5f7c5f Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sun, 19 Mar 2023 07:25:06 -0400 Subject: [PATCH] Properly handle potential exception from webext API Related feedback: - https://github.com/uBlockOrigin/uAssets/discussions/16939#discussioncomment-5356808 --- platform/common/vapi-background.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/platform/common/vapi-background.js b/platform/common/vapi-background.js index 836cca3f0..3de888847 100644 --- a/platform/common/vapi-background.js +++ b/platform/common/vapi-background.js @@ -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 {