Changes

Jump to: navigation, search

Labs/Jetpack/JEP/25

1,049 bytes added, 00:59, 15 September 2009
Added sample code.
* An easy-to-learn documentation system capable of producing beautiful documentation.
* A mechanism for tracking objects of interest belonging to the Chrome Booster to aid in memory profiling and leak detection.
 
= Potential Code =
 
This code doesn't actually work; it's just aspirational.
 
Assume that the following code is contained in a file at <tt>chrome://some_extension/content/foo.html</tt>.
 
<pre>
<html>
<!-- This script makes the SecurableModule global available. -->
<script src="securable-module.js"></script>
<script>
// Create a loader for SecurableModules that gives them chrome
// privileges by default and roots the filesystem at (our URL)/lib.
var loader = SecurableModule.Loader({defaultPrincipal: "system",
rootPath: "lib"});
 
// Load the 'foo' SecurableModule and call its exported doSomething()
// function.
loader.require('blarg').doSomething();
 
window.addEventListener(
"unload",
function() {
// Send an unload signal to free any resources created by modules so
// far.
loader.require('unload').send();
},
false
);
</script>
</html>
</pre>
 
Note that the <tt>unload</tt> module conventions are laid out by the [http://narwhaljs.org/narwhal.html Narwhal] CommonJS-based platform.
874
edits

Navigation menu