This is Benjamin Smedberg's hacked-up proof-of-concept XPI from the Jetpack-Electrolysis Integration Bug converted into a Jetpack package. The original XPI was forged during a late-night hack session at the 2010 Mozilla Summit in Whistler, Canada.
Note that this experiment doesn't require any changes to the Jetpack SDK: it just does all out-of-process work in an add-on. It's intended to familiarize Jetpack platform developers with how out-of-process communication works, so as to help us figure out how to integrate support for out-of-process add-ons into the Jetpack platform itself.
Activate your SDK and clone this git repository in the
packagessubdirectory of your SDK and enter it:
git clone git://github.com/toolness/oop-jetpack-sdk-poc.git
Run the addon against your installation of the latest Firefox nightly. On OS X systems, you'll need to type something like this:
cfx run -a firefox -b /Applications/Minefield.app
Once Firefox starts up, you should see a widget at the bottom of the browser labeled "Click me!" (it may be truncated due to size constraints). Do what it says.
The widget label should change to "..." for a moment and then change to the Twitter status of toolness.
The add-on's entry point is in
lib/start-remote.js. This code
nsIJetpackService to create a
nsIJetpack, which represents a remote process. It
also sets up some message receivers that the remote process can
All code executed in the remote process is contained in the
remote-js directory. Within it are two
subdirectories containing privileged (a.k.a. "chrome") code and
less-privileged (a.k.a. "sub-chrome") code.
remote-js/chrome/core.js manages communication
with the parent process and has access to privileged message-sending
globals that sub-chrome code doesn't have.
remote-js/sub-chrome/main.js would typically be
the code written by an add-on developer—that is, it's the code
that would normally be in
lib/main.js, were the Jetpack SDK to
support Electrolysis out-of-the-box.