Labs/Jetpack/JEP/31: Difference between revisions

Jump to navigation Jump to search
added 'undocumented features' section
m (changed draft template)
(added 'undocumented features' section)
Line 193: Line 193:
<pre>info: executing 'test-hardmath.testAdditionWorks'
<pre>info: executing 'test-hardmath.testAdditionWorks'
info: pass: hard addition should work.
info: pass: hard addition should work.
</pre>
= Undocumented Features =
A number of features of cfx's reference implementation remain to be documented. Among them are:
* It's possible to build and load XPCOM binary components that are specific both to the host operating system ''and'' the host Gecko platform version.
* Modules in cfx-built packages actually have another global injected into them called <tt>packaging</tt>, which gives them access to package metadata and allows them to create sandboxed module loaders whose lifetime isn't tied to the lifetime of the containing XULRunner application.
* It's possible to use the <tt>--templatedir</tt> option to <tt>cfx</tt> to use a cfx configuration from an existing extension.
** Copy the file <tt>python-lib/cuddlefish/app-extension/components/harness.js</tt> to your extension's <tt>components</tt> directory.
** Access a module for your package via code like this, where <tt>moduleName</tt> is the name of the module and <tt>id</tt> is the value of <tt>"id"</tt> from your package's <tt>package.json</tt> file:
<pre class="brush:js;">
var module = Cc['@mozilla.org/harness/service;1?id=' + id]
            .getService().wrappedJSObject.loader
            .require(moduleName);
</pre>
</pre>
874

edits

Navigation menu