Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 729
Andrew Avatar asked Nov 27 '17 04:11

Andrew


1 Answers

I haven't dabbled too much in extensions but since the error involves Host permissions in firefox, check the Host permissions:

In Firefox, from version 56 onwards, extensions automatically get host permissions for their own origin, which is of the form:

moz-extension://60a20a9b-1ad4-af49-9b6c-c64c98c37920/
where 60a20a9b-1ad4-af49-9b6c-c64c98c37920 is the extension's internal ID. The extension can get this URL programmatically by

calling extension.getURL():

browser.extension.getURL("");
// moz-extension://60a20a9b-1ad4-af49-9b6c-c64c98c37920/
like image 146
noogui Avatar answered Nov 14 '22 14:11

noogui