I recently worked on a firebug extension. As such it is also a Firefox bootstrap extension. However, I needed some of the modules provided by the jetpack SDK and here is how I used it.
Get the loader
The first set is to get the CommonJs jetpack loader and configure it so that it can be used to load jetpack modules. This should be done inside the bootstrap.js file
##Use it It should be as simple as calling the ‘require’ function, but it is not really. What you need to know is that the loader initialisation takes time, and not completely sequential. What I mean by that is: if you try to call the require function on line 32 of the previous snippet, it will fail. What you need to do it to call it from a different file or try invoking it with a setTimeout.
Another thing to consider is that, in a jetpack addon, jetpack initializes some variables and services that may be used by the module you are trying to load. In that case, if you try to use that very same module, you will probably end up having unusual behaviour.
One of those module is the window module which is needed by the page-worker module.
Thanks to ZERO for helping out with this.
Loader MDN doc