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 31
- JS_ShutDown
- struct JSRuntime
- JS_NewRuntime
- JS_DestroyRuntime
- JS_GetRuntimePrivate
- JS_SetRuntimePrivate
- JS_SetNativeStackQuotaAdded in SpiderMonkey 17
- JS_ContextIterator
- JS_FinishObsolete since JSAPI 19
- struct JSContext
- JS_NewContext
- JS_DestroyContext
- JS_DestroyContextNoGC
- JS_SetContextCallback- enum JSContextOp
 
- enum 
- JS_GetRuntime
- JS_GetParentRuntimeAdded in SpiderMonkey 31
- JS_GetObjectRuntimeAdded in SpiderMonkey 17
- JS_GetContextPrivate
- JS_SetContextPrivate
- JS_GetSecondContextPrivateAdded in SpiderMonkey 17
- JS_SetSecondContextPrivateAdded in SpiderMonkey 17
- JS_SetInterruptCallbackAdded in SpiderMonkey 31
- JS_GetInterruptCallbackAdded in SpiderMonkey 31
- JS_RequestInterruptCallbackAdded in SpiderMonkey 31
- JS_CheckForInterruptAdded in JSAPI 45
- JS_DestroyContextMaybeGCObsolete since JSAPI 14
- JS_SetBranchCallbackObsolete since JavaScript 1.9.1
- JS_SetOperationCallbackObsolete since JSAPI 30
- JS_GetOperationCallbackObsolete since JSAPI 30
- JS_TriggerOperationCallbackObsolete since JSAPI 30
- JS_ClearOperationCallbackObsolete since JavaScript 1.9.1
- JS_GetOperationLimitObsolete since JavaScript 1.9.1
- JS_SetOperationLimitObsolete since JavaScript 1.9.1
- JS_MAX_OPERATION_LIMITObsolete since JavaScript 1.9.1
- JS_OPERATION_WEIGHT_BASEObsolete since JavaScript 1.9.1
- JS_SetThreadStackLimitObsolete since JSAPI 13
- JS_SetScriptStackQuotaObsolete since JavaScript 1.8.6
- JS_SetOptionsObsolete since JSAPI 27
- JS_GetOptionsObsolete since JSAPI 27
- JS_ToggleOptionsObsolete since JSAPI 27
- enum JSVersion
- JS_GetImplementationVersion
- JS_GetVersion
- JS_SetVersionForCompartmentAdded in SpiderMonkey 31
- JS_StringToVersion
- JS_VersionToString
- JS_SetVersionObsolete since JSAPI 25
- JS::CurrentGlobalOrNullAdded in SpiderMonkey 31
- JS_GetGlobalForScopeChainObsolete since JSAPI 25
- JS_GetGlobalObjectObsolete since JSAPI 24
- JS_SetGlobalObjectObsolete since JSAPI 25
- JS_EnumerateResolvedStandardClassesObsolete since JSAPI 24
- JS_IsAssigningObsolete since JavaScript 1.8.5
- JS_IsConstructingObsolete since JSAPI 26
- JS_IsConstructing_PossiblyWithGivenThisObjectObsolete since JSAPI 17
- JS_GetScopeChainObsolete since JavaScript 1.8.7
Compartments:
- class JSAutoCompartmentAdded in SpiderMonkey 24
- JS_NewGlobalObjectAdded in SpiderMonkey 17
- JS_EnterCompartmentAdded in SpiderMonkey 24
- JS_LeaveCompartmentAdded in SpiderMonkey 24
- JS_GetCompartmentPrivateAdded in SpiderMonkey 1.8.5
- JS_SetCompartmentPrivateAdded in SpiderMonkey 1.8.5
- JS_GetGlobalForCompartmentOrNullAdded in SpiderMonkey 17
- JS_IterateCompartmentsAdded in SpiderMonkey 17
- JS_SetDestroyCompartmentCallbackAdded in SpiderMonkey 17
- JS_SetCompartmentNameCallbackAdded in SpiderMonkey 17
- JS_NewCompartmentAndGlobalObjectAdded in SpiderMonkey 1.8.1 Obsolete since JSAPI 16
- JS_EnterCrossCompartmentCallAdded in SpiderMonkey 1.8.1 Obsolete since JSAPI 18
- JS_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 36
- JS_EvaluateUCScriptObsolete since JSAPI 36
- JS_EvaluateScriptForPrincipalsObsolete since JSAPI 30
- JS_EvaluateUCScriptForPrincipalsObsolete since JSAPI 30
- JS_EvaluateScriptForPrincipalsVersionObsolete since JSAPI 30
- JS_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 17
- JS::CompileOffThreadAdded in SpiderMonkey 31
- JS::CanCompileOffThreadAdded in SpiderMonkey 31
- JS::FinishOffThreadScriptAdded in SpiderMonkey 31
- JS_CompileScript
- JS_CompileUCScript
- JS_BufferIsCompilableUnit
- JS_ExecuteScript
- JS::CloneAndExecuteScriptAdded in SpiderMonkey 31
- JS_DecompileScript
- JS_ExecuteScriptVersionObsolete since JSAPI 36
- JS_CompileUTF8FileAdded in SpiderMonkey 11 Obsolete since JSAPI 19
- JS_CompileUTF8FileHandleAdded in SpiderMonkey 11 Obsolete since JSAPI 19
- JS_CompileUTF8FileHandleForPrincipalsAdded in SpiderMonkey 11 Obsolete since JSAPI 19
- JS_CompileFileObsolete since JSAPI 11
- JS_CompileFileHandleObsolete since JSAPI 11
- JS_CompileFileHandleForPrincipalsObsolete since JSAPI 11
- JS_CompileScriptForPrincipalsObsolete since JSAPI 28
- JS_CompileUCScriptForPrincipalsObsolete since JSAPI 28
- JS_CompileScriptForPrincipalsVersionObsolete since JSAPI 19
- JS_CompileUCScriptForPrincipalsVersionObsolete since JSAPI 19
- JS_GetScriptObjectObsolete since JSAPI 8
- JS_NewScriptObjectObsolete since JSAPI 8
- JS_ExecuteScriptPartObsolete since JavaScript 1.9.3
- JS_DestroyScriptObsolete since JSAPI 8
You can also compile JavaScript code into a function:
- struct JSFunction
- JS::CompileFunctionAdded in SpiderMonkey 17
- JS_DecompileFunction
- JS_DecompileFunctionBody
- JS_CompileFunctionObsolete since JSAPI 36
- JS_CompileFunctionForPrincipalsObsolete since JSAPI 28
- JS_CompileUCFunctionObsolete since JSAPI 36
- JS_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_ReportError
- JS_ReportWarning
- JS_ReportErrorNumber
- JS_ReportErrorNumberUC
- JS_ReportErrorFlagsAndNumber
- JS_ReportErrorFlagsAndNumberUC
- JS_ReportErrorNumberUCArrayAdded in SpiderMonkey 24
- JS_ReportOutOfMemory
- JS_ReportAllocationOverflowAdded in SpiderMonkey 1.8
- JS_GetErrorReporter
- JS_SetErrorReporter
- JS_ErrorFromException
- JS_GetErrorPrototype
- JSREPORT_IS_EXCEPTION
- JSREPORT_IS_STRICT
- JSREPORT_IS_WARNING
- JSREPORT_IS_STRICT_MODE_ERROR
The following functions allow C/C++ functions to throw and catch JavaScript exceptions:
- JS::CreateErrorAdded in SpiderMonkey 38
- JS_IsExceptionPending
- JS_GetPendingException
- JS_SetPendingException
- JS_ClearPendingException
- JS_ThrowStopIterationAdded in SpiderMonkey 1.8
- JS_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 24
- JS::UndefinedValueAdded in SpiderMonkey 24
- JS::BooleanValueAdded in SpiderMonkey 24
- JS::TrueValueAdded in SpiderMonkey 24
- JS::FalseValueAdded in SpiderMonkey 24
- JS::NumberValueAdded in SpiderMonkey 24
- JS::Int32ValueAdded in SpiderMonkey 24
- JS::DoubleValueAdded in SpiderMonkey 24
- JS::Float32ValueAdded in SpiderMonkey 24
- JS::StringValueAdded in SpiderMonkey 24
- JS::ObjectValueAdded in SpiderMonkey 24
- JS::ObjectOrNullValueAdded in SpiderMonkey 24
- JS::SymbolValueAdded in SpiderMonkey 38
JS::Value constants:
- JS::NullHandleValueAdded in SpiderMonkey 24
- JS::UndefinedHandleValueAdded in SpiderMonkey 24
- JS::TrueHandleValueAdded in SpiderMonkey 38
- JS::FalseHandleValueAdded in SpiderMonkey 38
jsval constants:
- JSVAL_NULLObsolete since JSAPI 42
- JSVAL_VOIDObsolete since JSAPI 42
- JSVAL_TRUEObsolete since JSAPI 42
- JSVAL_FALSEObsolete since JSAPI 42
- JSVAL_ZEROObsolete since JSAPI 42
- JSVAL_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 32
- JSVAL_IS_VOIDObsolete since JSAPI 32
- JSVAL_IS_BOOLEANObsolete since JSAPI 32
- JSVAL_IS_NUMBERObsolete since JSAPI 32
- JSVAL_IS_INTObsolete since JSAPI 32
- JSVAL_IS_DOUBLEObsolete since JSAPI 32
- JSVAL_IS_STRINGObsolete since JSAPI 32
- JSVAL_IS_OBJECTObsolete since JSAPI 15
- JSVAL_IS_PRIMITIVEObsolete since JSAPI 32
- JSVAL_IS_GCTHINGObsolete since JSAPI 32
High-level type-conversion routines for packing and unpacking function arguments.
- JS_ConvertArgumentsObsolete since JSAPI 38
- JS_ConvertArgumentsVAObsolete since JSAPI 38
- JS_PushArgumentsObsolete since JavaScript 1.8.5
- JS_PushArgumentsVAObsolete since JavaScript 1.8.5
- JS_PopArgumentsObsolete since JavaScript 1.8.5
- JS_AddArgumentFormatterObsolete since JSAPI 18
- JS_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 17
- JS::ToUint16Added in SpiderMonkey 17
- JS::ToInt32Added in SpiderMonkey 17
- JS::ToUint32Added in SpiderMonkey 17
- JS::ToInt64Added in SpiderMonkey 17
- JS::ToUint64Added in SpiderMonkey 17
- JS::ToNumberAdded in SpiderMonkey 17
- JS::ToStringAdded in SpiderMonkey 31
- JS::OrdinaryToPrimitiveAdded in SpiderMonkey 38
- JS_ValueToConstructor
- JS_ValueToFunction
- JS_ValueToObject
- JS_ValueToSource
- JS_ConvertValue
- JS_ValueToBooleanObsolete since JSAPI 28
- JS_ValueToECMAInt32Obsolete since JSAPI 26
- JS_ValueToECMAUint32Obsolete since JSAPI 28
- JS_ValueToInt32Obsolete since JSAPI 28
- JS_ValueToNumberObsolete since JSAPI 27
- JS_ValueToStringObsolete since JSAPI 28
- JS_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 42
- INT_TO_JSVALObsolete since JSAPI 42
- DOUBLE_TO_JSVALObsolete since JSAPI 42
- OBJECT_TO_JSVALObsolete since JSAPI 42
- STRING_TO_JSVALObsolete since JSAPI 42
- PRIVATE_TO_JSVALObsolete since JSAPI 42
- INT_FITS_IN_JSVALObsolete since JavaScript 1.8.5
- JSVAL_TO_BOOLEANObsolete since JSAPI 32
- JSVAL_TO_INTObsolete since JSAPI 32
- JSVAL_TO_DOUBLEObsolete since JSAPI 32
- JSVAL_TO_OBJECTObsolete since JSAPI 32
- JSVAL_TO_STRINGObsolete since JSAPI 32
- JSVAL_TO_GCTHINGObsolete since JSAPI 32
- JSVAL_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_malloc
- JS_free
- JS_realloc
- JS_strdup
- struct JSFreeOpAdded in SpiderMonkey 17
- JS_freeopAdded in SpiderMonkey 17
- JS_GetDefaultFreeOpAdded in SpiderMonkey 17
JavaScript objects, strings, and floating-point numbers are garbage collected. These functions provide access to the garbage collector:
- JS_GC
- JS_MaybeGC
- JS_GetGCParameter
- JS_SetGCParameter
- JS_GetGCParameterForThreadAdded in SpiderMonkey 17
- JS_SetGCParameterForThreadAdded in SpiderMonkey 17
- JS_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 38
- JS_SetGCZealAdded in SpiderMonkey 1.8
- JS_ScheduleGCAdded in SpiderMonkey 17
- JS_DumpHeapAdded in SpiderMonkey 1.8
- JS_SetGCCallbackRTObsolete since JSAPI 13
- JS_SetFinalizeCallbackAdded in SpiderMonkey 17 Obsolete since JSAPI 32
- JS_MarkGCThingObsolete since JSAPI 5
- JS_IsAboutToBeFinalizedObsolete since JSAPI 35
- JS_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 38- JS::AddValueRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38
- JS::AddStringRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38
- JS::AddObjectRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38
- JS::AddNamedValueRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38
- JS::AddNamedValueRootRTAdded in SpiderMonkey 31 Obsolete since JSAPI 38
- JS::AddNamedScriptRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38
- JS::AddNamedStringRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38
- JS::AddNamedObjectRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38
 
