JS_LeaveLocalRootScope

  • Revision slug: SpiderMonkey/JSAPI_Reference/JS_LeaveLocalRootScope
  • Revision title: JS_LeaveLocalRootScope
  • Revision id: 75384
  • Created:
  • Creator: Jorend
  • Is current revision? No
  • Comment no wording changes; page display name changed to 'JS_LeaveLocalRootScope'

Revision Content

{{ Jsapi_ref_header("JS_LeaveLocalRootScope") }}

Leave a local root scope.

Syntax

void JS_LeaveLocalRootScope(JSContext *cx);
Name Type Description
cx JSContext * Pointer to the context. This must be the same context passed to JS_EnterLocalRootScope(). {{ Jsapi-requires-request() }}

Description

See JS_EnterLocalRootScope for an explanation of local root scopes.

Leaving a nested local root scope causes all objects created since the matching JS_EnterLocalRootScope call to become subject to garbage collection. That is, they are not transferred to the enclosing local root scope. However, JS_LeaveLocalRootScopeWithResult provides a way to transfer one value to the enclosing local root scope.

{{ LXRSearch("ident", "i", "JS_LeaveLocalRootScope") }}

Revision Source

<p>{{ Jsapi_ref_header("JS_LeaveLocalRootScope") }}
</p><p>Leave a local root scope.
</p>
<h3 name="Syntax"> Syntax </h3>
<pre class="eval">void <strong>JS_LeaveLocalRootScope</strong>(<a href="/en/JSRuntime" title="en/JSRuntime">JSContext</a> *cx);
</pre>
<table class="fullwidth-table">
<tbody><tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td><code>cx</code></td>
<td><code><a href="/en/JSRuntime" title="en/JSRuntime">JSContext</a> *</code></td>
<td>Pointer to the context. This must be the same context passed to <code><a href="/en/JS_EnterLocalRootScope" title="en/JS_EnterLocalRootScope">JS_EnterLocalRootScope</a>()</code>.
{{ Jsapi-requires-request() }}</td>
</tr>
</tbody></table>
<h3 name="Description"> Description </h3>
<p>See <code><a href="/en/JS_EnterLocalRootScope" title="en/JS_EnterLocalRootScope">JS_EnterLocalRootScope</a></code> for an explanation of local root scopes.
</p><p>Leaving a nested local root scope causes all objects created since the matching <code>JS_EnterLocalRootScope</code> call to become subject to garbage collection. That is, they are <em>not</em> transferred to the enclosing local root scope. However, <code><a href="/en/JS_LeaveLocalRootScopeWithResult" title="en/JS_LeaveLocalRootScopeWithResult">JS_LeaveLocalRootScopeWithResult</a></code> provides a way to transfer one value to the enclosing local root scope.
</p><p>{{ LXRSearch("ident", "i", "JS_LeaveLocalRootScope") }}
</p>
Revert to this revision