"Error: Missing host permission for the tab" on view-source: URLs

Viewed 10111

I rewrote my extension to WebExtensions for Firefox and Google Chrome, and it works fine for HTTP/HTTPS. However, it no longer works on URLs with the view-source: scheme. (These URLs are the HTML source code of web pages shown by CTRL+U.)

Firefox 57 gives this error

Error: Missing host permission for the tab

Google Chrome 62 does apparently nothing.

There is no documentation about the view-source scheme. Is there a way to enable the extension for view-source?

3 Answers

I see the same error in a different situation:

  1. epub file opened with EPUBreader fine, but opening 'Read Aloud' extension after that results in the same error message: "missing host permission for the tab"

  2. Separately, both extensions work fine, error appear only when data are passed from the first to the second Firefox extension.

For me, this was caused by my code trying to interact with the tab before the user had interacted with my extension.

Per the doc for activeTab:

This permission is specified as "activeTab". If an extension has the activeTab permission, then when the user interacts with the extension, the extension is granted extra privileges for the active tab only.

Related