Changes

Jump to: navigation, search

Labs/Jetpack/JEP/25

1,777 bytes added, 15:21, 16 September 2009
added problem statement
== Description and Rationale Problem Statement ==
It's currently difficult to share JavaScript code between different contexts in the Mozilla platform: * Code written for the web, for instance, is difficult to load into a JS module, while JS modules and XPCOM components that don't use privileged functionality are impossible to load into web content without nontrivial modifications. * JS modules and XPCOM components can't be unloaded and reloaded during the host application's runtime, which means that modifying a single line of their code requires a complete application restart. * XPCOM components are extremely verbose and unfamiliar to those accustomed to traditional web development. * JS modules have no concept of exporting chrome functionality to untrusted or semi-trusted code and vice versa. * To further complicate matters, both XPCOM components and JS modules can't be easily reused in non-Mozilla contexts such as privileged server-side components like [http://www.helma.org/ Helma] and [http://code.google.com/p/persevere-framework/ Persevere Server]. All of these problems are problems for Jetpack, and are barriers to a truly vibrant code-sharing ecosystem. == Solution == [http://wiki.commonjs.org/wiki/CommonJS CommonJS] is a grassroots group of JavaScript enthusiasts and professionals who are creating a common set of standards to make code easier to reuse. One such standard is [http://wiki.commonjs.org/wiki/CommonJS/Modules/SecurableModules SecurableModule], which provides a simple yet elegant module mechanism that works in any kind of context, including the web. <b>Chrome Boosters</b> are third-party modules a superset of the SecurableModule standard that can solve some issues specific to the Mozilla platform, and are intended to be used to provide functionality to from both Jetpack Features or any and XULRunner extension extensions (e.g., Firefox/Thunderbird add-ons). Our hope is that, aside from solving the aforementioned problems, this mechanism will enable a vibrant code-sharing ecosystem that includes Jetpack developers, Add-on developers, and the greater JavaScript community as a whole.
As their name implies, they are chrome-privileged and can use dependency injection to offer functionality to non-chrome-privileged Jetpacks&mdash;or, if used in a XULRunner extension, they can be used to provide functionality to other chrome-privileged code.
Chrome Boosters have the following characteristics:
* They are a superset of the CommonJS [http://wiki.commonjs.org/wiki/CommonJS/Modules/SecurableModules SecurableModule] standard.
* They can be loaded and unloaded multiple times throughout the lifetime of their containing application (yes, leaks are an unfortunate possibility).
* They have the ability to register callbacks that perform cleanup tasks when unloaded.
874
edits

Navigation menu