- JS::Remove*RootAdded in SpiderMonkey 31 Obsolete since JSAPI 38- JS::RemoveValueRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38
- JS::RemoveStringRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38
- JS::RemoveObjectRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38
- JS::RemoveScriptRootAdded in SpiderMonkey 31 Obsolete since JSAPI 38
- JS::RemoveValueRootRTAdded in SpiderMonkey 31 Obsolete since JSAPI 38
- JS::RemoveStringRootRTAdded in SpiderMonkey 31 Obsolete since JSAPI 38
- JS::RemoveObjectRootRTAdded in SpiderMonkey 31 Obsolete since JSAPI 38
- JS::RemoveScriptRootRTAdded in SpiderMonkey 31 Obsolete since JSAPI 38
 
- JS_Add*RootObsolete since JSAPI 31- JS_AddValueRootObsolete since JSAPI 31
- JS_AddStringRootObsolete since JSAPI 31
- JS_AddObjectRootObsolete since JSAPI 31
- JS_AddGCThingRootObsolete since JSAPI 31
- JS_AddNamedValueRootObsolete since JSAPI 31
- JS_AddNamedStringRootObsolete since JSAPI 31
- JS_AddNamedObjectRootObsolete since JSAPI 31
- JS_AddNamedGCThingRootObsolete since JSAPI 31
 
