The JSAPI is the C++ API for the SpiderMonkey JavaScript engine. To learn how to use the JSAPI, see the JSAPI User Guide and the JSAPI Cookbook.
Runtimes and contexts
JS_InitAdded in SpiderMonkey 31JS_ShutDown
- struct
JSRuntime JS_NewRuntimeObsolete since JSAPI 52JS_DestroyRuntimeJS_GetRuntimePrivateJS_SetRuntimePrivateJS_SetNativeStackQuotaAdded in SpiderMonkey 17JS_ContextIteratorObsolete since JSAPI 52
JS_FinishObsolete since JSAPI 19
- struct
JSContext JS_NewContextJS_DestroyContextJS_DestroyContextNoGCJS_SetContextCallback- enum
JSContextOp
- enum
JS_GetRuntimeJS_GetParentRuntimeAdded in SpiderMonkey 31JS_GetObjectRuntimeAdded in SpiderMonkey 17
JS_GetContextPrivateJS_SetContextPrivateJS_GetSecondContextPrivateAdded in SpiderMonkey 17JS_SetSecondContextPrivateAdded in SpiderMonkey 17
JS_SetInterruptCallbackAdded in SpiderMonkey 31JS_GetInterruptCallbackAdded in SpiderMonkey 31JS_RequestInterruptCallbackAdded in SpiderMonkey 31JS_CheckForInterruptAdded in JSAPI 45
JS_DestroyContextMaybeGCObsolete since JSAPI 14JS_SetBranchCallbackObsolete since JavaScript 1.9.1JS_SetOperationCallbackObsolete since JSAPI 30JS_GetOperationCallbackObsolete since JSAPI 30JS_TriggerOperationCallbackObsolete since JSAPI 30JS_ClearOperationCallbackObsolete since JavaScript 1.9.1JS_GetOperationLimitObsolete since JavaScript 1.9.1JS_SetOperationLimitObsolete since JavaScript 1.9.1JS_MAX_OPERATION_LIMITObsolete since JavaScript 1.9.1JS_OPERATION_WEIGHT_BASEObsolete since JavaScript 1.9.1JS_SetThreadStackLimitObsolete since JSAPI 13JS_SetScriptStackQuotaObsolete since JavaScript 1.8.6
JS_SetOptionsObsolete since JSAPI 27JS_GetOptionsObsolete since JSAPI 27JS_ToggleOptionsObsolete since JSAPI 27
- enum
JSVersion JS_GetImplementationVersionJS_GetVersionJS_SetVersionForCompartmentAdded in SpiderMonkey 31JS_StringToVersionJS_VersionToString
JS_SetVersionObsolete since JSAPI 25
JS::CurrentGlobalOrNullAdded in SpiderMonkey 31
JS_GetGlobalForScopeChainObsolete since JSAPI 25JS_GetGlobalObjectObsolete since JSAPI 24JS_SetGlobalObjectObsolete since JSAPI 25
JS_EnumerateResolvedStandardClassesObsolete since JSAPI 24
JS_IsAssigningObsolete since JavaScript 1.8.5JS_IsConstructingObsolete since JSAPI 26JS_IsConstructing_PossiblyWithGivenThisObjectObsolete since JSAPI 17JS_GetScopeChainObsolete since JavaScript 1.8.7
Compartments:
- class
JSAutoCompartmentAdded in SpiderMonkey 24 JS_NewGlobalObjectAdded in SpiderMonkey 17JS_EnterCompartmentAdded in SpiderMonkey 24JS_LeaveCompartmentAdded in SpiderMonkey 24JS_GetCompartmentPrivateAdded in SpiderMonkey 1.8.5JS_SetCompartmentPrivateAdded in SpiderMonkey 1.8.5JS_GetGlobalForCompartmentOrNullAdded in SpiderMonkey 17JS_IterateCompartmentsAdded in SpiderMonkey 17JS_SetDestroyCompartmentCallbackAdded in SpiderMonkey 17JS_SetCompartmentNameCallbackAdded in SpiderMonkey 17
JS_NewCompartmentAndGlobalObjectAdded in SpiderMonkey 1.8.1 Obsolete since JSAPI 16JS_EnterCrossCompartmentCallAdded in SpiderMonkey 1.8.1 Obsolete since JSAPI 18JS_LeaveCrossCompartmentCallAdded in SpiderMonkey 1.8.1 Obsolete since JSAPI 18
Locale callbacks:
Locale callback types:
Scripts
Just running some JavaScript code is straightforward:
- class
JS::CompileOptionsAdded in SpiderMonkey 17 - class
JS::OwningCompileOptionsAdded in SpiderMonkey 31 - class
JS::ReadonlyCompileOptionsAdded in SpiderMonkey 31 - class
JS::SourceBufferHolderAdded in SpiderMonkey 31 JS::EvaluateAdded in SpiderMonkey 17
JS_EvaluateScriptObsolete since JSAPI 36JS_EvaluateUCScriptObsolete since JSAPI 36JS_EvaluateScriptForPrincipalsObsolete since JSAPI 30JS_EvaluateUCScriptForPrincipalsObsolete since JSAPI 30JS_EvaluateScriptForPrincipalsVersionObsolete since JSAPI 30JS_EvaluateUCScriptForPrincipalsVersionObsolete since JSAPI 30
You can instead compile JavaScript code into a JSScript which you can then execute multiple times.
- class
JSScript JS::CompileAdded in SpiderMonkey 17JS::CompileOffThreadAdded in SpiderMonkey 31JS::CanCompileOffThreadAdded in SpiderMonkey 31JS::FinishOffThreadScriptAdded in SpiderMonkey 31JS_CompileScriptJS_CompileUCScriptJS_BufferIsCompilableUnitJS_ExecuteScriptJS::CloneAndExecuteScriptAdded in SpiderMonkey 31JS_DecompileScript
JS_ExecuteScriptVersionObsolete since JSAPI 36JS_CompileUTF8FileAdded in SpiderMonkey 11 Obsolete since JSAPI 19JS_CompileUTF8FileHandleAdded in SpiderMonkey 11 Obsolete since JSAPI 19JS_CompileUTF8FileHandleForPrincipalsAdded in SpiderMonkey 11 Obsolete since JSAPI 19JS_CompileFileObsolete since JSAPI 11JS_CompileFileHandleObsolete since JSAPI 11JS_CompileFileHandleForPrincipalsObsolete since JSAPI 11JS_CompileScriptForPrincipalsObsolete since JSAPI 28JS_CompileUCScriptForPrincipalsObsolete since JSAPI 28JS_CompileScriptForPrincipalsVersionObsolete since JSAPI 19JS_CompileUCScriptForPrincipalsVersionObsolete since JSAPI 19JS_GetScriptObjectObsolete since JSAPI 8JS_NewScriptObjectObsolete since JSAPI 8JS_ExecuteScriptPartObsolete since JavaScript 1.9.3JS_DestroyScriptObsolete since JSAPI 8
You can also compile JavaScript code into a function:
- struct
JSFunction JS::CompileFunctionAdded in SpiderMonkey 17JS_DecompileFunctionJS_DecompileFunctionBody
JS_CompileFunctionObsolete since JSAPI 36JS_CompileFunctionForPrincipalsObsolete since JSAPI 28JS_CompileUCFunctionObsolete since JSAPI 36JS_CompileUCFunctionForPrincipalsObsolete since JSAPI 28
Error handling
- struct
JSErrorFormatStringAdded in SpiderMonkey 17 - class
JSErrorReport - class
JS::AutoSaveExceptionStateAdded in SpiderMonkey 31 - enum
JSExnTypeAdded in SpiderMonkey 17 JS_ReportErrorJS_ReportWarningJS_ReportErrorNumberJS_ReportErrorNumberUCJS_ReportErrorFlagsAndNumberJS_ReportErrorFlagsAndNumberUCJS_ReportErrorNumberUCArrayAdded in SpiderMonkey 24JS_ReportOutOfMemoryJS_ReportAllocationOverflowAdded in SpiderMonkey 1.8JS_GetErrorReporterJS_SetErrorReporterObsolete since JSAPI 52JS_ErrorFromExceptionJS_GetErrorPrototypeJSREPORT_IS_EXCEPTIONJSREPORT_IS_STRICTJSREPORT_IS_WARNINGJSREPORT_IS_STRICT_MODE_ERROR
The following functions allow C/C++ functions to throw and catch JavaScript exceptions:
JS::CreateErrorAdded in SpiderMonkey 38JS_IsExceptionPendingJS_GetPendingExceptionJS_SetPendingExceptionJS_ClearPendingExceptionJS_ThrowStopIterationAdded in SpiderMonkey 1.8JS_IsStopIterationAdded in SpiderMonkey 31
These functions translate errors into exceptions and vice versa:
JS_ThrowReportedErrorObsolete since JSAPI 29
Values and types
JS::Value constructors:
JS::NullValueAdded in SpiderMonkey 24JS::UndefinedValueAdded in SpiderMonkey 24JS::BooleanValueAdded in SpiderMonkey 24JS::TrueValueAdded in SpiderMonkey 24JS::FalseValueAdded in SpiderMonkey 24JS::NumberValueAdded in SpiderMonkey 24JS::Int32ValueAdded in SpiderMonkey 24JS::DoubleValueAdded in SpiderMonkey 24JS::Float32ValueAdded in SpiderMonkey 24JS::StringValueAdded in SpiderMonkey 24JS::ObjectValueAdded in SpiderMonkey 24JS::ObjectOrNullValueAdded in SpiderMonkey 24JS::SymbolValueAdded in SpiderMonkey 38
JS::Value constants:
JS::NullHandleValueAdded in SpiderMonkey 24JS::UndefinedHandleValueAdded in SpiderMonkey 24JS::TrueHandleValueAdded in SpiderMonkey 38JS::FalseHandleValueAdded in SpiderMonkey 38
jsval constants:
JSVAL_NULLObsolete since JSAPI 42JSVAL_VOIDObsolete since JSAPI 42JSVAL_TRUEObsolete since JSAPI 42JSVAL_FALSEObsolete since JSAPI 42JSVAL_ZEROObsolete since JSAPI 42JSVAL_ONEObsolete since JSAPI 42
Function and macros for checking the type of a jsval:
- enum
JSType JS_TypeOfValue
All of the following are deprecated. See JS::Value for their modern replacements.
JSVAL_IS_NULLObsolete since JSAPI 32JSVAL_IS_VOIDObsolete since JSAPI 32JSVAL_IS_BOOLEANObsolete since JSAPI 32JSVAL_IS_NUMBERObsolete since JSAPI 32JSVAL_IS_INTObsolete since JSAPI 32JSVAL_IS_DOUBLEObsolete since JSAPI 32JSVAL_IS_STRINGObsolete since JSAPI 32JSVAL_IS_OBJECTObsolete since JSAPI 15JSVAL_IS_PRIMITIVEObsolete since JSAPI 32JSVAL_IS_GCTHINGObsolete since JSAPI 32
High-level type-conversion routines for packing and unpacking function arguments.
JS_ConvertArgumentsObsolete since JSAPI 38JS_ConvertArgumentsVAObsolete since JSAPI 38JS_PushArgumentsObsolete since JavaScript 1.8.5JS_PushArgumentsVAObsolete since JavaScript 1.8.5JS_PopArgumentsObsolete since JavaScript 1.8.5JS_AddArgumentFormatterObsolete since JSAPI 18JS_RemoveArgumentFormatterObsolete since JSAPI 18
The following functions convert JS values to various types. They can be safely applied to jsvals of any type. They may return new objects. For example, JS_ValueToObject(cx, s) where s is a string creates a new String wrapper object. These functions may call JavaScript methods. For example, JS_ValueToString(cx, obj) may call obj.toString().
JS::ToBooleanAdded in SpiderMonkey 17JS::ToUint16Added in SpiderMonkey 17JS::ToInt32Added in SpiderMonkey 17JS::ToUint32Added in SpiderMonkey 17JS::ToInt64Added in SpiderMonkey 17JS::ToUint64Added in SpiderMonkey 17JS::ToNumberAdded in SpiderMonkey 17JS::ToStringAdded in SpiderMonkey 31JS::OrdinaryToPrimitiveAdded in SpiderMonkey 38JS_ValueToConstructorJS_ValueToFunctionJS_ValueToObjectJS_ValueToSourceJS_ConvertValue
JS_ValueToBooleanObsolete since JSAPI 28JS_ValueToECMAInt32Obsolete since JSAPI 26JS_ValueToECMAUint32Obsolete since JSAPI 28JS_ValueToInt32Obsolete since JSAPI 28JS_ValueToNumberObsolete since JSAPI 27JS_ValueToStringObsolete since JSAPI 28JS_ValueToUint16Obsolete since JSAPI 28
Fast, unchecked type-casting macros. These macros must not be applied to values that are not known to be the right type. Like C casts, they may cause crashes if applied to incorrect values. They never create new objects or call into JavaScript code.
BOOLEAN_TO_JSVALObsolete since JSAPI 42INT_TO_JSVALObsolete since JSAPI 42DOUBLE_TO_JSVALObsolete since JSAPI 42OBJECT_TO_JSVALObsolete since JSAPI 42STRING_TO_JSVALObsolete since JSAPI 42PRIVATE_TO_JSVALObsolete since JSAPI 42
INT_FITS_IN_JSVALObsolete since JavaScript 1.8.5JSVAL_TO_BOOLEANObsolete since JSAPI 32JSVAL_TO_INTObsolete since JSAPI 32JSVAL_TO_DOUBLEObsolete since JSAPI 32JSVAL_TO_OBJECTObsolete since JSAPI 32JSVAL_TO_STRINGObsolete since JSAPI 32JSVAL_TO_GCTHINGObsolete since JSAPI 32JSVAL_TO_PRIVATEObsolete since JSAPI 32
A function that behaves like typeof:
JS_GetTypeNameObsolete since JSAPI 34
And functions that behave like the equality operators:
Memory management
These functions act like the Standard C malloc family of functions, except that errors are reported using the SpiderMonkey error APIs rather than errno. These functions also allow SpiderMonkey to account the number of bytes allocated:
JS_mallocJS_freeJS_reallocJS_strdup- struct
JSFreeOpAdded in SpiderMonkey 17 JS_freeopAdded in SpiderMonkey 17JS_GetDefaultFreeOpAdded in SpiderMonkey 17
JavaScript objects, strings, and floating-point numbers are garbage collected. These functions provide access to the garbage collector:
JS_GCJS_MaybeGCJS_GetGCParameterJS_SetGCParameterJS_GetGCParameterForThreadAdded in SpiderMonkey 17JS_SetGCParameterForThreadAdded in SpiderMonkey 17JS_SetGCParametersBasedOnAvailableMemoryAdded in SpiderMonkey 31- enum
JSGCParamKey
- enum
JS_SetGCCallback- enum
JSGCStatus
- enum
JS_AddFinalizeCallbackAdded in SpiderMonkey 38- enum
JSFinalizeStatusAdded in SpiderMonkey 17
- enum
JS_RemoveFinalizeCallbackAdded in SpiderMonkey 38JS_SetGCZealAdded in SpiderMonkey 1.8JS_ScheduleGCAdded in SpiderMonkey 17JS_DumpHeapAdded in SpiderMonkey 1.8
JS_SetGCCallbackRTObsolete since JSAPI 13JS_SetFinalizeCallbackAdded in SpiderMonkey 17 Obsolete since JSAPI 32JS_MarkGCThingObsolete since JSAPI 5JS_IsAboutToBeFinalizedObsolete since JSAPI 35JS_ClearNewbornRootsObsolete since JSAPI 5
The rest of these APIs help protect objects from being destroyed by the garbage collector before the application is done using them.
If a variable is a root, then anything it points to will not be freed by the garbage collector. Failure to root objects is a very common cause of mysterious crashes.
- class
JS::Rooted<T>Added in SpiderMonkey 17- class
JS::RootedObjectAdded in SpiderMonkey 17 - class
JS::RootedFunctionAdded in SpiderMonkey 17 - class
JS::RootedScriptAdded in SpiderMonkey 17 - class
JS::RootedStringAdded in SpiderMonkey 17 - class
JS::RootedSymbolAdded in SpiderMonkey 38 - class
JS::RootedIdAdded in SpiderMonkey 17 - class
JS::RootedValueAdded in SpiderMonkey 17
- class
- class
JS::Handle<T>Added in SpiderMonkey 17- class
JS::HandleFunctionAdded in SpiderMonkey 17 - class
JS::HandleIdAdded in SpiderMonkey 17 - class
JS::HandleObjectAdded in SpiderMonkey 17 - class
JS::HandleScriptAdded in SpiderMonkey 17 - class
JS::HandleStringAdded in SpiderMonkey 17 - class
JS::HandleSymbolAdded in SpiderMonkey 38 - class
JS::HandleValueAdded in SpiderMonkey 17
- class
- class
JS::MutableHandle<T>Added in SpiderMonkey 17- class
JS::MutableHandleFunctionAdded in SpiderMonkey 17 - class
JS::MutableHandleIdAdded in SpiderMonkey 17 - class
JS::MutableHandleObjectAdded in SpiderMonkey 17 - class
JS::MutableHandleScriptAdded in SpiderMonkey 17 - class
JS::MutableHandleStringAdded in SpiderMonkey 17 - class
JS::MutableHandleSymbolAdded in SpiderMonkey 38 - class
JS::MutableHandleValueAdded in SpiderMonkey 17
- class
- class
JS::PersistentRooted<T>Added in SpiderMonkey 31- class
JS::PersistentRootedObjectAdded in SpiderMonkey 31 - class
JS::PersistentRootedFunctionAdded in SpiderMonkey 31 - class
JS::PersistentRootedScriptAdded in SpiderMonkey 31 - class
JS::PersistentRootedStringAdded in SpiderMonkey 31 - class
JS::PersistentRootedSymbolAdded in SpiderMonkey 38 - class
JS::PersistentRootedIdAdded in SpiderMonkey 31 - class
JS::PersistentRootedValueAdded in SpiderMonkey 31
- class
- class
JS::AutoValueArray<N>Added in SpiderMonkey 31 - class
JS::AutoVectorRooter<T>Added in SpiderMonkey 17- class
JS::AutoValueVectorAdded in SpiderMonkey 17 - class
JS::AutoIdVectorAdded in SpiderMonkey 17 - class
JS::AutoObjectVectorAdded in SpiderMonkey 24 - class
JS::AutoFunctionVectorAdded in SpiderMonkey 31 - class
JS::AutoScriptVectorAdded in SpiderMonkey 17
- class
- class
JS::HandleValueArrayAdded in SpiderMonkey 31
JS::Add*RootAdded in SpiderMonkey 31 Obsolete since JSAPI 38JS::AddValueRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38JS::AddStringRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38JS::AddObjectRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38JS::AddNamedValueRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38JS::AddNamedValueRootRTAdded in SpiderMonkey 31 Obsolete since JSAPI 38JS::AddNamedScriptRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38JS::AddNamedStringRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38JS::AddNamedObjectRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38
JS::Remove*RootAdded in SpiderMonkey 31 Obsolete since JSAPI 38JS::RemoveValueRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38JS::RemoveStringRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38JS::RemoveObjectRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38JS::RemoveScriptRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38JS::RemoveValueRootRTAdded in SpiderMonkey 31 Obsolete since JSAPI 38JS::RemoveStringRootRTAdded in SpiderMonkey 31 Obsolete since JSAPI 38JS::RemoveObjectRootRTAdded in SpiderMonkey 31 Obsolete since JSAPI 38JS::RemoveScriptRootRTAdded in SpiderMonkey 31 Obsolete since JSAPI 38
JS_Add*RootObsolete since JSAPI 31JS_AddValueRootObsolete since JSAPI 31JS_AddStringRootObsolete since JSAPI 31JS_AddObjectRootObsolete since JSAPI 31JS_AddGCThingRootObsolete since JSAPI 31JS_AddNamedValueRootObsolete since JSAPI 31JS_AddNamedStringRootObsolete since JSAPI 31JS_AddNamedObjectRootObsolete since JSAPI 31JS_AddNamedGCThingRootObsolete since JSAPI 31
JS_Remove*RootObsolete since JSAPI 31JS_RemoveValueRootObsolete since JSAPI 31JS_RemoveStringRootObsolete since JSAPI 31JS_RemoveObjectRootObsolete since JSAPI 31JS_RemoveGCThingRootObsolete since JSAPI 31
JS_AddRootObsolete since JavaScript 1.8.5JS_AddNamedRootObsolete since JavaScript 1.8.5JS_AddNamedRootRTObsolete since JavaScript 1.8.5JS_RemoveRootObsolete since JavaScript 1.8.5JS_RemoveRootRTObsolete since JavaScript 1.8.5JS_MapGCRootsObsolete since JSAPI 19JSGCMapRootFunObsolete since JSAPI 19JS_DumpNamedRootsObsolete since JSAPI 19
Local root scopes were another way of protecting objects from the garbage collector. They have been removed in JS 1.8.5, though
JS_EnterLocalRootScopeObsolete since JavaScript 1.8.5JS_LeaveLocalRootScopeObsolete since JavaScript 1.8.5JS_LeaveLocalRootScopeWithResultObsolete since JavaScript 1.8.5JS_ForgetLocalRootObsolete since JavaScript 1.8.5
Added in SpiderMonkey 1.8 If an object contains references to other GC things that are not stored in SpiderMonkey data structures ("slots"), it must implement the hook to enable the garbage collector to traverse those references. Otherwise the garbage collector will not find all reachable objects and may collect objects that are still reachable, leading to a crash. (In SpiderMonkey 1.7 and earlier, the JSTraceOpJSMarkOp hook was used instead. This has since been removed.)
The tracing APIs are used by the garbage collector and hooks. JSAPI applications may also use them to examine the object graph. (For example, these APIs support very smooth integration between the JS garbage collector and other garbage collectors.)JSTraceOp
- struct
JSTracerAdded in SpiderMonkey 1.8 JS_TraceChildrenAdded in SpiderMonkey 1.8JS_TraceRuntimeAdded in SpiderMonkey 1.8
JSVAL_IS_TRACEABLEAdded in SpiderMonkey 1.8 Obsolete since JSAPI 31JSVAL_TO_TRACEABLEAdded in SpiderMonkey 1.8 Obsolete since JSAPI 31JSVAL_TRACE_KINDAdded in SpiderMonkey 1.8 Obsolete since JSAPI 31JS_TRACER_INITAdded in SpiderMonkey 1.8 Obsolete since JSAPI 12JS_TracerInitAdded in SpiderMonkey 12 Obsolete since JSAPI 31JS_CallTracerAdded in SpiderMonkey 1.8 Obsolete since JSAPI 22JS_SET_TRACING_DETAILSAdded in SpiderMonkey 1.8 Obsolete since JSAPI 26JS_SET_TRACING_INDEXAdded in SpiderMonkey 1.8 Obsolete since JSAPI 26JS_SET_TRACING_NAMEAdded in SpiderMonkey 1.8 Obsolete since JSAPI 26JS_CALL_TRACERAdded in SpiderMonkey 1.8 Obsolete since JSAPI 23JS_CALL_VALUE_TRACERAdded in SpiderMonkey 1.8 Obsolete since JSAPI 23JS_CALL_OBJECT_TRACERAdded in SpiderMonkey 1.8 Obsolete since JSAPI 23JS_CALL_STRING_TRACERAdded in SpiderMonkey 1.8 Obsolete since JSAPI 23JS_CALL_DOUBLE_TRACERAdded in SpiderMonkey 1.8 Obsolete since JavaScript 1.8.5JS_PrintTraceThingInfo(DEBUG-only) Added in SpiderMonkey 1.8 Obsolete since JSAPI 16
Miscellaneous GC APIs:
JS_updateMallocCounterAdded in SpiderMonkey 17JS::SetLargeAllocationFailureCallbackAdded in SpiderMonkey 31JS::SetOutOfMemoryCallbackAdded in SpiderMonkey 31JS_EnumerateDiagnosticMemoryRegionsAdded in SpiderMonkey 17
JSVAL_LOCKObsolete since JSAPI 18JSVAL_UNLOCKObsolete since JSAPI 18JS_LockGCThingObsolete since JSAPI 21JS_LockGCThingRTObsolete since JSAPI 22JS_UnlockGCThingObsolete since JSAPI 21JS_UnlockGCThingRTObsolete since JSAPI 22
Numbers
JS_NumberValueAdded in SpiderMonkey 17JS_DefineConstDoubles- struct
JSConstDoubleSpec
- struct
JS_DefineConstIntegersAdded in SpiderMonkey 38- struct
JSConstIntegerSpecAdded in SpiderMonkey 38
- struct
JS_GetNaNValueJS_GetNegativeInfinityValueJS_GetPositiveInfinityValueJS_DoubleIsInt32Added in SpiderMonkey 17
JS_DoubleToInt32Added in SpiderMonkey 17 Obsolete since JSAPI 38JS_DoubleToUint32Added in SpiderMonkey 17 Obsolete since JSAPI 38JS_NewNumberValueObsolete since JSAPI 17JS_NewDoubleValueObsolete since JSAPI 17JS_NewDoubleObsolete since JSAPI 17
Strings
- typedef
JSString - class
JSAutoByteStringAdded in SpiderMonkey 17 JS_NewStringCopyNJS_NewStringCopyZJS_NewUCStringJS_NewUCStringCopyNJS_NewUCStringCopyZJS_NewDependentStringJS_GetEmptyStringValueJS_GetEmptyStringAdded in SpiderMonkey 1.8.5JS_ConcatStrings
JS_CompareStringsJS_StringEqualsAsciiAdded in SpiderMonkey 1.8.5JS_FlatStringEqualsAsciiAdded in SpiderMonkey 1.8.5
JS_StringHasLatin1CharsAdded in SpiderMonkey 38JS_GetStringCharAtAdded in SpiderMonkey 38JS_GetFlatStringCharAtAdded in SpiderMonkey 38JS_GetStringLengthJS_EncodeStringAdded in SpiderMonkey 1.8JS_EncodeStringToUTF8Added in SpiderMonkey 24JS_EncodeStringToBufferAdded in SpiderMonkey 1.8.5JS_GetStringEncodingLengthAdded in SpiderMonkey 1.8.5JS_GetLatin1FlatStringCharsAdded in SpiderMonkey 38JS_GetTwoByteFlatStringCharsAdded in SpiderMonkey 38JS_GetLatin1StringCharsAndLengthAdded in SpiderMonkey 38JS_GetTwoByteStringCharsAndLengthAdded in SpiderMonkey 38JS::GetDeflatedUTF8StringLengthAdded in SpiderMonkey 38JS::DeflateStringToUTF8BufferAdded in SpiderMonkey 38
JS_FileEscapedStringAdded in SpiderMonkey 1.8.5JS_PutEscapedStringAdded in SpiderMonkey 1.8.5JS_PutEscapedFlatStringAdded in SpiderMonkey 1.8.5
JS_FORGET_STRING_FLATNESSAdded in SpiderMonkey 1.8.5JS_StringIsFlatAdded in SpiderMonkey 38JS_ASSERT_STRING_IS_FLATAdded in SpiderMonkey 1.8.5JS_FlattenStringAdded in SpiderMonkey 1.8.5
- typedef
jscharObsolete since JSAPI 35 JS_NewStringObsolete since JSAPI 1.8.5JS_NewGrowableStringObsolete since JSAPI 27JS_GetStringBytesObsolete since JSAPI 1.8.5JS_GetStringBytesZObsolete since JSAPI 1.8.5JS_GetStringCharsObsolete since JSAPI 1.8.5JS_GetStringCharsZObsolete since JSAPI 33JS_GetStringCharsAndLengthAdded in JSAPI 1.8.5 Obsolete since JSAPI 33JS_GetStringCharsZAdded in SpiderMonkey 1.8.5 Obsolete since JSAPI 33JS_GetStringCharsZAndLengthAdded in SpiderMonkey 1.8.5 Obsolete since JSAPI 33JS_GetFlatStringCharsObsolete since JSAPI 33JS_MakeStringImmutableObsolete since JavaScript 1.8.5JS_EncodeCharactersObsolete since JSAPI 19JS_CStringsAreUTF8Obsolete since JSAPI 19JS_SetCStringsAreUTF8Obsolete since JSAPI 19
Interning strings tells the SpiderMonkey engine to reuse existing string objects when possible.
JS_InternStringJS_InternStringNJS_InternUCStringJS_InternUCStringNJS_InternJSStringAdded in SpiderMonkey 1.8.5JS_StringHasBeenInternedAdded in SpiderMonkey 17
JS_GetLatin1InternedStringCharsAdded in SpiderMonkey 38JS_GetTwoByteInternedStringCharsAdded in SpiderMonkey 38
JS_GetInternedStringCharsObsolete since JSAPI 33JS_GetInternedStringCharsAndLengthObsolete since JSAPI 33
The character data for external strings is stored in memory provided by the application. Applications can use this to avoid copying data back and forth between SpiderMonkey's heap and application memory.
- struct
JSStringFinalizerAdded in SpiderMonkey 17 JS_NewExternalStringJS_IsExternalStringAdded in SpiderMonkey 17JS_GetTwoByteExternalStringCharsAdded in SpiderMonkey 38JS_GetExternalStringFinalizerAdded in SpiderMonkey 17
JS_AddExternalStringFinalizerObsolete since JSAPI 13JS_RemoveExternalStringFinalizerObsolete since JSAPI 13JS_GetExternalStringGCTypeObsolete since JSAPI 13JS_NewExternalStringWithClosureAdded in SpiderMonkey 6 Obsolete since JSAPI 13JS_GetExternalStringClosureAdded in SpiderMonkey 6 Obsolete since JSAPI 13
Objects
- typedef
JSObject JS_DefineObjectJS_NewObjectJS_NewPlainObjectAdded in SpiderMonkey 38JS_NewObjectForConstructorAdded in SpiderMonkey 1.8.5JS_NewGlobalObjectAdded in SpiderMonkey 1.8JS_NewObjectWithGivenProtoJS_NewAdded in SpiderMonkey 1.8
JS_IsGlobalObjectAdded in JSAPI 24
JS_ConstructObjectObsolete since JSAPI 16JS_ConstructObjectWithArgumentsObsolete since JSAPI 16
JS_GetClassJS_GetObjectPrototypeAdded in JSAPI 17JS_GetFunctionPrototypeAdded in SpiderMonkey 17JS_GetArrayPrototypeAdded in SpiderMonkey 24JS_GetConstructorJS_GetGlobalForObjectJS_GetInstancePrivateJS_GetPrototypeJS_SetPrototypeJS_GetPrivateJS_SetPrivateJS_FreezeObjectAdded in SpiderMonkey 1.8.5JS_DeepFreezeObjectAdded in SpiderMonkey 1.8.5JS_IsExtensibleAdded in SpiderMonkey 1.8.5JS_PreventExtensionsAdded in SpiderMonkey 45JS_InstanceOfJS_HasInstanceJS_IsNativeAdded in SpiderMonkey 17JS::ToPrimitiveAdded in SpiderMonkey 45JS::NewFunctionFromSpecAdded in SpiderMonkey 45
JS_DefaultValueObsolete since JSAPI 44JS_GET_CLASSObsolete since JSAPI 13JS_SealObjectObsolete since JavaScript 1.8.5JS_GetParentObsolete since JSAPI 39JS_SetParentObsolete since JSAPI 39
Standard Objects
- enum
JSProtoKeyAdded in SpiderMonkey 24 JS_GetClassObjectJS_GetClassPrototypeJS::ProtoKeyToIdAdded in SpiderMonkey 38JS_IdToProtoKeyAdded in SpiderMonkey 31JS::IdentifyStandardInstanceAdded in SpiderMonkey 31JS::IdentifyStandardPrototypeAdded in SpiderMonkey 31JS::IdentifyStandardInstanceOrPrototypeAdded in SpiderMonkey 31JS::IdentifyStandardConstructorAdded in SpiderMonkey 38
Date
JS_NewDateObjectAdded in SpiderMonkey 1.8.5JS_NewDateObjectMsecAdded in SpiderMonkey 1.8.5JS_ObjectIsDateAdded in SpiderMonkey 1.8.5JS_ClearDateCachesAdded in SpiderMonkey 17JS_Now
Intl API
JS_SetDefaultLocaleAdded in SpiderMonkey 24JS_ResetDefaultLocaleAdded in SpiderMonkey 24
Properties
These functions correspond directly to the ways scripts access object properties:
JS_GetPropertyJS_GetUCPropertyJS_GetPropertyByIdAdded in SpiderMonkey 1.8.1JS_SetPropertyJS_SetUCPropertyJS_SetPropertyByIdAdded in SpiderMonkey 1.8.1JS_HasPropertyJS_HasUCPropertyJS_HasPropertyByIdAdded in SpiderMonkey 1.8.1JS_HasOwnPropertyAdded in JSAPI 45JS_HasOwnPropertyByIdAdded in JSAPI 45JS_DeletePropertyJS_DeletePropertyByIdAdded in SpiderMonkey 1.8.1
JS_DeleteProperty2Obsolete since JSAPI 39JS_DeleteUCProperty2Obsolete since JSAPI 39JS_DeletePropertyById2Added in SpiderMonkey 1.8.1 Obsolete since JSAPI 39
The following functions are lower-level, allowing the JSAPI application more access to details of how properties are implemented. "Define" is a lower-level version of "set" that provides access to extra settings and does not call setters. Similarly, "lookup" is a lower-level version of "get" that offers extra options and does not call getters.
- struct
JSPropertyDescriptorAdded in SpiderMonkey 1.8 Property attributesJSPROP_ENUMERATEJSPROP_READONLYJSPROP_PERMANENTJSPROP_PROPOP_ACCESSORSAdded in SpiderMonkey 38JSPROP_GETTERJSPROP_SETTERJSPROP_SHAREDJSPROP_INDEXJSPROP_DEFINE_LATEAdded in SpiderMonkey 38JSFUN_STUB_GSOPSAdded in SpiderMonkey 17JSFUN_CONSTRUCTORAdded in SpiderMonkey 17JSPROP_REDEFINE_NONCONFIGURABLEAdded in SpiderMonkey 38JSPROP_RESOLVINGAdded in SpiderMonkey 45JSPROP_IGNORE_ENUMERATEAdded in SpiderMonkey 38JSPROP_IGNORE_READONLYAdded in SpiderMonkey 38JSPROP_IGNORE_PERMANENTAdded in SpiderMonkey 38JSPROP_IGNORE_VALUEAdded in SpiderMonkey 38
JS_AlreadyHasOwnElementAdded in SpiderMonkey 1.8JS_AlreadyHasOwnPropertyAdded in SpiderMonkey 1.8JS_AlreadyHasOwnUCPropertyAdded in SpiderMonkey 1.8JS_AlreadyHasOwnPropertyByIdAdded in SpiderMonkey 1.8.1JS_DefinePropertyJS_DefineUCPropertyJS_DefinePropertyByIdAdded in SpiderMonkey 1.8.1JS_DefinePropertiesJS_EnumerateJS_ForwardGetPropertyToAdded in SpiderMonkey 17JS_ForwardGetElementToAdded in SpiderMonkey 17JS_GetPropertyDescriptorAdded in SpiderMonkey 31JS_GetPropertyDescriptorByIdAdded in SpiderMonkey 1.8.1JS_GetOwnPropertyDescriptorAdded in SpiderMonkey 31JS_GetOwnPropertyDescriptorByIdAdded in SpiderMonkey 31JS_GetOwnUCPropertyDescriptorAdded in SpiderMonkey 45JS_SetAllNonReservedSlotsToUndefinedAdded in SpiderMonkey 24
JS_AliasPropertyObsolete since JSAPI 8JS_ClearScopeObsolete since JSAPI 18JS_ClearNonGlobalObjectAdded in SpiderMonkey 18 Obsolete since JSAPI 34JS_DefineOwnPropertyAdded in SpiderMonkey 1.8.5 Obsolete since JSAPI 33JS_DefinePropertyWithTinyIdObsolete since JSAPI 30JS_DefineUCPropertyWithTinyIdObsolete since JSAPI 30JS_GetPropertyDefaultObsolete since JSAPI 26JS_GetPropertyByIdDefaultObsolete since JSAPI 26JS_GetPropertyAttributesObsolete since JSAPI 26JS_GetUCPropertyAttributesObsolete since JSAPI 26JS_GetPropertyAttrsGetterAndSetterObsolete since JSAPI 26JS_GetUCPropertyAttrsGetterAndSetterObsolete since JSAPI 26JS_GetPropertyAttrsGetterAndSetterByIdObsolete since JSAPI 26JS_LookupPropertyObsolete since JSAPI 37JS_LookupUCPropertyObsolete since JSAPI 37JS_LookupPropertyByIdObsolete since JSAPI 37JS_LookupElementObsolete since JSAPI 37JS_LookupPropertyWithFlagsObsolete since JSAPI 31JS_LookupPropertyWithFlagsByIdObsolete since JSAPI 31JS_NewPropertyIteratorObsolete since JSAPI 36JS_NextPropertyObsolete since JSAPI 36JS_SetPropertyAttributesObsolete since JSAPI 26JS_SetUCPropertyAttributesObsolete since JSAPI 26
The following functions behave like JS_GetProperty and JS_GetPropertyById except when operating on E4X XML objects.
JS_GetMethodObsolete since JSAPI 23JS_GetMethodByIdObsolete since JSAPI 23
A SpiderMonkey extension allows a native function to return an lvalue—that is, a reference to a property of an object:
JS_SetCallReturnValue2Obsolete since JavaScript 1.8.5
Id
A jsid is an identifier for a property or method of an object.
- struct
jsid JS_IdToValueJS_IdToProtoKeyAdded in SpiderMonkey 31JS_ValueToIdJS_StringToIdAdded in SpiderMonkey 38JS_IndexToIdAdded in SpiderMonkey 17JS_CharsToIdAdded in SpiderMonkey 24JS::ProtoKeyToIdAdded in SpiderMonkey 38JS_IsIdentifierAdded in SpiderMonkey 17
- struct
JSIdArray - class
JS::AutoIdArrayAdded in SpiderMonkey 17 JS_IdArrayLengthAdded in SpiderMonkey 17JS_IdArrayGetAdded in SpiderMonkey 17JS_DestroyIdArray
JS_GetObjectIdObsolete since JSAPI 31
jsid constants:
JSID_VOIDJSID_VOIDHANDLEAdded in SpiderMonkey 31JSID_EMPTYJSID_EMPTYHANDLEAdded in SpiderMonkey 31
Function for checking and converting the type of a jsid:
JSID_IS_ZEROJSID_IS_VOIDJSID_IS_EMPTYJSID_IS_STRINGJSID_TO_STRINGINTERNED_STRING_TO_JSIDAdded in SpiderMonkey 38JSID_TO_FLAT_STRINGAdded in SpiderMonkey 17JSID_IS_INTJSID_TO_INTINT_FITS_IN_JSIDINT_TO_JSIDJSID_IS_SYMBOLAdded in SpiderMonkey 38JSID_TO_SYMBOLAdded in SpiderMonkey 38SYMBOL_TO_JSIDAdded in SpiderMonkey 38JSID_IS_GCTHINGJSID_TO_GCTHING
JSID_IS_OBJECTObsolete since JSAPI 33JSID_IS_DEFAULT_XML_NAMESPACEObsolete since JSAPI 21
Classes
These API features are used to define custom classes—object types that are implemented in C/C++ code but accessible from JavaScript.
- struct
JSClass - struct
JSFunctionSpec - struct
JSPropertySpec JS_InitClassJS_LinkConstructorAndPrototypeAdded in SpiderMonkey 17JS::PropertySpecNameIsSymbolAdded in SpiderMonkey 38JS::PropertySpecNameEqualsIdAdded in SpiderMonkey 38JS::PropertySpecNameToPermanentIdAdded in SpiderMonkey 38JS_GetReservedSlotJS_SetReservedSlot
- struct
JSExtendedClassObsolete since JavaScript 1.8.5 - struct
JSObjectOpsObsolete since JavaScript 1.8.5 - struct
JSXMLObjectOpsObsolete since JavaScript 1.8.5 - struct
JSPropertyObsolete since JSAPI 16
Adding native properties and methods to classes:
JSNative- struct
JSFunctionSpec JS_FSAdded in SpiderMonkey 1.8JS_FNAdded in SpiderMonkey 1.8JS_SYM_FNAdded in SpiderMonkey 38JS_FNINFOAdded in SpiderMonkey 17JS_SELF_HOSTED_FNAdded in SpiderMonkey 31JS_SELF_HOSTED_SYM_FNAdded in SpiderMonkey 38JS_SYM_FNSPECAdded in SpiderMonkey 38JS_FNSPECAdded in SpiderMonkey 31JS_FS_ENDAdded in SpiderMonkey 1.8- struct
JSPropertySpec JS_PSGAdded in SpiderMonkey 17JS_PSGSAdded in SpiderMonkey 17JS_SELF_HOSTED_GETAdded in SpiderMonkey 31JS_SELF_HOSTED_GETSETAdded in SpiderMonkey 31JS_PS_ENDAdded in SpiderMonkey 17
JSFastNativeAdded in SpiderMonkey 1.8 Obsolete since JavaScript 1.8.5
The behavior of a JSClass can be customized using these flags:
JSClass.flagsJSCLASS_HAS_PRIVATEJSCLASS_PRIVATE_IS_NSISUPPORTSJSCLASS_IS_DOMJSCLASSAdded in SpiderMonkey 17JSCLASS_IMPLEMENTS_BARRIERSAdded in SpiderMonkey 17JSCLASS_EMULATES_UNDEFINEDAdded in SpiderMonkey 24JSCLASS_HAS_RESERVED_SLOTS(n)JSCLASS_GLOBAL_FLAGSJSCLASS_NEW_ENUMERATEObsolete since JSAPI 37JSCLASS_NEW_RESOLVEObsolete since JSAPI 36JSCLASS_SHARE_ALL_PROPERTIESObsolete since JavaScript 1.8.5JSCLASS_NEW_RESOLVE_GETS_STARTObsolete since JSAPI 16JSCLASS_CONSTRUCT_PROTOTYPEObsolete since JSAPI 11JSCLASS_IS_EXTENDEDObsolete since JSAPI 17JSCLASS_MARK_IS_TRACEObsolete since JSAPI 5
The behavior of a JSClass and its instances can be customized in many ways using callback functions.
JSClass method types:
JSPropertyOpJSStrictPropertyOpAdded in SpiderMonkey 1.9.3JSDeletePropertyOpAdded in SpiderMonkey 24JSEnumerateOpJSNewEnumerateOpJSResolveOpJSConvertOpJSFinalizeOpJSHasInstanceOpJSTraceOp
JSCheckAccessOpObsoleteJSXDRObjectOpObsolete since JSAPI 13JSNewResolveOpObsolete since JSAPI 36JSMarkOpObsolete since JSAPI 5JSGetObjectOpsObsolete since JavaScript 1.8.5JSReserveSlotsOpObsolete since JavaScript 1.8.5
These stub functions can be used when creating a custom JSClass:
JS_ConvertStubObsolete since JSAPI 37JS_DeletePropertyStubObsolete since JSAPI 37JS_EnumerateStubObsolete since JSAPI 37JS_FinalizeStubObsolete since JSAPI 15JS_ResolveStubObsolete since JSAPI 37
JSExtendedClass method types:
In JS 1.8.5, JSExtendedClass has made private.
JSIteratorOpObsolete since JSAPI 26JSEqualityOpObsolete since JavaScript 1.8.5JSObjectOpObsolete since JavaScript 1.8.5
JSObjectOps method types:
In JS 1.8.5, JSObjectOps has been made private.
JSNewObjectMapOpObsolete since JavaScript 1.8.5JSObjectMapOpObsolete since JavaScript 1.8.5JSLookupPropOpObsolete since JavaScript 1.8.5JSDefinePropOpObsolete since JavaScript 1.8.5JSPropertyIdOpObsolete since JavaScript 1.8.5JSAttributesOpObsolete since JavaScript 1.8.5JSObjectOps.defaultValueObsolete since JavaScript 1.8.5JSCheckAccessIdOpObsolete since JavaScript 1.8.5JSObjectOpObsolete since JavaScript 1.8.5JSPropertyRefOpObsolete since JavaScript 1.8.5JSSetObjectSlotOpObsolete since JavaScript 1.8.5JSGetRequiredSlotOpObsolete since JavaScript 1.8.5JSSetRequiredSlotOpObsolete since JavaScript 1.8.5
JSXMLObjectOps method types:
In JS 1.8.5, JSXMLObjectOps has been made private.
JSGetMethodOpObsolete since JavaScript 1.8.5JSSetMethodOpObsolete since JavaScript 1.8.5JSEnumerateValuesOpObsolete since JavaScript 1.8.5JSConcatenateOpObsolete since JavaScript 1.8.5
Arrays
JS_HasArrayLengthObsolete since JSAPI 8JS_AliasElementObsolete since JSAPI 8JS_LookupElementObsolete since JSAPI 37JS_DeleteElement2Obsolete since JSAPI 39
Functions
Calling a function or a method of an object:
- class
JS::CallArgsAdded in SpiderMonkey 17 JS::CallArgsFromVpAdded in SpiderMonkey 17JS::CallAdded in SpiderMonkey 17JS::ConstructAdded in SpiderMonkey 38JS_CallFunctionJS_CallFunctionNameJS_CallFunctionValueJS::IsCallableAdded in SpiderMonkey 38JS::IsConstructorAdded in SpiderMonkey 38JS_IsNativeFunctionAdded in SpiderMonkey 17JS_IsConstructorAdded in SpiderMonkey 24JS_BindCallableAdded in SpiderMonkey 17JS_IsBuiltinEvalFunctionAdded in SpiderMonkey 17JS_IsBuiltinFunctionConstructorAdded in SpiderMonkey 17
Function accessors:
JS_ObjectIsFunctionJS_GetFunctionArityJS_GetFunctionIdJS_GetFunctionDisplayIdAdded in SpiderMonkey 17JS_GetFunctionScriptAdded in SpiderMonkey 38JS_GetFunctionObject
JS_GetFunctionFlagsObsolete since JSAPI 19JS_GetFunctionNameObsolete since JavaScript 1.8.5
Creating functions:
JS::CloneFunctionObjectAdded in SpiderMonkey 36JS_DefineFunctionJS_DefineUCFunctionJS_DefineFunctionByIdAdded in SpiderMonkey 17JS_DefineFunctions- enum
PropertyDefinitionBehaviorAdded in SpiderMonkey 38
- enum
JS_NewFunctionJS::GetSelfHostedFunctionAdded in JSAPI 31JS::NewFunctionFromSpecAdded in JSAPI 45
JS_NewFunctionByIdAdded in SpiderMonkey 17 Obsolete since JSAPI 44JS_CloneFunctionObjectObsolete since JSAPI 36
RegExps
JS_NewRegExpObjectJS_NewUCRegExpObjectJS_NewRegExpObjectNoStaticsJS_NewUCRegExpObjectNoStaticsJS_SetRegExpInputJS_ClearRegExpStaticsJS_ObjectIsRegExpAdded in SpiderMonkey 17JS_GetRegExpFlagsAdded in SpiderMonkey 17JS_GetRegExpSourceAdded in SpiderMonkey 17JS_ExecuteRegExpJS_ExecuteRegExpNoStatics
JS_ClearRegExpRootsObsolete since JavaScript 1.8.5
Serialization
- struct
JSStructuredCloneCallbacks - JS_SetStructuredCloneCallbacks
- JS_ReadStructuredClone
- JS_WriteStructuredClone
- JS_StructuredClone
- JS_ReadUint32Pair
- JS_ReadBytes
- JS_WriteUint32Pair
- JS_WriteBytes
Security
- struct
JSPrincipals JS_SetObjectPrincipalsFinderObsolete since JavaScript 1.8JS_SetPrincipalsTranscoderObsolete since JavaScript 1.8
- enum
JSAccessModeObsolete since JSAPI 29 JS_CheckAccessObsolete since JSAPI 29JSObjectOps.checkAccessObsolete since JavaScript 1.8JSClass.checkAccessObsolete since JSAPI 29JS_SetCheckObjectAccessCallbackObsolete since JavaScript 1.8
Added in SpiderMonkey 1.8.1 Security callbacks are set per-runtime.
JSSecurityCallbacksJS_GetSecurityCallbacksAdded in SpiderMonkey 13JS_SetSecurityCallbacksAdded in SpiderMonkey 13JS_SetContextSecurityCallbacksObsolete since JSAPI 13JS_GetRuntimeSecurityCallbacksObsolete since JSAPI 13JS_SetRuntimeSecurityCallbacksObsolete since JSAPI 13
Threading
The following functions support the SpiderMonkey threading model.
Note: JS_THREADSAFE is now permanently on and the JSRuntime is single-threaded. To execute more than one JS script at once, use multiple JSRuntimes.
JSAPI 1.7 and earlier They are only available in builds.JS_THREADSAFE
Added in SpiderMonkey 1.8 These functions are always available, but in non- builds, they do nothing.JS_THREADSAFE
JS_BeginRequestJS_EndRequestJS_YieldRequestObsolete since JSAPI 18JS_SuspendRequestObsolete since JSAPI 18JS_ResumeRequestObsolete since JSAPI 18JS_GetContextThreadObsolete since JSAPI 8JS_SetContextThreadObsolete since JSAPI 8JS_ClearContextThreadObsolete since JSAPI 8
The following functions are always available, but in non- builds, they do nothing:JS_THREADSAFE
JS_LockRuntimeObsolete since JSAPI 12JS_UnlockRuntimeObsolete since JSAPI 12JS_LockObsolete since JSAPI 12JS_UnlockObsolete since JSAPI 12
Time
Callback Types
Native function types:
JSNativeJSFastNativeObsolete since JavaScript 1.8.5
Other callback types:
JS::LargeAllocationFailureCallback
- used byJS::SetLargeAllocationFailureCallbackAdded in SpiderMonkey 31JS::OffThreadCompileCallback
- used byJS::CompileOffThreadAdded in SpiderMonkey 26JS::SetOutOfMemoryCallback
- used byJS::OutOfMemoryCallbackAdded in SpiderMonkey 31JSCompartmentNameCallback
- used byJS_SetCompartmentNameCallbackAdded in SpiderMonkey 17JSContextCallback
- used byJS_SetContextCallbackJSDestroyCompartmentCallback
- used byJS_SetDestroyCompartmentCallbackAdded in SpiderMonkey 17JSEnumerateDiagnosticMemoryCallback
- used byJS_EnumerateDiagnosticMemoryRegionsAdded in SpiderMonkey 17JSErrorCallback
- used byJS_ReportErrorNumberand friendsJSErrorReporter
- used byJS_SetErrorReporterJSGCCallback
- used byJS_SetGCCallbackJSFinalizeCallbackAdded in SpiderMonkey 17
- used byJS_AddFinalizeCallbackAdded in SpiderMonkey 38
andJS_SetFinalizeCallbackAdded in SpiderMonkey 17 Obsolete since JSAPI 32JSIterateCompartmentCallback
- used byJS_IterateCompartmentsAdded in SpiderMonkey 17JSBranchCallback
- used byJS_SetBranchCallbackObsolete since JavaScript 1.8.1JSArgumentFormatter
- used byJS_AddArgumentFormatterObsolete since JSAPI 18JSFunctionCallback
- used byJS_SetFunctionCallbackObsolete since JSAPI 37JSGCRootMapFun
- used byJS_MapGCRootsObsolete since JSAPI 19JSObjectPrincipalsFinder
- used byJS_SetObjectPrincipalsFinderObsolete since JavaScript 1.8JSPrincipalsTranscoder
- used byJS_SetPrincipalsTranscoderObsolete since JavaScript 1.8JSStringFinalizeOp
- used byJS_AddExternalStringFinalizerObsolete since JSAPI 13JSTraceCallback
- used byJS_TRACER_INITObsolete since JSAPI 12JSTraceDataOp
- used byJS_SetExtraGCRootsObsolete since JSAPI 25JSTraceNamePrinter
- used byJS_SET_TRACING_DETAILSObsolete since JSAPI 26
See also Classes, above.
Macros
JS_DEFAULT_XML_NAMESPACE_IDObsolete since JSAPI 21JSFUN_BOUND_METHODObsolete since JavaScript 1.8.5JSFUN_GETTERObsolete since JavaScript 1.8.5JSFUN_SETTERObsolete since JavaScript 1.8.5JSFUN_GLOBAL_PARENTObsolete since JavaScript 1.8.5JSFUN_HEAVYWEIGHTObsolete since JSAPI 19JSFUN_LAMBDAObsolete since JSAPI 19
C++ features
- class
JSAutoRequest - class
JSAutoLocalRootScopeObsolete since JavaScript 1.8.5 - class JS::PerfMeasurement (in
jsperf.h)
Tracing and debugging
JS_SetFunctionCallbackAdded in SpiderMonkey 1.8.5 Obsolete since JSAPI 37JS_GetFunctionCallbackAdded in SpiderMonkey 1.8.5 Obsolete since JSAPI 37
