From 4b73c3669a0422ee4863411df9fa6d7a67850447 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 26 Sep 2022 12:50:06 +1000 Subject: typo about returns string or pair in checkScriptAndUpdateReport --- main_background.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'main_background.js') diff --git a/main_background.js b/main_background.js index 361a933..56d9c91 100644 --- a/main_background.js +++ b/main_background.js @@ -369,11 +369,11 @@ async function onTabActivated({ tabId }) { * Checks script and updates the report entry accordingly. * * Asynchronous function, returns the final edited script as a - * string, or an array containing it and -1, if returnsPair is true + * string, or an array containing it and -1, if returnsString is false */ -async function checkScriptAndUpdateReport(scriptSrc, url, tabId, whitelisted, returnsPair = true, isExternal = false) { +async function checkScriptAndUpdateReport(scriptSrc, url, tabId, whitelisted, returnsString = true, isExternal = false) { function result(scriptSource) { - return returnsPair ? scriptSource : [scriptSource, -1]; + return returnsString ? scriptSource : [scriptSource, -1]; } const scriptName = url.split('/').pop(); @@ -547,11 +547,9 @@ var ResponseHandler = { * Here we handle external script requests */ async function handle_script(response, whitelisted) { - let { text, request } = response; - let { url, tabId } = request; - url = ListStore.urlItem(url); - let edited = await checkScriptAndUpdateReport(text, url, tabId, whitelisted, returnsPair = false, isExternal = true); - return Array.isArray(edited) ? edited[0] : edited; + const { text, request } = response; + const { url, tabId } = request; + return await checkScriptAndUpdateReport(text, ListStore.urlItem(url), tabId, whitelisted, returnsString = true, isExternal = true); } /** @@ -755,7 +753,7 @@ async function editHtml(html, documentUrl, tabId, frameId, whitelisted) { editedSource = dejaVu.get(source); } else { let url = `view-source:${documentUrl}#line${line}(