- JS_Remove*RootObsolete since JSAPI 31- JS_RemoveValueRootObsolete since JSAPI 31
- JS_RemoveStringRootObsolete since JSAPI 31
- JS_RemoveObjectRootObsolete since JSAPI 31
- JS_RemoveGCThingRootObsolete since JSAPI 31
 
- JS_AddRootObsolete since JavaScript 1.8.5
- JS_AddNamedRootObsolete since JavaScript 1.8.5
- JS_AddNamedRootRTObsolete since JavaScript 1.8.5
- JS_RemoveRootObsolete since JavaScript 1.8.5
- JS_RemoveRootRTObsolete since JavaScript 1.8.5
- JS_MapGCRootsObsolete since JSAPI 19
- JSGCMapRootFunObsolete since JSAPI 19
- JS_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.5
- JS_LeaveLocalRootScopeObsolete since JavaScript 1.8.5
- JS_LeaveLocalRootScopeWithResultObsolete since JavaScript 1.8.5
- JS_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 JSTraceOpJSMarkOp hook was used instead. This has since been removed.)
The tracing APIs are used by the garbage collector and JSTraceOp
- struct JSTracerAdded in SpiderMonkey 1.8
- JS_TraceChildrenAdded in SpiderMonkey 1.8
- JS_TraceRuntimeAdded in SpiderMonkey 1.8
- JSVAL_IS_TRACEABLEAdded in SpiderMonkey 1.8 Obsolete since JSAPI 31
- JSVAL_TO_TRACEABLEAdded in SpiderMonkey 1.8 Obsolete since JSAPI 31
- JSVAL_TRACE_KINDAdded in SpiderMonkey 1.8 Obsolete since JSAPI 31
- JS_TRACER_INITAdded in SpiderMonkey 1.8 Obsolete since JSAPI 12
- JS_TracerInitAdded in SpiderMonkey 12 Obsolete since JSAPI 31
- JS_CallTracerAdded in SpiderMonkey 1.8 Obsolete since JSAPI 22
- JS_SET_TRACING_DETAILSAdded in SpiderMonkey 1.8 Obsolete since JSAPI 26
- JS_SET_TRACING_INDEXAdded in SpiderMonkey 1.8 Obsolete since JSAPI 26
- JS_SET_TRACING_NAMEAdded in SpiderMonkey 1.8 Obsolete since JSAPI 26
- JS_CALL_TRACERAdded in SpiderMonkey 1.8 Obsolete since JSAPI 23
- JS_CALL_VALUE_TRACERAdded in SpiderMonkey 1.8 Obsolete since JSAPI 23
- JS_CALL_OBJECT_TRACERAdded in SpiderMonkey 1.8 Obsolete since JSAPI 23
- JS_CALL_STRING_TRACERAdded in SpiderMonkey 1.8 Obsolete since JSAPI 23
- JS_CALL_DOUBLE_TRACERAdded in SpiderMonkey 1.8 Obsolete since JavaScript 1.8.5
- JS_PrintTraceThingInfo(DEBUG-only) Added in SpiderMonkey 1.8 Obsolete since JSAPI 16
Miscellaneous GC APIs:
- JS_updateMallocCounterAdded in SpiderMonkey 17
- JS::SetLargeAllocationFailureCallbackAdded in SpiderMonkey 31
- JS::SetOutOfMemoryCallbackAdded in SpiderMonkey 31
- JS_EnumerateDiagnosticMemoryRegionsAdded in SpiderMonkey 17
- JSVAL_LOCKObsolete since JSAPI 18
- JSVAL_UNLOCKObsolete since JSAPI 18
- JS_LockGCThingObsolete since JSAPI 21
- JS_LockGCThingRTObsolete since JSAPI 22
- JS_UnlockGCThingObsolete since JSAPI 21
- JS_UnlockGCThingRTObsolete since JSAPI 22
Numbers
- JS_NumberValueAdded in SpiderMonkey 17
- JS_DefineConstDoubles- struct JSConstDoubleSpec
 
