Labs/Jetpack/JEP/28: Difference between revisions

Jump to navigation Jump to search
→‎Modules: documented securable-module.Loader
(added information about memory metadata objects)
(→‎Modules: documented securable-module.Loader)
Line 135: Line 135:


The following modules come built-in with Cuddlefish and can be retrieved with a call to <tt>require()</tt>.
The following modules come built-in with Cuddlefish and can be retrieved with a call to <tt>require()</tt>.
=== <tt>securable-module</tt> ===
The <tt>securable-module</tt> module allows for the recursive loading and sandboxing of SecurableModules. This allows, for instance, the creation of "mini platforms" that manage the sandboxed evaluation of code.
The implementation of this module is actually the same implementation underlying Cuddlefish itself; for more information, see [[Labs/Jetpack/JEP/25|JEP 25]].
<tt>securable-module.'''Loader'''(''options'')</tt>
Creates a new SecurableModule loader. ''options'' is an object with any of the following keys:
{|cellpadding="5" cellspacing="0" border="1" width="100%"
|<tt>rootPaths</tt>
|A list of absolute URLs that will be searched, in order, for SecurableModules when <tt>require()</tt> is called by any code executing within the context of the loader.
|-
|<tt>rootPath</tt>
|A single absolute URL; this is a convenience option, synonymous with setting <tt>rootPaths</tt> to an array containing a single URL.
|-
|<tt>defaultPrincipal</tt>
|A string representing the default principal given to any code that is executed by the loader. This can be <tt>"system"</tt>, in which case code executed has full chrome access (including access to the <tt>Components</tt> object which allows it to access the Mozilla platform unrestricted). Alternatively, it can be a URL, such as <tt><nowiki>"http://www.foo.com"</nowiki></tt>, in which case it is treated like web content. If left unspecified, the default value of this option is <tt><nowiki>"http://www.mozilla.org"</nowiki></tt>.
|-
|<tt>globals</tt>
|An object containing the names and values of all variables that will be injected into the global scope of all code executed by the loader.
|}


=== <tt>timer</tt> ===
=== <tt>timer</tt> ===
874

edits

Navigation menu