I'm developing an extension that involves both a background script and a content script. The content script gets the selected text from webpages, when the user clicks on the extension's relative menu entry and then sends it to the background script for further processing.
Here is the relative section of the manifest.json:
"background": {
"scripts": ["background.js"]
},
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["content.js"]
}
]
I load the extension in about:debugging > This Firefox > Load Temporary Add-on... in order to test it.
In the code I send a message from the background script to the content script but that throws an error:
Uncaught (in promise) Error: Could not establish connection. Receiving end does not exist
I checked by using the Debugger, in about:devtools-toolbox and I found out that only the background script loads.
Does anyone have an idea what makes the content script to fail to load and what would the solution be?