Content scripts are not loaded in Firefox on some web pages

I develop an extension in Firefox 76.0.1 and add a content script via content_scripts in the manifest.js. I figured out that on some pages the script is not inserted into the page. For instance, https://support.mozilla.org/en-US/kb/address-bar-autocomplete-firefox
Here, no script is loaded at all.
Usually, it looks like this:
Screenshot_20200525_174308
But on the mentioned pages it looks like this in the debugging tool:
Screenshot_20200525_174503

I found this issue:
Stackoverflow: Firefox content script not loading in some pages, where the problem was a Content-Security-Policy in the header of the page.
But I don’t have such policy in my headers.

Does anybody has an idea what is wrong here?

Are you asserting if the content script is injected solely on the fact if the debugger displays it? I remember a recent post somewhere mentioning that a bug was fixed where not all content scripts were shown reliably in the debugger.

Some Mozilla sites are restricted, similar to some built-in pages, and you cannot inject content scripts into them. If you are using the about:debugging page => Inspect => Console, you may see a specific reference to lacking the host permission to inject into the page. (I don’t know where else it would appear.)

SUMO is in extensions.webextensions.restrictedDomains which is user-editable, unlike the built-in pages issue.

1 Like

No, I first saw that the script did not answer.
Thanks for that remark.

1 Like

Indeed, in this case it was the restricted domains :slight_smile:
Thank you very much.