Template:jsapi ref callback return values

by 2 contributors:
<%
// This template should only be used on two pages:
//
//  * SpiderMonkey/JSAPI_Reference/JS_SetOperationCallback
//  * SpiderMonkey/JSAPI_Reference/JS_SetBranchCallback
//
// It contains text that should appear on both pages.

var lang = env.locale;

var setPendUrl = "/" + lang + "/docs/SpiderMonkey/JSAPI_Reference/JS_SetPendingException";
%>
<p>If the callback returns <code>JS_TRUE</code>, the JS engine continues to execute the script.</p>

<p>If the callback raises an exception using <code><a title="JS_SetPendingException()"
href="<%=setPendUrl%>">JS_SetPendingException()</a></code> and returns <code>JS_FALSE</code>, 
then the JavaScript engine propagates the exception to the script that was executing at the time.</p>

<p>If the callback returns <code>JS_FALSE</code> <em>without</em> raising an exception, then the
JavaScript engine immediately stops running the script with an uncatchable error. The engine does 
not execute <code>finally</code> blocks in this case; this is the same behavior as any native 
method or callback.</p>
Search for pages that use Template:jsapi ref callback return values to see example use cases and how many pages use this macro.

Document Tags and Contributors

Tags: 
Contributors to this page: Sheppy, Jorend
Last updated by: Sheppy,