From ff57f01026f1b98ca9d9a8bb36386ae9dfd3eae3 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sun, 22 Sep 2024 12:14:52 -0400 Subject: [PATCH] Code review of fix re "internal error" Related issue: https://github.com/uBlockOrigin/uBOL-home/issues/199 --- platform/mv3/extension/js/background.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/platform/mv3/extension/js/background.js b/platform/mv3/extension/js/background.js index f0f6cb6cd..17cfff4bc 100644 --- a/platform/mv3/extension/js/background.js +++ b/platform/mv3/extension/js/background.js @@ -388,15 +388,14 @@ async function start() { // https://github.com/uBlockOrigin/uBOL-home/issues/199 // Force a restart of the extension once when an "internal error" occurs -try { - start(); +start().then(( ) => { localWrite({ goodStart: true }); -} catch(reason) { +}).catch(reason => { console.trace(reason); - localRead.get('goodStart').then((bin = {}) => { - if ( bin.goodStart !== true ) { return; } + localRead('goodStart').then((bin = {}) => { + if ( bin.goodStart === false ) { return; } localWrite({ goodStart: false }).then(( ) => { runtime.reload(); }); }); -} +});