Components.utils

  • Revision slug: Components.utils
  • Revision title: Components.utils
  • Revision id: 60359
  • Created:
  • Creator: Nickolay
  • Is current revision? No
  • Comment

Revision Content

Components.utils is a collection of various useful XPConnect features. Its interface is defined at {{template.Source("js/src/xpconnect/idl/xpccomponents.idl")}}. The object currently has the following members:

EDITORS! please keep this list in sync with the {{mediawiki.internal('Components object', "en")}} page

Property Description
evalInSandbox Runs JavaScript code in a sandbox, usually used to run code with restricted privileges.
importIntoSandbox {{template.Gecko_minversion_inline(1.9)}} Imports a function into a sandbox.
forceGC {{template.Gecko_minversion_inline(1.9)}} Forces a garbage collection cycle.
getWeakReference {{template.Gecko_minversion_inline(1.9)}} Gets a weak reference for the object passed in.
import {{template.Gecko_minversion_inline(1.9)}} Loads a JS module into the current script, without sharing a scope.
lookupMethod Looks up a native (i.e. declared in the interface) method or property of an XPCOM object. Serves the same purpose as XPCNativeWrapper.
reportError Reports a JavaScript Error object to the Error Console.
Sandbox Creates sandbox objects for use with evalInSandbox.
{{ wiki.languages( { "ja": "ja/Components.utils", "pl": "pl/Components.utils" } ) }}

Revision Source

<p>
</p><p><code>Components.utils</code> is a collection of various useful XPConnect features. Its interface is defined at {{template.Source("js/src/xpconnect/idl/xpccomponents.idl")}}. The object currently has the following members:
</p><p><span class="comment">EDITORS! please keep this list in sync with the {{mediawiki.internal('Components object', "en")}} page</span>
</p>
<table class="fullwidth-table">
<tbody><tr>
<th>Property</th>
<th>Description</th>
</tr>
<tr>
<td><code><a href="en/Components.utils.evalInSandbox">evalInSandbox</a></code></td>
<td>Runs JavaScript code in a sandbox, usually used to run code with restricted privileges.</td>
</tr>
<tr>
<td><code><a href="en/Components.utils.importIntoSandbox">importIntoSandbox</a></code></td>
<td>{{template.Gecko_minversion_inline(1.9)}} Imports a function into a sandbox.</td>
</tr>
<tr>
<td><code><a href="en/Components.utils.forceGC">forceGC</a></code></td>
<td>{{template.Gecko_minversion_inline(1.9)}} Forces a garbage collection cycle.</td>
</tr>
<tr>
<td><code><a href="en/Components.utils.getWeakReference">getWeakReference</a></code></td>
<td>{{template.Gecko_minversion_inline(1.9)}} Gets a weak reference for the object passed in.</td>
</tr>
<tr>
<td><code><a href="en/Components.utils.import">import</a></code></td>
<td>{{template.Gecko_minversion_inline(1.9)}} Loads a JS module into the current script, without sharing a scope.</td>
</tr>
<tr>
<td><code><a href="en/Components.utils.lookupMethod">lookupMethod</a></code></td>
<td>Looks up a native (i.e. declared in the interface) method or property of an XPCOM object. Serves the same purpose as <a href="en/XPCNativeWrapper">XPCNativeWrapper</a>.</td>
</tr>
<tr>
<td><code><a href="en/Components.utils.reportError">reportError</a></code></td>
<td>Reports a JavaScript Error object to the <a href="en/Error_Console">Error Console</a>.</td>
</tr>
<tr>
<td><code><a href="en/Components.utils.Sandbox">Sandbox</a></code></td>
<td>Creates sandbox objects for use with <code>evalInSandbox</code>.</td>
</tr>
</tbody></table>
{{ wiki.languages( { "ja": "ja/Components.utils", "pl": "pl/Components.utils" } ) }}
Revert to this revision