- struct 
- JS_DefineConstIntegersAdded in SpiderMonkey 38- struct JSConstIntegerSpecAdded in SpiderMonkey 38
 
- struct 
- JS_GetNaNValue
- JS_GetNegativeInfinityValue
- JS_GetPositiveInfinityValue
- JS_DoubleIsInt32Added in SpiderMonkey 17
- JS_DoubleToInt32Added in SpiderMonkey 17 Obsolete since JSAPI 38
- JS_DoubleToUint32Added in SpiderMonkey 17 Obsolete since JSAPI 38
- JS_NewNumberValueObsolete since JSAPI 17
- JS_NewDoubleValueObsolete since JSAPI 17
- JS_NewDoubleObsolete since JSAPI 17
Strings
- typedef JSString
- class JSAutoByteStringAdded in SpiderMonkey 17
- JS_NewStringCopyN
- JS_NewStringCopyZ
- JS_NewUCString
- JS_NewUCStringCopyN
- JS_NewUCStringCopyZ
- JS_NewDependentString
- JS_GetEmptyStringValue
- JS_GetEmptyStringAdded in SpiderMonkey 1.8.5
- JS_ConcatStrings
- JS_CompareStrings
- JS_StringEqualsAsciiAdded in SpiderMonkey 1.8.5
- JS_FlatStringEqualsAsciiAdded in SpiderMonkey 1.8.5
- JS_StringHasLatin1CharsAdded in SpiderMonkey 38
- JS_GetStringCharAtAdded in SpiderMonkey 38
- JS_GetFlatStringCharAtAdded in SpiderMonkey 38
- JS_GetStringLength
- JS_EncodeStringAdded in SpiderMonkey 1.8
- JS_EncodeStringToUTF8Added in SpiderMonkey 24
- JS_EncodeStringToBufferAdded in SpiderMonkey 1.8.5
- JS_GetStringEncodingLengthAdded in SpiderMonkey 1.8.5
- JS_GetLatin1FlatStringCharsAdded in SpiderMonkey 38
- JS_GetTwoByteFlatStringCharsAdded in SpiderMonkey 38
- JS_GetLatin1StringCharsAndLengthAdded in SpiderMonkey 38
- JS_GetTwoByteStringCharsAndLengthAdded in SpiderMonkey 38
- JS::GetDeflatedUTF8StringLengthAdded in SpiderMonkey 38
- JS::DeflateStringToUTF8BufferAdded in SpiderMonkey 38
- JS_FileEscapedStringAdded in SpiderMonkey 1.8.5
- JS_PutEscapedStringAdded in SpiderMonkey 1.8.5
- JS_PutEscapedFlatStringAdded in SpiderMonkey 1.8.5
- JS_FORGET_STRING_FLATNESSAdded in SpiderMonkey 1.8.5
- JS_StringIsFlatAdded in SpiderMonkey 38
- JS_ASSERT_STRING_IS_FLATAdded in SpiderMonkey 1.8.5
- JS_FlattenStringAdded in SpiderMonkey 1.8.5
- typedef jscharObsolete since JSAPI 35
- JS_NewStringObsolete since JSAPI 1.8.5
- JS_NewGrowableStringObsolete since JSAPI 27
- JS_GetStringBytesObsolete since JSAPI 1.8.5
- JS_GetStringBytesZObsolete since JSAPI 1.8.5
- JS_GetStringCharsObsolete since JSAPI 1.8.5
- JS_GetStringCharsZObsolete since JSAPI 33
- JS_GetStringCharsAndLengthAdded in JSAPI 1.8.5 Obsolete since JSAPI 33
- JS_GetStringCharsZAdded in SpiderMonkey 1.8.5 Obsolete since JSAPI 33
- JS_GetStringCharsZAndLengthAdded in SpiderMonkey 1.8.5 Obsolete since JSAPI 33
- JS_GetFlatStringCharsObsolete since JSAPI 33
- JS_MakeStringImmutableObsolete since JavaScript 1.8.5
- JS_EncodeCharactersObsolete since JSAPI 19
- JS_CStringsAreUTF8Obsolete since JSAPI 19
- JS_SetCStringsAreUTF8Obsolete since JSAPI 19
Interning strings tells the SpiderMonkey engine to reuse existing string objects when possible.
- JS_InternString
- JS_InternStringN
- JS_InternUCString
- JS_InternUCStringN
- JS_InternJSStringAdded in SpiderMonkey 1.8.5
- JS_StringHasBeenInternedAdded in SpiderMonkey 17
- JS_GetLatin1InternedStringCharsAdded in SpiderMonkey 38
- JS_GetTwoByteInternedStringCharsAdded in SpiderMonkey 38
- JS_GetInternedStringCharsObsolete since JSAPI 33
- JS_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_NewExternalString
- JS_IsExternalStringAdded in SpiderMonkey 17
- JS_GetTwoByteExternalStringCharsAdded in SpiderMonkey 38
- JS_GetExternalStringFinalizerAdded in SpiderMonkey 17
- JS_AddExternalStringFinalizerObsolete since JSAPI 13
- JS_RemoveExternalStringFinalizerObsolete since JSAPI 13
- JS_GetExternalStringGCTypeObsolete since JSAPI 13
- JS_NewExternalStringWithClosureAdded in SpiderMonkey 6 Obsolete since JSAPI 13
- JS_GetExternalStringClosureAdded in SpiderMonkey 6 Obsolete since JSAPI 13
Objects
- typedef JSObject
- JS_DefineObject
- JS_NewObject
- JS_NewPlainObjectAdded in SpiderMonkey 38
- JS_NewObjectForConstructorAdded in SpiderMonkey 1.8.5
- JS_NewGlobalObjectAdded in SpiderMonkey 1.8
- JS_NewObjectWithGivenProto
- JS_NewAdded in SpiderMonkey 1.8
- JS_IsGlobalObjectAdded in JSAPI 24
- JS_ConstructObjectObsolete since JSAPI 16
- JS_ConstructObjectWithArgumentsObsolete since JSAPI 16
- JS_GetClass
- JS_GetObjectPrototypeAdded in JSAPI 17
- JS_GetFunctionPrototypeAdded in SpiderMonkey 17
- JS_GetArrayPrototypeAdded in SpiderMonkey 24
- JS_GetConstructor
- JS_GetGlobalForObject
- JS_GetInstancePrivate
- JS_GetPrototype
- JS_SetPrototype
- JS_GetPrivate
- JS_SetPrivate
- JS_FreezeObjectAdded in SpiderMonkey 1.8.5
- JS_DeepFreezeObjectAdded in SpiderMonkey 1.8.5
- JS_IsExtensibleAdded in SpiderMonkey 1.8.5
- JS_PreventExtensionsAdded in SpiderMonkey 45
- JS_InstanceOf
- JS_HasInstance
- JS_IsNativeAdded in SpiderMonkey 17
- JS::ToPrimitiveAdded in SpiderMonkey 45
- JS::NewFunctionFromSpecAdded in SpiderMonkey 45
- JS_DefaultValueObsolete since JSAPI 44
- JS_GET_CLASSObsolete since JSAPI 13
- JS_SealObjectObsolete since JavaScript 1.8.5
- JS_GetParentObsolete since JSAPI 39
- JS_SetParentObsolete since JSAPI 39
Standard Objects
- enum JSProtoKeyAdded in SpiderMonkey 24
- JS_GetClassObject
- JS_GetClassPrototype
- JS::ProtoKeyToIdAdded in SpiderMonkey 38
- JS_IdToProtoKeyAdded in SpiderMonkey 31
- JS::IdentifyStandardInstanceAdded in SpiderMonkey 31
- JS::IdentifyStandardPrototypeAdded in SpiderMonkey 31
- JS::IdentifyStandardInstanceOrPrototypeAdded in SpiderMonkey 31
- JS::IdentifyStandardConstructorAdded in SpiderMonkey 38
Date
- JS_NewDateObjectAdded in SpiderMonkey 1.8.5
- JS_NewDateObjectMsecAdded in SpiderMonkey 1.8.5
- JS_ObjectIsDateAdded in SpiderMonkey 1.8.5
- JS_ClearDateCachesAdded in SpiderMonkey 17
- JS_Now
Intl API
- JS_SetDefaultLocaleAdded in SpiderMonkey 24
- JS_ResetDefaultLocaleAdded in SpiderMonkey 24
Properties
These functions correspond directly to the ways scripts access object properties:
- JS_GetProperty
- JS_GetUCProperty
- JS_GetPropertyByIdAdded in SpiderMonkey 1.8.1
- JS_SetProperty
- JS_SetUCProperty
- JS_SetPropertyByIdAdded in SpiderMonkey 1.8.1
- JS_HasProperty
- JS_HasUCProperty
- JS_HasPropertyByIdAdded in SpiderMonkey 1.8.1
- JS_HasOwnPropertyAdded in JSAPI 45
- JS_HasOwnPropertyByIdAdded in JSAPI 45
- JS_DeleteProperty
- JS_DeletePropertyByIdAdded in SpiderMonkey 1.8.1
- JS_DeleteProperty2Obsolete since JSAPI 39
- JS_DeleteUCProperty2Obsolete since JSAPI 39
- JS_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 attributes- JSPROP_ENUMERATE
- JSPROP_READONLY
- JSPROP_PERMANENT
- JSPROP_PROPOP_ACCESSORSAdded in SpiderMonkey 38
- JSPROP_GETTER
- JSPROP_SETTER
- JSPROP_SHARED
- JSPROP_INDEX
- JSPROP_DEFINE_LATEAdded in SpiderMonkey 38
- JSFUN_STUB_GSOPSAdded in SpiderMonkey 17
- JSFUN_CONSTRUCTORAdded in SpiderMonkey 17
- JSPROP_REDEFINE_NONCONFIGURABLEAdded in SpiderMonkey 38
- JSPROP_RESOLVINGAdded in SpiderMonkey 45
- JSPROP_IGNORE_ENUMERATEAdded in SpiderMonkey 38
- JSPROP_IGNORE_READONLYAdded in SpiderMonkey 38
- JSPROP_IGNORE_PERMANENTAdded in SpiderMonkey 38
- JSPROP_IGNORE_VALUEAdded in SpiderMonkey 38
 
