2

I have developed my add-on in scratchpad environment and now developing is finished and I want to create final xpi file.

I replace only this:

Cu.import('resource://gre/modules/ctypes.jsm');

by this:

var {Cu} = require("chrome");
var{ctypes} = Cu.import("resource://gre/modules/ctypes.jsm", null);

Then using nodejs (jpm init and jpm xpi commands) I created xpi file however this is not worked properly.

Hosein Aqajani
  • 1,553
  • 4
  • 26
  • 46
  • Hey man I missed you!Just got back from gym jump on irc ill help you out :) It'll be more performant if we run it from a worker so it doesnt interfere with main thread perf. – Noitidart Sep 21 '15 at 11:04
  • 1
    Issue solved helped him over irc. lets delete this topic so we dont have a fake number of "unanswered topics" it doesnt look good :P – Noitidart Sep 21 '15 at 13:37
  • I think it is better to keep this question and provide some guides for this conversion. Since there is not any good tutorial in this scope, this is very good to provide a step by step procedure. thanks – Hosein Aqajani Sep 22 '15 at 07:39

1 Answers1

1

What we did was follow the jpm tutorial: https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Getting_Started_%28jpm%29 and https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/jpm#Installation

I did this on a Windows system:

  1. we downloaded node.js
  2. npm came with it
  3. created a directory, in this directory i did jpm-init from command line
  4. filled out the prompts then filled in the code for the addon:

We then created a similiar addon to this demo addon here: https://github.com/Noitidart/jpm-chromeworker

I cant share the actuall addon as that was personal to the user. But the above is simpler and shows how to do it.

We did our jsctypes in a chromeworker, and have it communicate with index.js via messaging

Noitidart
  • 35,443
  • 37
  • 154
  • 323