Created attachment 8753253 [details] Untitled.png User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0 Build ID: 20160516030211 Steps to reproduce: In a content script have a chrome object being called such as chrome.runtime. Actual results: When the code is then run an error is produced in the console. "ReferenceError: chrome is not defined" Expected results: The code should be executed.
OS: Unspecified → Windows 10
Hardware: Unspecified → x86_64
Can you please attach the add-on that is triggering this?
If you go to the website https://www.mousehuntgame.com/login.php with the plugin installed even without logging in you should see the error in console. What is weird though it runs once and works and the next time it runs comes up with the reference error. Any questions just ask
The problem is that you're also loading the script into the page itself, where privileged extension APIs are not available.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → INVALID
(In reply to Kris Maglione [:kmag] from comment #4) > The problem is that you're also loading the script into the page itself, > where privileged extension APIs are not available. Ah I see. Is there a way to get around this i am trying to port an extension as you can see?
You can't access extension APIs from a script that you inject into a page. I wouldn't expect this to work any better on Chrome. What exactly are you trying to achieve by injecting that script into the content document?
(In reply to Kris Maglione [:kmag] from comment #6) > You can't access extension APIs from a script that you inject into a page. I > wouldn't expect this to work any better on Chrome. > > What exactly are you trying to achieve by injecting that script into the > content document? I was not the original writer of this code so i am not sure why it injects into the page. I will talk to the original developer about why this happens. When running the code in chrome it does not appear to give any errors with this code however.
You need to log in before you can comment on or make changes to this bug.