- JS_AlreadyHasOwnElementAdded in SpiderMonkey 1.8
- JS_AlreadyHasOwnPropertyAdded in SpiderMonkey 1.8
- JS_AlreadyHasOwnUCPropertyAdded in SpiderMonkey 1.8
- JS_AlreadyHasOwnPropertyByIdAdded in SpiderMonkey 1.8.1
- JS_DefineProperty
- JS_DefineUCProperty
- JS_DefinePropertyByIdAdded in SpiderMonkey 1.8.1
- JS_DefineProperties
- JS_Enumerate
- JS_ForwardGetPropertyToAdded in SpiderMonkey 17
- JS_ForwardGetElementToAdded in SpiderMonkey 17
- JS_GetPropertyDescriptorAdded in SpiderMonkey 31
- JS_GetPropertyDescriptorByIdAdded in SpiderMonkey 1.8.1
- JS_GetOwnPropertyDescriptorAdded in SpiderMonkey 31
- JS_GetOwnPropertyDescriptorByIdAdded in SpiderMonkey 31
- JS_GetOwnUCPropertyDescriptorAdded in SpiderMonkey 45
- JS_SetAllNonReservedSlotsToUndefinedAdded in SpiderMonkey 24
- JS_AliasPropertyObsolete since JSAPI 8
- JS_ClearScopeObsolete since JSAPI 18
- JS_ClearNonGlobalObjectAdded in SpiderMonkey 18 Obsolete since JSAPI 34
- JS_DefineOwnPropertyAdded in SpiderMonkey 1.8.5 Obsolete since JSAPI 33
- JS_DefinePropertyWithTinyIdObsolete since JSAPI 30
- JS_DefineUCPropertyWithTinyIdObsolete since JSAPI 30
- JS_GetPropertyDefaultObsolete since JSAPI 26
- JS_GetPropertyByIdDefaultObsolete since JSAPI 26
- JS_GetPropertyAttributesObsolete since JSAPI 26
- JS_GetUCPropertyAttributesObsolete since JSAPI 26
- JS_GetPropertyAttrsGetterAndSetterObsolete since JSAPI 26
- JS_GetUCPropertyAttrsGetterAndSetterObsolete since JSAPI 26
- JS_GetPropertyAttrsGetterAndSetterByIdObsolete since JSAPI 26
- JS_LookupPropertyObsolete since JSAPI 37
- JS_LookupUCPropertyObsolete since JSAPI 37
- JS_LookupPropertyByIdObsolete since JSAPI 37
- JS_LookupElementObsolete since JSAPI 37
- JS_LookupPropertyWithFlagsObsolete since JSAPI 31
- JS_LookupPropertyWithFlagsByIdObsolete since JSAPI 31
- JS_NewPropertyIteratorObsolete since JSAPI 36
- JS_NextPropertyObsolete since JSAPI 36
- JS_SetPropertyAttributesObsolete since JSAPI 26
- JS_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 23
- JS_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_IdToValue
- JS_IdToProtoKeyAdded in SpiderMonkey 31
- JS_ValueToId
- JS_StringToIdAdded in SpiderMonkey 38
- JS_IndexToIdAdded in SpiderMonkey 17
- JS_CharsToIdAdded in SpiderMonkey 24
- JS::ProtoKeyToIdAdded in SpiderMonkey 38
- JS_IsIdentifierAdded in SpiderMonkey 17
- struct JSIdArray
- class JS::AutoIdArrayAdded in SpiderMonkey 17
- JS_IdArrayLengthAdded in SpiderMonkey 17
- JS_IdArrayGetAdded in SpiderMonkey 17
- JS_DestroyIdArray
- JS_GetObjectIdObsolete since JSAPI 31
jsid constants:
- JSID_VOID
- JSID_VOIDHANDLEAdded in SpiderMonkey 31
- JSID_EMPTY
- JSID_EMPTYHANDLEAdded in SpiderMonkey 31
Function for checking and converting the type of a jsid:
- JSID_IS_ZERO
- JSID_IS_VOID
- JSID_IS_EMPTY
- JSID_IS_STRING
- JSID_TO_STRING
- INTERNED_STRING_TO_JSIDAdded in SpiderMonkey 38
- JSID_TO_FLAT_STRINGAdded in SpiderMonkey 17
- JSID_IS_INT
- JSID_TO_INT
- INT_FITS_IN_JSID
- INT_TO_JSID
- JSID_IS_SYMBOLAdded in SpiderMonkey 38
- JSID_TO_SYMBOLAdded in SpiderMonkey 38
- SYMBOL_TO_JSIDAdded in SpiderMonkey 38
- JSID_IS_GCTHING
- JSID_TO_GCTHING
- JSID_IS_OBJECTObsolete since JSAPI 33
- JSID_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_InitClass
- JS_LinkConstructorAndPrototypeAdded in SpiderMonkey 17
- JS::PropertySpecNameIsSymbolAdded in SpiderMonkey 38
- JS::PropertySpecNameEqualsIdAdded in SpiderMonkey 38
- JS::PropertySpecNameToPermanentIdAdded in SpiderMonkey 38
- JS_GetReservedSlot
- JS_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.8
- JS_FNAdded in SpiderMonkey 1.8
- JS_SYM_FNAdded in SpiderMonkey 38
- JS_FNINFOAdded in SpiderMonkey 17
- JS_SELF_HOSTED_FNAdded in SpiderMonkey 31
- JS_SELF_HOSTED_SYM_FNAdded in SpiderMonkey 38
- JS_SYM_FNSPECAdded in SpiderMonkey 38
- JS_FNSPECAdded in SpiderMonkey 31
- JS_FS_ENDAdded in SpiderMonkey 1.8
- struct JSPropertySpec
- JS_PSGAdded in SpiderMonkey 17
- JS_PSGSAdded in SpiderMonkey 17
- JS_SELF_HOSTED_GETAdded in SpiderMonkey 31
- JS_SELF_HOSTED_GETSETAdded in SpiderMonkey 31
- JS_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.flags- JSCLASS_HAS_PRIVATE
- JSCLASS_PRIVATE_IS_NSISUPPORTS
- JSCLASS_IS_DOMJSCLASSAdded in SpiderMonkey 17
- JSCLASS_IMPLEMENTS_BARRIERSAdded in SpiderMonkey 17
- JSCLASS_EMULATES_UNDEFINEDAdded in SpiderMonkey 24
- JSCLASS_HAS_RESERVED_SLOTS(n)
- JSCLASS_GLOBAL_FLAGS
- JSCLASS_NEW_ENUMERATEObsolete since JSAPI 37
- JSCLASS_NEW_RESOLVEObsolete since JSAPI 36
- JSCLASS_SHARE_ALL_PROPERTIESObsolete since JavaScript 1.8.5
- JSCLASS_NEW_RESOLVE_GETS_STARTObsolete since JSAPI 16
- JSCLASS_CONSTRUCT_PROTOTYPEObsolete since JSAPI 11
- JSCLASS_IS_EXTENDEDObsolete since JSAPI 17
- JSCLASS_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:
- JSPropertyOp
- JSStrictPropertyOpAdded in SpiderMonkey 1.9.3
- JSDeletePropertyOpAdded in SpiderMonkey 24
- JSEnumerateOp
- JSNewEnumerateOp
- JSResolveOp
- JSConvertOp
- JSFinalizeOp
- JSHasInstanceOp
- JSTraceOp
- JSCheckAccessOpObsolete
- JSXDRObjectOpObsolete since JSAPI 13
- JSNewResolveOpObsolete since JSAPI 36
- JSMarkOpObsolete since JSAPI 5
- JSGetObjectOpsObsolete since JavaScript 1.8.5
- JSReserveSlotsOpObsolete since JavaScript 1.8.5
These stub functions can be used when creating a custom JSClass:
- JS_ConvertStubObsolete since JSAPI 37
- JS_DeletePropertyStubObsolete since JSAPI 37
- JS_EnumerateStubObsolete since JSAPI 37
- JS_FinalizeStubObsolete since JSAPI 15
- JS_ResolveStubObsolete since JSAPI 37
JSExtendedClass method types:
In JS 1.8.5, JSExtendedClass has made private.
- JSIteratorOpObsolete since JSAPI 26
- JSEqualityOpObsolete since JavaScript 1.8.5
- JSObjectOpObsolete since JavaScript 1.8.5
JSObjectOps method types:
In JS 1.8.5, JSObjectOps has been made private.
- JSNewObjectMapOpObsolete since JavaScript 1.8.5
- JSObjectMapOpObsolete since JavaScript 1.8.5
- JSLookupPropOpObsolete since JavaScript 1.8.5
- JSDefinePropOpObsolete since JavaScript 1.8.5
- JSPropertyIdOpObsolete since JavaScript 1.8.5
- JSAttributesOpObsolete since JavaScript 1.8.5
- JSObjectOps.defaultValueObsolete since JavaScript 1.8.5
- JSCheckAccessIdOpObsolete since JavaScript 1.8.5
- JSObjectOpObsolete since JavaScript 1.8.5
- JSPropertyRefOpObsolete since JavaScript 1.8.5
- JSSetObjectSlotOpObsolete since JavaScript 1.8.5
- JSGetRequiredSlotOpObsolete since JavaScript 1.8.5
- JSSetRequiredSlotOpObsolete since JavaScript 1.8.5
JSXMLObjectOps method types:
In JS 1.8.5, JSXMLObjectOps has been made private.
- JSGetMethodOpObsolete since JavaScript 1.8.5
- JSSetMethodOpObsolete since JavaScript 1.8.5
- JSEnumerateValuesOpObsolete since JavaScript 1.8.5
- JSConcatenateOpObsolete since JavaScript 1.8.5
Arrays
- JS_HasArrayLengthObsolete since JSAPI 8
- JS_AliasElementObsolete since JSAPI 8
- JS_LookupElementObsolete since JSAPI 37
- JS_DeleteElement2Obsolete since JSAPI 39
Functions
Calling a function or a method of an object:
- class JS::CallArgsAdded in SpiderMonkey 17
- JS::CallArgsFromVpAdded in SpiderMonkey 17
- JS::CallAdded in SpiderMonkey 17
- JS::ConstructAdded in SpiderMonkey 38
- JS_CallFunction
- JS_CallFunctionName
- JS_CallFunctionValue
- JS::IsCallableAdded in SpiderMonkey 38
- JS::IsConstructorAdded in SpiderMonkey 38
- JS_IsNativeFunctionAdded in SpiderMonkey 17
- JS_IsConstructorAdded in SpiderMonkey 24
- JS_BindCallableAdded in SpiderMonkey 17
- JS_IsBuiltinEvalFunctionAdded in SpiderMonkey 17
- JS_IsBuiltinFunctionConstructorAdded in SpiderMonkey 17
Function accessors:
- JS_ObjectIsFunction
- JS_GetFunctionArity
- JS_GetFunctionId
- JS_GetFunctionDisplayIdAdded in SpiderMonkey 17
- JS_GetFunctionScriptAdded in SpiderMonkey 38
- JS_GetFunctionObject
- JS_GetFunctionFlagsObsolete since JSAPI 19
- JS_GetFunctionNameObsolete since JavaScript 1.8.5
Creating functions:
- JS::CloneFunctionObjectAdded in SpiderMonkey 36
- JS_DefineFunction
- JS_DefineUCFunction
- JS_DefineFunctionByIdAdded in SpiderMonkey 17
- JS_DefineFunctions- enum PropertyDefinitionBehaviorAdded in SpiderMonkey 38
 
