console.log("background.js started!"); function handlePageactionClick(tab, onClickData) { console.log("background.js: executing content script"); let executing = browser.tabs.executeScript({file: "/contentscript.js"}) executing.then(onExecuted, onExecutionError); } function onExecuted(result) { console.log(`background.js: content script execution successful with result: ${result}`); } function onExecutionError(error) { console.error(`background.js: The following error occured while executing a content script: ${error}`); } // add listener for the extension button browser.pageAction.onClicked.addListener(handlePageactionClick);