I am trying to write a Firefox Addon which enters the Password to a protected PDF on a website automatically. The Javascript to do this is very straightforward & already works perfectly if entered in the Browser command line. It just doesnt get executed when relying on the Addon.
I tested by replacing all the Javascript with just console.log('Works!');
If i enter any part of the site normally, the String indeed shows up in the console as expected.
But if i open the link to the PDF(the PDF is stored on the same website), it simply refuses to execute.
I dont even gey any error messages or anything.
Any hint in the right direction would be appreciated!
Your extension can execute content scripts in the context of web pages.
But PDF documents, even when hosted on web servers, are not web pages. They are displayed by the browser in a different context (the builtin pdf viewer) with elevated privileges.
Access to that context by an extension would be a security disaster.
Perhaps the documentation should reflect that (like "about:debugging
" or "about:addons
") every tab displaying a pdf is a privileged browser page, where an extension cannot load scripts.