- enum 
- JS_NewFunction
- JS::GetSelfHostedFunctionAdded in JSAPI 31
- JS::NewFunctionFromSpecAdded in JSAPI 45
- JS_NewFunctionByIdAdded in SpiderMonkey 17 Obsolete since JSAPI 44
- JS_CloneFunctionObjectObsolete since JSAPI 36
RegExps
- JS_NewRegExpObject
- JS_NewUCRegExpObject
- JS_NewRegExpObjectNoStatics
- JS_NewUCRegExpObjectNoStatics
- JS_SetRegExpInput
- JS_ClearRegExpStatics
- JS_ObjectIsRegExpAdded in SpiderMonkey 17
- JS_GetRegExpFlagsAdded in SpiderMonkey 17
- JS_GetRegExpSourceAdded in SpiderMonkey 17
- JS_ExecuteRegExp
- JS_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.8
- JS_SetPrincipalsTranscoderObsolete since JavaScript 1.8
- enum JSAccessModeObsolete since JSAPI 29
- JS_CheckAccessObsolete since JSAPI 29
- JSObjectOps.checkAccessObsolete since JavaScript 1.8
- JSClass.checkAccessObsolete since JSAPI 29
- JS_SetCheckObjectAccessCallbackObsolete since JavaScript 1.8
Added in SpiderMonkey 1.8.1 Security callbacks are set per-runtime.
- JSSecurityCallbacks
- JS_GetSecurityCallbacksAdded in SpiderMonkey 13
- JS_SetSecurityCallbacksAdded in SpiderMonkey 13
- JS_SetContextSecurityCallbacksObsolete since JSAPI 13
- JS_GetRuntimeSecurityCallbacksObsolete since JSAPI 13
- JS_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 JS_THREADSAFE
Added in SpiderMonkey 1.8 These functions are always available, but in non-JS_THREADSAFE
- JS_BeginRequest
- JS_EndRequest
- JS_YieldRequestObsolete since JSAPI 18
- JS_SuspendRequestObsolete since JSAPI 18
- JS_ResumeRequestObsolete since JSAPI 18
- JS_GetContextThreadObsolete since JSAPI 8
- JS_SetContextThreadObsolete since JSAPI 8
- JS_ClearContextThreadObsolete since JSAPI 8
The following functions are always available, but in non-JS_THREADSAFE
- JS_LockRuntimeObsolete since JSAPI 12
- JS_UnlockRuntimeObsolete since JSAPI 12
- JS_LockObsolete since JSAPI 12
- JS_UnlockObsolete since JSAPI 12
Time
Callback Types
Native function types:
- JSNative
- JSFastNativeObsolete since JavaScript 1.8.5
Other callback types:
- JS::LargeAllocationFailureCallback
 - used by- JS::SetLargeAllocationFailureCallbackAdded in SpiderMonkey 31
