Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's important to realize the separation between chrome scripts and content scripts. Chrome scripts are those that run with the same security privileges as Firefox - they have full access to Firefox and your computer. Content scripts are those that run with the same privileges as web pages. They can mess around with that web page, but are severely restricted otherwise. To maintain security, <a href="https://addons.mozilla.org/en-US/developers/docs/sdk/latest/modules/sdk/page-mod.html#Communicating%20With%20Content%20Scripts" rel="noreferrer">the way these two types of scripts can communicate is limited</a>. You wouldn't want a web page to be able to call any function it wants in your extension's internal code!</p> <p>Your main JS file (the one that includes <code>require('sdk/page-mod')</code>) is a chrome script. What you're injecting (<code>contentScript</code>) is (obviously) a content script. They can't communicate through a direct function call as you're doing.</p> <p>If your <code>getImgData</code> function is something that can be done with normal web page privileges, you can move your definition of it to within the content script. If it requires additional privileges, you must have your content script communicate with your chrome script via the <code>emit</code> and <code>on</code> functions as described in the link above.</p> <p>If you are going to make your content script any longer, I would recommend you <a href="https://addons.mozilla.org/en-US/developers/docs/sdk/latest/modules/sdk/page-mod.html" rel="noreferrer">separate it into its own file</a> to make your life easier.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload