Skip to content

toolness/oop-jetpack-sdk-poc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Out-of-process Jetpack SDK Proof of Concept

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published