- JS::OffThreadCompileCallback
 - used by- JS::CompileOffThreadAdded in SpiderMonkey 26
- JS::SetOutOfMemoryCallback
 - used by- JS::OutOfMemoryCallbackAdded in SpiderMonkey 31
- JSCompartmentNameCallback
 - used by- JS_SetCompartmentNameCallbackAdded in SpiderMonkey 17
- JSContextCallback
 - used by- JS_SetContextCallback
- JSDestroyCompartmentCallback
 - used by- JS_SetDestroyCompartmentCallbackAdded in SpiderMonkey 17
- JSEnumerateDiagnosticMemoryCallback
 - used by- JS_EnumerateDiagnosticMemoryRegionsAdded in SpiderMonkey 17
- JSErrorCallback
 - used by- JS_ReportErrorNumberand friends
- JSErrorReporter
 - used by- JS_SetErrorReporter
- JSGCCallback
 - used by- JS_SetGCCallback
- JSFinalizeCallbackAdded in SpiderMonkey 17
 - used by- JS_AddFinalizeCallbackAdded in SpiderMonkey 38
 and- JS_SetFinalizeCallbackAdded in SpiderMonkey 17 Obsolete since JSAPI 32
- JSIterateCompartmentCallback
 - used by- JS_IterateCompartmentsAdded in SpiderMonkey 17
