From 93d8e639ce91b633cd585b0e031ec52cd77413bc Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 23 May 2025 09:49:07 -0400 Subject: [PATCH] [mv3] Code review last commit Related commit: https://github.com/gorhill/uBlock/commit/2076d4223994aa5f9b8be3bf65f13e91eb932d98 --- platform/mv3/extension/js/scripting-manager.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/platform/mv3/extension/js/scripting-manager.js b/platform/mv3/extension/js/scripting-manager.js index 810d0cae0..4b0b0d592 100644 --- a/platform/mv3/extension/js/scripting-manager.js +++ b/platform/mv3/extension/js/scripting-manager.js @@ -612,22 +612,24 @@ async function registerInjectables() { if ( toRemove.length !== 0 ) { ubolLog(`Unregistered ${toRemove} content (css/js)`); - await browser.scripting.unregisterContentScripts({ ids: toRemove }).then(( ) => { + try { + await browser.scripting.unregisterContentScripts({ ids: toRemove }); localRemove('$scripting.unregisterContentScripts'); - }).catch(reason => { + } catch(reason) { localWrite('$scripting.unregisterContentScripts', reason); console.info(reason); - }); + } } if ( toAdd.length !== 0 ) { ubolLog(`Registered ${toAdd.map(v => v.id)} content (css/js)`); - await browser.scripting.registerContentScripts(toAdd).then(( ) => { + try { + await browser.scripting.registerContentScripts(toAdd); localRemove('$scripting.registerContentScripts'); - }).catch(reason => { + } catch(reason) { localWrite('$scripting.registerContentScripts', reason); console.info(reason); - }); + } } registerInjectables.barrier = false;