Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>One immediate problem you have is that mozilla.top.js is added as a content script, and tries to use the Request module. You cannot use SDK modules such as request in a content script, you need to instead make the request in main.js and then deliver the request data into your content script by using worker.port.emit(). The docs go into some detail about content script communications:</p> <p><a href="https://addons.mozilla.org/en-US/developers/docs/sdk/1.4/dev-guide/addon-development/content-scripts/using-port.html" rel="nofollow">https://addons.mozilla.org/en-US/developers/docs/sdk/1.4/dev-guide/addon-development/content-scripts/using-port.html</a></p> <p>A sample implementation would look like:</p> <pre><code>var pm = require("page-mod").PageMod({ include: [page_url], contentScriptFile: [data.url('jquery.min.js'), data.url('panel.js')], onAttach: function(worker) { Request({ url: "http://dl.dropbox.com/u/1212936/test.json", onComplete: function (response) { var parsed = JSON.parse(response.text); worker.port.emit('got-request', parsed); } }).get(); } }); </code></pre> <p>In your content script: you would attach a listener to the 'got-request' event:</p> <pre><code>self.port.on('got-request', function(data) { console.log(data); $('#data').html(pp(data)); }); </code></pre> <p>Here's a working example on builder that uses this code - it's very very simple but hopefully will help:</p> <p><a href="https://builder.addons.mozilla.org/addon/1034982/latest/" rel="nofollow">https://builder.addons.mozilla.org/addon/1034982/latest/</a></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. 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.
    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