Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Out-of-process Jetpack SDK Proof of Concept

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 remote-js
Octocat-spinner-32 README.md
Octocat-spinner-32 package.json
README.md

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.

Requirements

Usage

  1. Activate your SDK and clone this git repository in the packages subdirectory of your SDK and enter it:

    git clone git://github.com/toolness/oop-jetpack-sdk-poc.git

    cd oop-jetpack-sdk-poc

  2. 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

  3. 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.

  4. The widget label should change to "..." for a moment and then change to the Twitter status of toolness.

Code Walkthrough

The add-on's entry point is in lib/start-remote.js. This code uses nsIJetpackService to create a nsIJetpack, which represents a remote process. It also sets up some message receivers that the remote process can communicate with.

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.

Something went wrong with that request. Please try again.