firefoxfirefox-addonjsctypesxpi

How to create a xpi file from scratchpad


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.


Solution

  • 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