- JSBranchCallback
 - used by- JS_SetBranchCallbackObsolete since JavaScript 1.8.1
- JSArgumentFormatter
 - used by- JS_AddArgumentFormatterObsolete since JSAPI 18
- JSFunctionCallback
 - used by- JS_SetFunctionCallbackObsolete since JSAPI 37
- JSGCRootMapFun
 - used by- JS_MapGCRootsObsolete since JSAPI 19
- JSObjectPrincipalsFinder
 - used by- JS_SetObjectPrincipalsFinderObsolete since JavaScript 1.8
- JSPrincipalsTranscoder
 - used by- JS_SetPrincipalsTranscoderObsolete since JavaScript 1.8
- JSStringFinalizeOp
 - used by- JS_AddExternalStringFinalizerObsolete since JSAPI 13
- JSTraceCallback
 - used by- JS_TRACER_INITObsolete since JSAPI 12
- JSTraceDataOp
 - used by- JS_SetExtraGCRootsObsolete since JSAPI 25
- JSTraceNamePrinter
 - used by- JS_SET_TRACING_DETAILSObsolete since JSAPI 26
See also Classes, above.
Macros
- JS_DEFAULT_XML_NAMESPACE_IDObsolete since JSAPI 21
- JSFUN_BOUND_METHODObsolete since JavaScript 1.8.5
- JSFUN_GETTERObsolete since JavaScript 1.8.5
- JSFUN_SETTERObsolete since JavaScript 1.8.5
- JSFUN_GLOBAL_PARENTObsolete since JavaScript 1.8.5
- JSFUN_HEAVYWEIGHTObsolete since JSAPI 19
- JSFUN_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 37
- JS_GetFunctionCallbackAdded in SpiderMonkey 1.8.5 Obsolete since JSAPI 37