JSOPTION DONT REPORT UNCAUGHT

Obsolete since JSAPI 27
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

Enables and disables options on a JSContext, replacing all previously set options.

Syntax

uint32
JS_SetOptions(JSContext *cx, uint32 options);
Name Type Description
cx JSContext * A context on which to set options.
options uint32 The new set of options. This is the logical OR of zero or more flags described below.

Description

JS_SetOptions sets the option flags of a given JS context cx. This function returns a uint32 value containing the previous values of the flags.

To turn individual options on or off, use JS_SetOptions with JS_GetOptions:

// turn on warnings for dubious practices
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_EXTRA_WARNINGS);

// turn off those extra warnings
JS_SetOptions(cx, JS_GetOptions(cx) & ~JSOPTION_EXTRA_WARNINGS);

The options parameter and the return value are the logical OR of zero or more constants from the following table:

Option Description

JSOPTION_EXTRA_WARNINGS

Warn on dubious practice.

MXR ID Search for JSOPTION_EXTRA_WARNINGS

JSOPTION_WERROR

Convert warnings to errors.

MXR ID Search for JSOPTION_WERROR

JSOPTION_VAROBJFIX

Make JS_EvaluateScript() use the last object on its obj param's scope chain (that is, the global object) as the ECMA "variables object".

This flag is recommended.  Without it, the two scripts "x = 1" and "var x = 1", where no variable x is in scope, do two different things.  The former creates a property on the global object.  The latter creates a property on obj.  With this flag, both create a global property.

MXR ID Search for JSOPTION_VAROBJFIX

JSOPTION_PRIVATE_IS_NSISUPPORTS

Mozilla extension. The context's private data points to an XPCOM object (see nsISupports). This is only meaningful if SpiderMonkey is built with XPConnect.

MXR ID Search for JSOPTION_PRIVATE_IS_NSISUPPORTS

JSOPTION_COMPILE_N_GO

Caller of JS_CompileScript et al promises to execute the compiled script once only, in the same scope object used for compilation.  The caller may not modify objects on the scope chain between compilation and execution.  This enables compile-time scope chain resolution of consts (a performance optimization).

MXR ID Search for JSOPTION_COMPILE_N_GO

JSOPTION_ATLINE

//@line number ["filename"] option supported for the XUL preprocessor and kindred beasts.

MXR ID Search for JSOPTION_ATLINE

JSOPTION_XML

Obsolete since JSAPI 15 ECMAScript for XML (E4X) support: parse <!-- --> as a token, not backward compatible with the comment-hiding hack used in HTML script tags.

MXR ID Search for JSOPTION_XML

JSOPTION_ALLOW_XML

Added in SpiderMonkey 15 If this is off, E4X syntax isn't supported no matter what version number is set.

MXR ID Search for JSOPTION_ALLOW_XML

JSOPTION_MOAR_XML

Added in SpiderMonkey 15 ECMAScript for XML (E4X) support: parse <!-- --> as a token, not backward compatible with the comment-hiding hack used in HTML script tags. Only used if JSOPTION_ALLOW_XML is set.

MXR ID Search for JSOPTION_MOAR_XML

JSOPTION_NATIVE_BRANCH_CALLBACK

The branch callback set by JS_SetBranchCallback may be called with a null script parameter, by native code that loops intensively.

MXR ID Search for JSOPTION_NATIVE_BRANCH_CALLBACK

JSOPTION_DONT_REPORT_UNCAUGHT

When returning from the outermost API call, prevent uncaught exceptions from being converted to error reports.

MXR ID Search for JSOPTION_DONT_REPORT_UNCAUGHT

JSOPTION_RELIMIT

Added in SpiderMonkey 1.8 Throw an exception if a regular expression backtracks more than n3 times, where n is the length of the input string.

MXR ID Search for JSOPTION_RELIMIT

JSOPTION_ANONFUNFIX

Added in SpiderMonkey 1.8 Disallow function () {} in statement context, per ECMA-262 Edition 3.  This behavior is the default in releases where this option has been removed.

MXR ID Search for JSOPTION_ANONFUNFIX

JSOPTION_JIT

Obsolete since JSAPI 11 Added in SpiderMonkey 1.8.1 Enables the JIT compilation of code in the context. Note that you may currently (Jan 2009) experience bugs with this option enabled.

MXR ID Search for JSOPTION_JIT

JSOPTION_NO_SCRIPT_RVAL

Added in SpiderMonkey 1.8.1 By setting this option, the application promises to the compiler that a null rval out-param will be passed to each call to JS_ExecuteScript.

MXR ID Search for JSOPTION_NO_SCRIPT_RVAL

JSOPTION_UNROOTED_GLOBAL

Added in SpiderMonkey 1.8.1 Instructs the garbage collector not to consider the context's global object a root. The application must ensure that the global object survives as long as the JSContext.

MXR ID Search for JSOPTION_UNROOTED_GLOBAL

See Also

Document Tags and Contributors

Last updated by: Jorend,
Hide Sidebar