BOOLEAN_TO_JSVALDOUBLE_TO_JSVALINT_FITS_IN_JSVALINT_TO_JSVALJS::Add*RootJS::AutoIdArrayJS::AutoSaveExceptionStateJS::AutoValueArrayJS::AutoVectorRooterJS::BooleanValueJS::CallJS::CallArgsJS::CloneFunctionObjectJS::CompileJS::CompileFunctionJS::CompileOffThreadJS::CompileOptionsJS::ConstructJS::CreateErrorJS::CurrentGlobalOrNullJS::DeflateStringToUTF8BufferJS::DoubleNaNValueJS::DoubleValueJS::EvaluateJS::FalseValueJS::Float32ValueJS::GetDeflatedUTF8StringLengthJS::GetFirstArgumentAsTypeHintJS::GetSelfHostedFunctionJS::HandleJS::HandleValueArrayJS::IdentifyStandardInstanceJS::Int32ValueJS::IsCallableJS::MutableHandleJS::NewFunctionFromSpecJS::NullHandleValueJS::NullValueJS::NumberValueJS::ObjectOrNullValueJS::ObjectValueJS::OrdinaryToPrimitiveJS::PersistentRootedJS::PropertySpecNameEqualsIdJS::PropertySpecNameIsSymbolJS::PropertySpecNameToPermanentIdJS::ProtoKeyToIdJS::Remove*RootJS::RootedJS::SetLargeAllocationFailureCallbackJS::SetOutOfMemoryCallbackJS::SourceBufferHolderJS::StringValueJS::SymbolValueJS::ToBooleanJS::ToInt32JS::ToInt64JS::ToNumberJS::ToPrimitiveJS::ToStringJS::ToUint16JS::ToUint32JS::ToUint64JS::TrueHandleValueJS::TrueValueJS::UndefinedHandleValueJS::UndefinedValueJS::ValueJSAutoByteStringJSAutoCompartmentJSBoolJSCheckAccessOpJSClassJSClass.callJSClass.flagsJSConstDoubleSpecJSConvertOpJSDeletePropertyOpJSEnumerateOpJSErrorFormatStringJSErrorReportJSExceptionStateJSExnTypeJSExtendedClassJSExtendedClass.outerObjectJSExtendedClass.wrappedObjectJSFUN_BOUND_METHODJSFUN_GLOBAL_PARENTJSFastNativeJSFinalizeOpJSFreeOpJSFunctionJSFunctionSpecJSGetObjectOpsJSHasInstanceOpJSID_EMPTYJSID_IS_EMPTYJSID_IS_GCTHINGJSID_IS_INTJSID_IS_STRINGJSID_IS_SYMBOLJSID_IS_VOIDJSID_IS_ZEROJSID_VOIDJSIdArrayJSIteratorOpJSMarkOpJSNativeJSNewEnumerateOpJSNewResolveOpJSObjectJSObjectOpJSObjectOps.defaultValueJSObjectOps.definePropertyJSObjectOps.destroyObjectMapJSObjectOps.dropPropertyJSObjectOps.enumerateJSObjectOps.getAttributesJSObjectOps.getPropertyJSObjectOps.getRequiredSlotJSObjectOps.lookupPropertyJSObjectOps.newObjectMapJSObjectOps.setProtoJSObjectPrincipalsFinderJSPRINCIPALS_HOLDJSPrincipalsJSPrincipalsTranscoderJSPropertyJSPropertyDescriptorJSPropertyOpJSPropertySpecJSProtoKeyJSReserveSlotsOpJSResolveOpJSRuntimeJSSecurityCallbacks.contentSecurityPolicyAllowsJSStringJSStringFinalizerJSTraceOpJSTypeJSVAL_IS_BOOLEANJSVAL_IS_DOUBLEJSVAL_IS_GCTHINGJSVAL_IS_INTJSVAL_IS_NULLJSVAL_IS_NUMBERJSVAL_IS_OBJECTJSVAL_IS_PRIMITIVEJSVAL_IS_STRINGJSVAL_IS_VOIDJSVAL_LOCKJSVAL_NULLJSVAL_ONEJSVAL_TO_BOOLEANJSVAL_TO_DOUBLEJSVAL_TO_GCTHINGJSVAL_TO_INTJSVAL_TO_OBJECTJSVAL_TO_STRINGJSVAL_TRUEJSVAL_UNLOCKJSVAL_VOIDJSVAL_ZEROJSVersionJSXDRObjectOpJS_ASSERT_STRING_IS_FLATJS_Add*RootJS_AddArgumentFormatterJS_AddExternalStringFinalizerJS_AddFinalizeCallbackJS_AliasElementJS_AliasPropertyJS_AlreadyHasOwnPropertyJS_BeginRequestJS_BindCallableJS_BufferIsCompilableUnitJS_CStringsAreUTF8JS_CallFunctionJS_CheckAccessJS_CheckForInterruptJS_ClearContextThreadJS_ClearDateCachesJS_ClearNewbornRootsJS_ClearNonGlobalObjectJS_ClearPendingExceptionJS_ClearRegExpStaticsJS_ClearScopeJS_CloneFunctionObjectJS_CompareStringsJS_CompileFileHandleForPrincipalsJS_CompileFileHandleForPrincipalsVersionJS_CompileFunctionJS_CompileFunctionForPrincipalsJS_CompileScriptJS_CompileScriptForPrincipalsJS_CompileUCFunctionForPrincipalsVersionJS_CompileUTF8FileJS_CompileUTF8FileHandleJS_ConcatStringsJS_ConstructObjectJS_ContextIteratorJS_ConvertArgumentsJS_ConvertArgumentsVAJS_ConvertValueJS_DecompileFunctionJS_DecompileFunctionBodyJS_DecompileScriptJS_DecompileScriptObjectJS_DeepFreezeObjectJS_DefaultValueJS_DefineConstDoublesJS_DefineElementJS_DefineFunctionJS_DefineFunctionsJS_DefineObjectJS_DefineOwnPropertyJS_DefinePropertiesJS_DefinePropertyJS_DefinePropertyWithTinyIdJS_DeleteElementJS_DeleteElement2JS_DeletePropertyJS_DeleteProperty2JS_DestroyContextJS_DestroyIdArrayJS_DestroyRuntimeJS_DestroyScriptJS_DoubleIsInt32JS_DoubleToInt32JS_DropExceptionStateJS_DumpHeapJS_DumpNamedRootsJS_EncodeCharactersJS_EncodeStringJS_EncodeStringToBufferJS_EnterCompartmentJS_EnterCrossCompartmentCallJS_EnterLocalRootScopeJS_EnumerateJS_EnumerateDiagnosticMemoryRegionsJS_EnumerateResolvedStandardClassesJS_EnumerateStandardClassesJS_ErrorFromExceptionJS_EvaluateScriptJS_EvaluateScriptForPrincipalsJS_ExecuteRegExpJS_ExecuteScriptJS_ExecuteScriptPartJS_ExecuteScriptVersionJS_FORGET_STRING_FLATNESSJS_FSJS_FileEscapedStringJS_FinishJS_FlattenStringJS_FlushCachesJS_ForgetLocalRootJS_ForwardGetPropertyToJS_FreezeObjectJS_GCJS_GET_CLASSJS_GetArrayLengthJS_GetArrayPrototypeJS_GetClassJS_GetClassObjectJS_GetClassPrototypeJS_GetCompartmentPrivateJS_GetConstructorJS_GetContextPrivateJS_GetContextThreadJS_GetDefaultFreeOpJS_GetElementJS_GetEmptyStringJS_GetEmptyStringValueJS_GetErrorPrototypeJS_GetExternalStringClosureJS_GetExternalStringFinalizerJS_GetFlatStringCharsJS_GetFunctionArityJS_GetFunctionCallbackJS_GetFunctionFlagsJS_GetFunctionIdJS_GetFunctionNameJS_GetFunctionObjectJS_GetFunctionPrototypeJS_GetFunctionScriptJS_GetGCParameterJS_GetGlobalForCompartmentOrNullJS_GetGlobalForObjectJS_GetGlobalForObject3JS_GetGlobalForScopeChainJS_GetGlobalObjectJS_GetImplementationVersionJS_GetInstancePrivateJS_GetInternedStringCharsJS_GetLatin1FlatStringCharsJS_GetLatin1InternedStringCharsJS_GetLatin1StringCharsAndLengthJS_GetLocaleCallbacksJS_GetNaNValueJS_GetObjectPrototypeJS_GetObjectRuntimeJS_GetOptionsJS_GetOwnPropertyDescriptorJS_GetParentJS_GetParentRuntimeJS_GetPendingExceptionJS_GetPositiveInfinityValueJS_GetPrivateJS_GetPropertyJS_GetPropertyAttributesJS_GetPropertyAttrsGetterAndSetterJS_GetPropertyDefaultJS_GetPropertyDescriptorJS_GetPrototypeJS_GetRegExpFlagsJS_GetRegExpSourceJS_GetReservedSlotJS_GetRuntimeJS_GetRuntimePrivateJS_GetScopeChainJS_GetSecurityCallbacksJS_GetStringBytesJS_GetStringCharAtJS_GetStringCharsJS_GetStringCharsAndLengthJS_GetStringEncodingLengthJS_GetStringLengthJS_GetTwoByteExternalStringCharsJS_GetTypeNameJS_GetVersionJS_HasArrayLengthJS_HasElementJS_HasInstanceJS_HasOwnPropertyJS_HasPropertyJS_IdArrayGetJS_IdArrayLengthJS_IdToProtoKeyJS_IdToValueJS_InitJS_InitCTypesClassJS_InitClassJS_InitStandardClassesJS_InstanceOfJS_InternJSStringJS_InternStringJS_IsArrayObjectJS_IsAssigningJS_IsBuiltinEvalFunctionJS_IsBuiltinFunctionConstructorJS_IsConstructingJS_IsConstructing_PossiblyWithGivenThisObjectJS_IsConstructorJS_IsExceptionPendingJS_IsExtensibleJS_IsExternalStringJS_IsGlobalObjectJS_IsIdentifierJS_IsNativeJS_IsNativeFunctionJS_IsRunningJS_IsStopIterationJS_IterateCompartmentsJS_LeaveCompartmentJS_LeaveCrossCompartmentCallJS_LeaveLocalRootScopeJS_LeaveLocalRootScopeWithResultJS_LinkConstructorAndPrototypeJS_LockJS_LockGCThingJS_LookupElementJS_LookupPropertyJS_LooselyEqualJS_MakeStringImmutableJS_MapGCRootsJS_MaybeGCJS_NewJS_NewArrayObjectJS_NewCompartmentAndGlobalObjectJS_NewContextJS_NewDateObjectJS_NewDateObjectMsecJS_NewDependentStringJS_NewDoubleJS_NewDoubleValueJS_NewExternalStringJS_NewFunctionJS_NewGlobalObjectJS_NewNumberValueJS_NewObjectJS_NewObjectForConstructorJS_NewPlainObjectJS_NewPropertyIteratorJS_NewRegExpObjectJS_NewRuntimeJS_NewScriptObjectJS_NewStringCopyNJS_NewStringCopyZJS_NewUCStringJS_NextPropertyJS_NowJS_NumberValueJS_ObjectIsDateJS_ObjectIsFunctionJS_ObjectIsRegExpJS_PSGSJS_ParseJSONJS_PopArgumentsJS_PreventExtensionsJS_PropertyStubJS_PushArgumentsJS_PutEscapedStringJS_Remove*RootJS_RemoveExternalStringFinalizerJS_RemoveRootRTJS_ReportErrorJS_ReportErrorNumberJS_ReportOutOfMemoryJS_ReportPendingExceptionJS_ResolveStandardClassJS_RestoreExceptionStateJS_SET_TRACING_DETAILSJS_SameValueJS_SaveExceptionStateJS_SaveFrameChainJS_ScheduleGCJS_SealObjectJS_SetAllNonReservedSlotsToUndefinedJS_SetArrayLengthJS_SetBranchCallbackJS_SetCallReturnValue2JS_SetCheckObjectAccessCallbackJS_SetCompartmentNameCallbackJS_SetContextCallbackJS_SetDefaultLocaleJS_SetDestroyCompartmentCallbackJS_SetElementJS_SetErrorReporterJS_SetExtraGCRootsJS_SetFunctionCallbackJS_SetGCCallbackJS_SetGCParametersBasedOnAvailableMemoryJS_SetGCZealJS_SetGlobalObjectJS_SetICUMemoryFunctionsJS_SetInterruptCallbackJS_SetNativeStackQuotaJS_SetObjectPrincipalsFinderJS_SetOperationCallbackJS_SetOptionsJS_SetParentJS_SetPendingExceptionJS_SetPrincipalsTranscoderJS_SetPrivateJS_SetPropertyJS_SetPropertyAttributesJS_SetPrototypeJS_SetRegExpInputJS_SetScriptStackQuotaJS_SetThreadStackLimitJS_SetVersionJS_SetVersionForCompartmentJS_ShutDownJS_StrictlyEqualJS_StringEqualsAsciiJS_StringHasBeenInternedJS_StringHasLatin1CharsJS_StringIsFlatJS_StringToVersionJS_SuspendRequestJS_THREADSAFEJS_ThrowStopIterationJS_ToggleOptionsJS_TracerInitJS_TypeOfValueJS_UnlockJS_ValueToBooleanJS_ValueToECMAInt32JS_ValueToFunctionJS_ValueToIdJS_ValueToInt32JS_ValueToNumberJS_ValueToObjectJS_ValueToSourceJS_ValueToStringJS_VersionToStringJS_YieldRequestJS_freeopJS_mallocJS_updateMallocCounterOBJECT_TO_JSVALPRIVATE_TO_JSVALProperty attributesSTRING_TO_JSVALStored valuejscharjsdoublejsidjsintThe 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.
JS_Init Added in SpiderMonkey 31JS_ShutDownJSRuntimeJS_NewRuntimeObsolete since JSAPI 52JS_DestroyRuntimeJS_GetRuntimePrivateJS_SetRuntimePrivateJS_SetNativeStackQuota Added in SpiderMonkey 17JS_ContextIteratorObsolete since JSAPI 52JS_Finish Obsolete since JSAPI 19JSContextJS_NewContextJS_DestroyContextJS_DestroyContextNoGCJS_SetContextCallback
JSContextOpJS_GetRuntimeJS_GetParentRuntime Added in SpiderMonkey 31JS_GetObjectRuntime Added in SpiderMonkey 17JS_GetContextPrivateJS_SetContextPrivateJS_GetSecondContextPrivate Added in SpiderMonkey 17JS_SetSecondContextPrivate Added in SpiderMonkey 17JS_SetInterruptCallback Added in SpiderMonkey 31JS_GetInterruptCallback Added in SpiderMonkey 31JS_RequestInterruptCallback Added in SpiderMonkey 31JS_CheckForInterrupt Added in JSAPI 45JS_DestroyContextMaybeGC Obsolete since JSAPI 14JS_SetBranchCallback Obsolete since JavaScript 1.9.1JS_SetOperationCallback Obsolete since JSAPI 30JS_GetOperationCallback Obsolete since JSAPI 30JS_TriggerOperationCallback Obsolete since JSAPI 30JS_ClearOperationCallback Obsolete since JavaScript 1.9.1JS_GetOperationLimit Obsolete since JavaScript 1.9.1JS_SetOperationLimit Obsolete since JavaScript 1.9.1JS_MAX_OPERATION_LIMIT Obsolete since JavaScript 1.9.1JS_OPERATION_WEIGHT_BASE Obsolete since JavaScript 1.9.1JS_SetThreadStackLimit Obsolete since JSAPI 13JS_SetScriptStackQuota Obsolete since JavaScript 1.8.6JS_SetOptions Obsolete since JSAPI 27JS_GetOptions Obsolete since JSAPI 27JS_ToggleOptions Obsolete since JSAPI 27JSVersion
JS_GetImplementationVersionJS_GetVersionJS_SetVersionForCompartment Added in SpiderMonkey 31JS_StringToVersionJS_VersionToStringJS_SetVersion Obsolete since JSAPI 25JS::CurrentGlobalOrNull Added in SpiderMonkey 31JS_GetGlobalForScopeChain Obsolete since JSAPI 25JS_GetGlobalObject Obsolete since JSAPI 24JS_SetGlobalObject Obsolete since JSAPI 25JS_EnumerateResolvedStandardClasses Obsolete since JSAPI 24JS_IsAssigning Obsolete since JavaScript 1.8.5JS_IsConstructing Obsolete since JSAPI 26JS_IsConstructing_PossiblyWithGivenThisObject Obsolete since JSAPI 17JS_GetScopeChain Obsolete since JavaScript 1.8.7Compartments:
JSAutoCompartment Added in SpiderMonkey 24JS_NewGlobalObject Added in SpiderMonkey 17JS_EnterCompartment Added in SpiderMonkey 24JS_LeaveCompartment Added in SpiderMonkey 24JS_GetCompartmentPrivate Added in SpiderMonkey 1.8.5JS_SetCompartmentPrivate Added in SpiderMonkey 1.8.5JS_GetGlobalForCompartmentOrNull Added in SpiderMonkey 17JS_IterateCompartments Added in SpiderMonkey 17JS_SetDestroyCompartmentCallback Added in SpiderMonkey 17JS_SetCompartmentNameCallback Added in SpiderMonkey 17JS_NewCompartmentAndGlobalObject Added in SpiderMonkey 1.8.1 Obsolete since JSAPI 16JS_EnterCrossCompartmentCall Added in SpiderMonkey 1.8.1 Obsolete since JSAPI 18JS_LeaveCrossCompartmentCall Added in SpiderMonkey 1.8.1 Obsolete since JSAPI 18Locale callbacks:
Locale callback types:
Just running some JavaScript code is straightforward:
JS::CompileOptions Added in SpiderMonkey 17JS::OwningCompileOptions Added in SpiderMonkey 31JS::ReadonlyCompileOptions Added in SpiderMonkey 31JS::SourceBufferHolder Added in SpiderMonkey 31JS::Evaluate Added in SpiderMonkey 17JS_EvaluateScript Obsolete since JSAPI 36JS_EvaluateUCScript Obsolete since JSAPI 36JS_EvaluateScriptForPrincipals Obsolete since JSAPI 30JS_EvaluateUCScriptForPrincipals Obsolete since JSAPI 30JS_EvaluateScriptForPrincipalsVersion Obsolete since JSAPI 30JS_EvaluateUCScriptForPrincipalsVersion Obsolete since JSAPI 30You can instead compile JavaScript code into a JSScript which you can then execute multiple times.
JSScriptJS::Compile Added in SpiderMonkey 17JS::CompileOffThread Added in SpiderMonkey 31JS::CanCompileOffThread Added in SpiderMonkey 31JS::FinishOffThreadScript Added in SpiderMonkey 31JS_CompileScriptJS_CompileUCScriptJS_BufferIsCompilableUnitJS_ExecuteScriptJS::CloneAndExecuteScript Added in SpiderMonkey 31JS_DecompileScriptJS_ExecuteScriptVersion Obsolete since JSAPI 36JS_CompileUTF8File Added in SpiderMonkey 11 Obsolete since JSAPI 19JS_CompileUTF8FileHandle Added in SpiderMonkey 11 Obsolete since JSAPI 19JS_CompileUTF8FileHandleForPrincipals Added in SpiderMonkey 11 Obsolete since JSAPI 19JS_CompileFile Obsolete since JSAPI 11JS_CompileFileHandle Obsolete since JSAPI 11JS_CompileFileHandleForPrincipals Obsolete since JSAPI 11JS_CompileScriptForPrincipals Obsolete since JSAPI 28JS_CompileUCScriptForPrincipals Obsolete since JSAPI 28JS_CompileScriptForPrincipalsVersion Obsolete since JSAPI 19JS_CompileUCScriptForPrincipalsVersion Obsolete since JSAPI 19JS_GetScriptObject Obsolete since JSAPI 8JS_NewScriptObject Obsolete since JSAPI 8JS_ExecuteScriptPart Obsolete since JavaScript 1.9.3JS_DestroyScript Obsolete since JSAPI 8You can also compile JavaScript code into a function:
JSFunctionJS::CompileFunction Added in SpiderMonkey 17JS_DecompileFunctionJS_DecompileFunctionBodyJS_CompileFunction Obsolete since JSAPI 36JS_CompileFunctionForPrincipals Obsolete since JSAPI 28JS_CompileUCFunction Obsolete since JSAPI 36JS_CompileUCFunctionForPrincipals Obsolete since JSAPI 28JSErrorFormatString Added in SpiderMonkey 17JSErrorReportJS::AutoSaveExceptionState Added in SpiderMonkey 31JSExnType Added in SpiderMonkey 17JS_ReportErrorJS_ReportWarningJS_ReportErrorNumberJS_ReportErrorNumberUCJS_ReportErrorFlagsAndNumberJS_ReportErrorFlagsAndNumberUCJS_ReportErrorNumberUCArray Added in SpiderMonkey 24JS_ReportOutOfMemoryJS_ReportAllocationOverflow Added in SpiderMonkey 1.8JS_GetErrorReporterJS_SetErrorReporterObsolete since JSAPI 52JS_ErrorFromExceptionJS_GetErrorPrototypeJSREPORT_IS_EXCEPTIONJSREPORT_IS_STRICTJSREPORT_IS_WARNINGJSREPORT_IS_STRICT_MODE_ERRORThe following functions allow C/C++ functions to throw and catch JavaScript exceptions:
JS::CreateError Added in SpiderMonkey 38JS_IsExceptionPendingJS_GetPendingExceptionJS_SetPendingExceptionJS_ClearPendingExceptionJS_ThrowStopIteration Added in SpiderMonkey 1.8JS_IsStopIteration Added in SpiderMonkey 31These functions translate errors into exceptions and vice versa:
JS_ThrowReportedError Obsolete since JSAPI 29JS::Value constructors:
JS::NullValue Added in SpiderMonkey 24JS::UndefinedValue Added in SpiderMonkey 24JS::BooleanValue Added in SpiderMonkey 24JS::TrueValue Added in SpiderMonkey 24JS::FalseValue Added in SpiderMonkey 24JS::NumberValue Added in SpiderMonkey 24JS::Int32Value Added in SpiderMonkey 24JS::DoubleValue Added in SpiderMonkey 24JS::Float32Value Added in SpiderMonkey 24JS::StringValue Added in SpiderMonkey 24JS::ObjectValue Added in SpiderMonkey 24JS::ObjectOrNullValue Added in SpiderMonkey 24JS::SymbolValue Added in SpiderMonkey 38JS::Value constants:
JS::NullHandleValue Added in SpiderMonkey 24JS::UndefinedHandleValue Added in SpiderMonkey 24JS::TrueHandleValue Added in SpiderMonkey 38JS::FalseHandleValue Added in SpiderMonkey 38jsval constants:
JSVAL_NULL Obsolete since JSAPI 42JSVAL_VOID Obsolete since JSAPI 42JSVAL_TRUE Obsolete since JSAPI 42JSVAL_FALSE Obsolete since JSAPI 42JSVAL_ZERO Obsolete since JSAPI 42JSVAL_ONE Obsolete since JSAPI 42Function and macros for checking the type of a jsval:
JSTypeJS_TypeOfValueAll of the following are deprecated. See JS::Value for their modern replacements.
JSVAL_IS_NULL Obsolete since JSAPI 32JSVAL_IS_VOID Obsolete since JSAPI 32JSVAL_IS_BOOLEAN Obsolete since JSAPI 32JSVAL_IS_NUMBER Obsolete since JSAPI 32JSVAL_IS_INT Obsolete since JSAPI 32JSVAL_IS_DOUBLE Obsolete since JSAPI 32JSVAL_IS_STRING Obsolete since JSAPI 32JSVAL_IS_OBJECT Obsolete since JSAPI 15JSVAL_IS_PRIMITIVE Obsolete since JSAPI 32JSVAL_IS_GCTHING Obsolete since JSAPI 32High-level type-conversion routines for packing and unpacking function arguments.
JS_ConvertArguments Obsolete since JSAPI 38JS_ConvertArgumentsVA Obsolete since JSAPI 38JS_PushArguments Obsolete since JavaScript 1.8.5JS_PushArgumentsVA Obsolete since JavaScript 1.8.5JS_PopArguments Obsolete since JavaScript 1.8.5JS_AddArgumentFormatter Obsolete since JSAPI 18JS_RemoveArgumentFormatter Obsolete since JSAPI 18The 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::ToBoolean Added in SpiderMonkey 17JS::ToUint16 Added in SpiderMonkey 17JS::ToInt32 Added in SpiderMonkey 17JS::ToUint32 Added in SpiderMonkey 17JS::ToInt64 Added in SpiderMonkey 17JS::ToUint64 Added in SpiderMonkey 17JS::ToNumber Added in SpiderMonkey 17JS::ToString Added in SpiderMonkey 31JS::OrdinaryToPrimitive Added in SpiderMonkey 38JS_ValueToConstructorJS_ValueToFunctionJS_ValueToObjectJS_ValueToSourceJS_ConvertValueJS_ValueToBoolean Obsolete since JSAPI 28JS_ValueToECMAInt32 Obsolete since JSAPI 26JS_ValueToECMAUint32 Obsolete since JSAPI 28JS_ValueToInt32 Obsolete since JSAPI 28JS_ValueToNumber Obsolete since JSAPI 27JS_ValueToString Obsolete since JSAPI 28JS_ValueToUint16 Obsolete since JSAPI 28Fast, 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_JSVAL Obsolete since JSAPI 42DOUBLE_TO_JSVALObsolete since JSAPI 42OBJECT_TO_JSVALObsolete since JSAPI 42STRING_TO_JSVALObsolete since JSAPI 42PRIVATE_TO_JSVALObsolete since JSAPI 42INT_FITS_IN_JSVAL Obsolete since JavaScript 1.8.5JSVAL_TO_BOOLEAN Obsolete since JSAPI 32JSVAL_TO_INT Obsolete since JSAPI 32JSVAL_TO_DOUBLE Obsolete since JSAPI 32JSVAL_TO_OBJECT Obsolete since JSAPI 32JSVAL_TO_STRING Obsolete since JSAPI 32JSVAL_TO_GCTHING Obsolete since JSAPI 32JSVAL_TO_PRIVATE Obsolete since JSAPI 32A function that behaves like typeof:
JS_GetTypeName Obsolete since JSAPI 34And functions that behave like the equality operators:
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_strdupJSFreeOp Added in SpiderMonkey 17JS_freeop Added in SpiderMonkey 17JS_GetDefaultFreeOp Added in SpiderMonkey 17JavaScript objects, strings, and floating-point numbers are garbage collected. These functions provide access to the garbage collector:
JS_GCJS_MaybeGCJS_GetGCParameterJS_SetGCParameterJS_GetGCParameterForThread Added in SpiderMonkey 17JS_SetGCParameterForThread Added in SpiderMonkey 17JS_SetGCParametersBasedOnAvailableMemory Added in SpiderMonkey 31
JSGCParamKeyJS_SetGCCallback
JSGCStatusJS_AddFinalizeCallback Added in SpiderMonkey 38
JSFinalizeStatus Added in SpiderMonkey 17JS_RemoveFinalizeCallback Added in SpiderMonkey 38JS_SetGCZeal Added in SpiderMonkey 1.8JS_ScheduleGC Added in SpiderMonkey 17JS_DumpHeap Added in SpiderMonkey 1.8JS_SetGCCallbackRT Obsolete since JSAPI 13JS_SetFinalizeCallback Added in SpiderMonkey 17 Obsolete since JSAPI 32JS_MarkGCThing Obsolete since JSAPI 5JS_IsAboutToBeFinalized Obsolete since JSAPI 35JS_ClearNewbornRoots Obsolete since JSAPI 5The 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.
JS::Rooted<T> Added in SpiderMonkey 17
JS::RootedObject Added in SpiderMonkey 17JS::RootedFunction Added in SpiderMonkey 17JS::RootedScript Added in SpiderMonkey 17JS::RootedString Added in SpiderMonkey 17JS::RootedSymbol Added in SpiderMonkey 38JS::RootedId Added in SpiderMonkey 17JS::RootedValue Added in SpiderMonkey 17JS::Handle<T> Added in SpiderMonkey 17
JS::HandleFunction Added in SpiderMonkey 17JS::HandleId Added in SpiderMonkey 17JS::HandleObject Added in SpiderMonkey 17JS::HandleScript Added in SpiderMonkey 17JS::HandleString Added in SpiderMonkey 17JS::HandleSymbol Added in SpiderMonkey 38JS::HandleValue Added in SpiderMonkey 17JS::MutableHandle<T> Added in SpiderMonkey 17
JS::MutableHandleFunction Added in SpiderMonkey 17JS::MutableHandleId Added in SpiderMonkey 17JS::MutableHandleObject Added in SpiderMonkey 17JS::MutableHandleScript Added in SpiderMonkey 17JS::MutableHandleString Added in SpiderMonkey 17JS::MutableHandleSymbol Added in SpiderMonkey 38JS::MutableHandleValue Added in SpiderMonkey 17JS::PersistentRooted<T> Added in SpiderMonkey 31
JS::PersistentRootedObject Added in SpiderMonkey 31JS::PersistentRootedFunction Added in SpiderMonkey 31JS::PersistentRootedScript Added in SpiderMonkey 31JS::PersistentRootedString Added in SpiderMonkey 31JS::PersistentRootedSymbol Added in SpiderMonkey 38JS::PersistentRootedId Added in SpiderMonkey 31JS::PersistentRootedValue Added in SpiderMonkey 31JS::AutoValueArray<N> Added in SpiderMonkey 31JS::AutoVectorRooter<T> Added in SpiderMonkey 17
JS::AutoValueVector Added in SpiderMonkey 17JS::AutoIdVector Added in SpiderMonkey 17JS::AutoObjectVector Added in SpiderMonkey 24JS::AutoFunctionVector Added in SpiderMonkey 31JS::AutoScriptVector Added in SpiderMonkey 17JS::HandleValueArray Added in SpiderMonkey 31JS::Add*Root Added in SpiderMonkey 31 Obsolete since JSAPI 38
JS::AddValueRoot Added in SpiderMonkey 31 Obsolete since JSAPI 38JS::AddStringRoot Added in SpiderMonkey 31 Obsolete since JSAPI 38JS::AddObjectRoot Added in SpiderMonkey 31 Obsolete since JSAPI 38JS::AddNamedValueRoot Added in SpiderMonkey 31 Obsolete since JSAPI 38JS::AddNamedValueRootRT Added in SpiderMonkey 31 Obsolete since JSAPI 38JS::AddNamedScriptRoot Added in SpiderMonkey 31 Obsolete since JSAPI 38JS::AddNamedStringRoot Added in SpiderMonkey 31 Obsolete since JSAPI 38JS::AddNamedObjectRoot Added in SpiderMonkey 31 Obsolete since JSAPI 38JS::Remove*Root Added in SpiderMonkey 31 Obsolete since JSAPI 38
JS::RemoveValueRoot Added in SpiderMonkey 31 Obsolete since JSAPI 38JS::RemoveStringRoot Added in SpiderMonkey 31 Obsolete since JSAPI 38JS::RemoveObjectRoot Added in SpiderMonkey 31 Obsolete since JSAPI 38JS::RemoveScriptRoot Added in SpiderMonkey 31 Obsolete since JSAPI 38JS::RemoveValueRootRT Added in SpiderMonkey 31 Obsolete since JSAPI 38JS::RemoveStringRootRT Added in SpiderMonkey 31 Obsolete since JSAPI 38JS::RemoveObjectRootRT Added in SpiderMonkey 31 Obsolete since JSAPI 38JS::RemoveScriptRootRT Added in SpiderMonkey 31 Obsolete since JSAPI 38JS_Add*Root Obsolete since JSAPI 31
JS_AddValueRoot Obsolete since JSAPI 31JS_AddStringRoot Obsolete since JSAPI 31JS_AddObjectRoot Obsolete since JSAPI 31JS_AddGCThingRoot Obsolete since JSAPI 31JS_AddNamedValueRoot Obsolete since JSAPI 31JS_AddNamedStringRoot Obsolete since JSAPI 31JS_AddNamedObjectRoot Obsolete since JSAPI 31JS_AddNamedGCThingRoot Obsolete since JSAPI 31JS_Remove*Root Obsolete since JSAPI 31
JS_RemoveValueRoot Obsolete since JSAPI 31JS_RemoveStringRoot Obsolete since JSAPI 31JS_RemoveObjectRoot Obsolete since JSAPI 31JS_RemoveGCThingRoot Obsolete since JSAPI 31JS_AddRoot Obsolete since JavaScript 1.8.5JS_AddNamedRoot Obsolete since JavaScript 1.8.5JS_AddNamedRootRT Obsolete since JavaScript 1.8.5JS_RemoveRoot Obsolete since JavaScript 1.8.5JS_RemoveRootRT Obsolete since JavaScript 1.8.5JS_MapGCRoots Obsolete since JSAPI 19JSGCMapRootFun Obsolete since JSAPI 19JS_DumpNamedRoots Obsolete since JSAPI 19Local root scopes were another way of protecting objects from the garbage collector. They have been removed in JS 1.8.5, though
JS_EnterLocalRootScope Obsolete since JavaScript 1.8.5JS_LeaveLocalRootScope Obsolete since JavaScript 1.8.5JS_LeaveLocalRootScopeWithResult Obsolete since JavaScript 1.8.5JS_ForgetLocalRoot Obsolete since JavaScript 1.8.5Added 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
JSTracer Added in SpiderMonkey 1.8JS_TraceChildren Added in SpiderMonkey 1.8JS_TraceRuntime Added in SpiderMonkey 1.8JSVAL_IS_TRACEABLE Added in SpiderMonkey 1.8 Obsolete since JSAPI 31JSVAL_TO_TRACEABLE Added in SpiderMonkey 1.8 Obsolete since JSAPI 31JSVAL_TRACE_KIND Added in SpiderMonkey 1.8 Obsolete since JSAPI 31JS_TRACER_INIT Added in SpiderMonkey 1.8 Obsolete since JSAPI 12JS_TracerInit Added in SpiderMonkey 12 Obsolete since JSAPI 31JS_CallTracer Added in SpiderMonkey 1.8 Obsolete since JSAPI 22JS_SET_TRACING_DETAILS Added in SpiderMonkey 1.8 Obsolete since JSAPI 26JS_SET_TRACING_INDEX Added in SpiderMonkey 1.8 Obsolete since JSAPI 26JS_SET_TRACING_NAME Added in SpiderMonkey 1.8 Obsolete since JSAPI 26JS_CALL_TRACER Added in SpiderMonkey 1.8 Obsolete since JSAPI 23JS_CALL_VALUE_TRACER Added in SpiderMonkey 1.8 Obsolete since JSAPI 23JS_CALL_OBJECT_TRACER Added in SpiderMonkey 1.8 Obsolete since JSAPI 23JS_CALL_STRING_TRACER Added in SpiderMonkey 1.8 Obsolete since JSAPI 23JS_CALL_DOUBLE_TRACER Added in SpiderMonkey 1.8 Obsolete since JavaScript 1.8.5JS_PrintTraceThingInfo (DEBUG-only) Added in SpiderMonkey 1.8 Obsolete since JSAPI 16Miscellaneous GC APIs:
JS_updateMallocCounter Added in SpiderMonkey 17JS::SetLargeAllocationFailureCallback Added in SpiderMonkey 31JS::SetOutOfMemoryCallback Added in SpiderMonkey 31JS_EnumerateDiagnosticMemoryRegions Added in SpiderMonkey 17JSVAL_LOCK Obsolete since JSAPI 18JSVAL_UNLOCK Obsolete since JSAPI 18JS_LockGCThing Obsolete since JSAPI 21JS_LockGCThingRT Obsolete since JSAPI 22JS_UnlockGCThing Obsolete since JSAPI 21JS_UnlockGCThingRT Obsolete since JSAPI 22JS_NumberValue Added in SpiderMonkey 17JS_DefineConstDoubles
JSConstDoubleSpecJS_DefineConstIntegers Added in SpiderMonkey 38
JSConstIntegerSpec Added in SpiderMonkey 38JS_GetNaNValueJS_GetNegativeInfinityValueJS_GetPositiveInfinityValueJS_DoubleIsInt32 Added in SpiderMonkey 17JS_DoubleToInt32Added in SpiderMonkey 17 Obsolete since JSAPI 38JS_DoubleToUint32 Added in SpiderMonkey 17 Obsolete since JSAPI 38JS_NewNumberValue Obsolete since JSAPI 17JS_NewDoubleValue Obsolete since JSAPI 17JS_NewDouble Obsolete since JSAPI 17JSStringJSAutoByteString Added in SpiderMonkey 17JS_NewStringCopyNJS_NewStringCopyZJS_NewUCStringJS_NewUCStringCopyNJS_NewUCStringCopyZJS_NewDependentStringJS_GetEmptyStringValueJS_GetEmptyString Added in SpiderMonkey 1.8.5JS_ConcatStringsJS_CompareStringsJS_StringEqualsAscii Added in SpiderMonkey 1.8.5JS_FlatStringEqualsAscii Added in SpiderMonkey 1.8.5JS_StringHasLatin1Chars Added in SpiderMonkey 38JS_GetStringCharAt Added in SpiderMonkey 38JS_GetFlatStringCharAt Added in SpiderMonkey 38JS_GetStringLengthJS_EncodeString Added in SpiderMonkey 1.8JS_EncodeStringToUTF8 Added in SpiderMonkey 24JS_EncodeStringToBuffer Added in SpiderMonkey 1.8.5JS_GetStringEncodingLength Added in SpiderMonkey 1.8.5JS_GetLatin1FlatStringChars Added in SpiderMonkey 38JS_GetTwoByteFlatStringChars Added in SpiderMonkey 38JS_GetLatin1StringCharsAndLength Added in SpiderMonkey 38JS_GetTwoByteStringCharsAndLength Added in SpiderMonkey 38JS::GetDeflatedUTF8StringLength Added in SpiderMonkey 38JS::DeflateStringToUTF8Buffer Added in SpiderMonkey 38JS_FileEscapedString Added in SpiderMonkey 1.8.5JS_PutEscapedString Added in SpiderMonkey 1.8.5JS_PutEscapedFlatString Added in SpiderMonkey 1.8.5JS_FORGET_STRING_FLATNESS Added in SpiderMonkey 1.8.5JS_StringIsFlat Added in SpiderMonkey 38JS_ASSERT_STRING_IS_FLAT Added in SpiderMonkey 1.8.5JS_FlattenString Added in SpiderMonkey 1.8.5jschar Obsolete since JSAPI 35JS_NewString Obsolete since JSAPI 1.8.5JS_NewGrowableString Obsolete since JSAPI 27JS_GetStringBytes Obsolete since JSAPI 1.8.5JS_GetStringBytesZ Obsolete since JSAPI 1.8.5JS_GetStringChars Obsolete since JSAPI 1.8.5JS_GetStringCharsZ Obsolete since JSAPI 33JS_GetStringCharsAndLength Added in JSAPI 1.8.5 Obsolete since JSAPI 33JS_GetStringCharsZ Added in SpiderMonkey 1.8.5 Obsolete since JSAPI 33JS_GetStringCharsZAndLength Added in SpiderMonkey 1.8.5 Obsolete since JSAPI 33JS_GetFlatStringChars Obsolete since JSAPI 33JS_MakeStringImmutable Obsolete since JavaScript 1.8.5JS_EncodeCharacters Obsolete since JSAPI 19JS_CStringsAreUTF8 Obsolete since JSAPI 19JS_SetCStringsAreUTF8 Obsolete since JSAPI 19Interning strings tells the SpiderMonkey engine to reuse existing string objects when possible.
JS_InternStringJS_InternStringNJS_InternUCStringJS_InternUCStringNJS_InternJSString Added in SpiderMonkey 1.8.5JS_StringHasBeenInterned Added in SpiderMonkey 17JS_GetLatin1InternedStringChars Added in SpiderMonkey 38JS_GetTwoByteInternedStringChars Added in SpiderMonkey 38JS_GetInternedStringChars Obsolete since JSAPI 33JS_GetInternedStringCharsAndLength Obsolete since JSAPI 33The 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.
JSStringFinalizer Added in SpiderMonkey 17JS_NewExternalStringJS_IsExternalString Added in SpiderMonkey 17JS_GetTwoByteExternalStringChars Added in SpiderMonkey 38JS_GetExternalStringFinalizer Added in SpiderMonkey 17JS_AddExternalStringFinalizer Obsolete since JSAPI 13JS_RemoveExternalStringFinalizer Obsolete since JSAPI 13JS_GetExternalStringGCType Obsolete since JSAPI 13JS_NewExternalStringWithClosure Added in SpiderMonkey 6 Obsolete since JSAPI 13JS_GetExternalStringClosure Added in SpiderMonkey 6 Obsolete since JSAPI 13JSObjectJS_DefineObjectJS_NewObjectJS_NewPlainObject Added in SpiderMonkey 38JS_NewObjectForConstructor Added in SpiderMonkey 1.8.5JS_NewGlobalObject Added in SpiderMonkey 1.8JS_NewObjectWithGivenProtoJS_New Added in SpiderMonkey 1.8JS_IsGlobalObject Added in JSAPI 24JS_ConstructObject Obsolete since JSAPI 16JS_ConstructObjectWithArguments Obsolete since JSAPI 16JS_GetClassJS_GetObjectPrototype Added in JSAPI 17JS_GetFunctionPrototype Added in SpiderMonkey 17JS_GetArrayPrototype Added in SpiderMonkey 24JS_GetConstructorJS_GetGlobalForObjectJS_GetInstancePrivateJS_GetPrototypeJS_SetPrototypeJS_GetPrivateJS_SetPrivateJS_FreezeObject Added in SpiderMonkey 1.8.5JS_DeepFreezeObject Added in SpiderMonkey 1.8.5JS_IsExtensible Added in SpiderMonkey 1.8.5JS_PreventExtensions Added in SpiderMonkey 45JS_InstanceOfJS_HasInstanceJS_IsNative Added in SpiderMonkey 17JS::ToPrimitiveAdded in SpiderMonkey 45JS::NewFunctionFromSpecAdded in SpiderMonkey 45JS_DefaultValueObsolete since JSAPI 44JS_GET_CLASS Obsolete since JSAPI 13JS_SealObject Obsolete since JavaScript 1.8.5JS_GetParent Obsolete since JSAPI 39JS_SetParent Obsolete since JSAPI 39JSProtoKey Added in SpiderMonkey 24JS_GetClassObjectJS_GetClassPrototypeJS::ProtoKeyToId Added in SpiderMonkey 38JS_IdToProtoKey Added in SpiderMonkey 31JS::IdentifyStandardInstance Added in SpiderMonkey 31JS::IdentifyStandardPrototype Added in SpiderMonkey 31JS::IdentifyStandardInstanceOrPrototype Added in SpiderMonkey 31JS::IdentifyStandardConstructor Added in SpiderMonkey 38JS_NewDateObject Added in SpiderMonkey 1.8.5JS_NewDateObjectMsec Added in SpiderMonkey 1.8.5JS_ObjectIsDate Added in SpiderMonkey 1.8.5JS_ClearDateCaches Added in SpiderMonkey 17JS_NowJS_SetDefaultLocale Added in SpiderMonkey 24JS_ResetDefaultLocale Added in SpiderMonkey 24These functions correspond directly to the ways scripts access object properties:
JS_GetPropertyJS_GetUCPropertyJS_GetPropertyById Added in SpiderMonkey 1.8.1JS_SetPropertyJS_SetUCPropertyJS_SetPropertyById Added in SpiderMonkey 1.8.1JS_HasPropertyJS_HasUCPropertyJS_HasPropertyById Added in SpiderMonkey 1.8.1JS_HasOwnProperty Added in JSAPI 45JS_HasOwnPropertyById Added in JSAPI 45JS_DeletePropertyJS_DeletePropertyById Added in SpiderMonkey 1.8.1JS_DeleteProperty2 Obsolete since JSAPI 39JS_DeleteUCProperty2 Obsolete since JSAPI 39JS_DeletePropertyById2 Added in SpiderMonkey 1.8.1 Obsolete since JSAPI 39The 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.
JSPropertyDescriptor Added in SpiderMonkey 1.8Property attributes
JSPROP_ENUMERATEJSPROP_READONLYJSPROP_PERMANENTJSPROP_PROPOP_ACCESSORS Added in SpiderMonkey 38JSPROP_GETTERJSPROP_SETTERJSPROP_SHAREDJSPROP_INDEXJSPROP_DEFINE_LATE Added in SpiderMonkey 38JSFUN_STUB_GSOPS Added in SpiderMonkey 17JSFUN_CONSTRUCTOR Added in SpiderMonkey 17JSPROP_REDEFINE_NONCONFIGURABLE Added in SpiderMonkey 38JSPROP_RESOLVING Added in SpiderMonkey 45JSPROP_IGNORE_ENUMERATE Added in SpiderMonkey 38JSPROP_IGNORE_READONLY Added in SpiderMonkey 38JSPROP_IGNORE_PERMANENT Added in SpiderMonkey 38JSPROP_IGNORE_VALUE Added in SpiderMonkey 38JS_AlreadyHasOwnElement Added in SpiderMonkey 1.8JS_AlreadyHasOwnProperty Added in SpiderMonkey 1.8JS_AlreadyHasOwnUCProperty Added in SpiderMonkey 1.8JS_AlreadyHasOwnPropertyById Added in SpiderMonkey 1.8.1JS_DefinePropertyJS_DefineUCPropertyJS_DefinePropertyById Added in SpiderMonkey 1.8.1JS_DefinePropertiesJS_EnumerateJS_ForwardGetPropertyTo Added in SpiderMonkey 17JS_ForwardGetElementTo Added in SpiderMonkey 17JS_GetPropertyDescriptor Added in SpiderMonkey 31JS_GetPropertyDescriptorById Added in SpiderMonkey 1.8.1JS_GetOwnPropertyDescriptor Added in SpiderMonkey 31JS_GetOwnPropertyDescriptorById Added in SpiderMonkey 31JS_GetOwnUCPropertyDescriptor Added in SpiderMonkey 45JS_SetAllNonReservedSlotsToUndefined Added in SpiderMonkey 24JS_AliasProperty Obsolete since JSAPI 8JS_ClearScope Obsolete since JSAPI 18JS_ClearNonGlobalObject Added in SpiderMonkey 18 Obsolete since JSAPI 34JS_DefineOwnProperty Added in SpiderMonkey 1.8.5 Obsolete since JSAPI 33JS_DefinePropertyWithTinyId Obsolete since JSAPI 30JS_DefineUCPropertyWithTinyId Obsolete since JSAPI 30JS_GetPropertyDefault Obsolete since JSAPI 26JS_GetPropertyByIdDefault Obsolete since JSAPI 26JS_GetPropertyAttributes Obsolete since JSAPI 26JS_GetUCPropertyAttributes Obsolete since JSAPI 26JS_GetPropertyAttrsGetterAndSetter Obsolete since JSAPI 26JS_GetUCPropertyAttrsGetterAndSetter Obsolete since JSAPI 26JS_GetPropertyAttrsGetterAndSetterById Obsolete since JSAPI 26JS_LookupProperty Obsolete since JSAPI 37JS_LookupUCProperty Obsolete since JSAPI 37JS_LookupPropertyById Obsolete since JSAPI 37JS_LookupElement Obsolete since JSAPI 37JS_LookupPropertyWithFlags Obsolete since JSAPI 31JS_LookupPropertyWithFlagsById Obsolete since JSAPI 31JS_NewPropertyIterator Obsolete since JSAPI 36JS_NextProperty Obsolete since JSAPI 36JS_SetPropertyAttributes Obsolete since JSAPI 26JS_SetUCPropertyAttributes Obsolete since JSAPI 26The following functions behave like JS_GetProperty and JS_GetPropertyById except when operating on E4X XML objects.
JS_GetMethod Obsolete since JSAPI 23JS_GetMethodById Obsolete since JSAPI 23A SpiderMonkey extension allows a native function to return an lvalue—that is, a reference to a property of an object:
JS_SetCallReturnValue2 Obsolete since JavaScript 1.8.5A jsid is an identifier for a property or method of an object.
jsidJS_IdToValueJS_IdToProtoKey Added in SpiderMonkey 31JS_ValueToIdJS_StringToId Added in SpiderMonkey 38JS_IndexToId Added in SpiderMonkey 17JS_CharsToId Added in SpiderMonkey 24JS::ProtoKeyToId Added in SpiderMonkey 38JS_IsIdentifier Added in SpiderMonkey 17JSIdArrayJS::AutoIdArray Added in SpiderMonkey 17JS_IdArrayLength Added in SpiderMonkey 17JS_IdArrayGet Added in SpiderMonkey 17JS_DestroyIdArrayJS_GetObjectId Obsolete since JSAPI 31jsid constants:
JSID_VOIDJSID_VOIDHANDLE Added in SpiderMonkey 31JSID_EMPTYJSID_EMPTYHANDLE Added in SpiderMonkey 31Function for checking and converting the type of a jsid:
JSID_IS_ZEROJSID_IS_VOIDJSID_IS_EMPTYJSID_IS_STRINGJSID_TO_STRINGINTERNED_STRING_TO_JSID Added in SpiderMonkey 38JSID_TO_FLAT_STRING Added in SpiderMonkey 17JSID_IS_INTJSID_TO_INTINT_FITS_IN_JSIDINT_TO_JSIDJSID_IS_SYMBOL Added in SpiderMonkey 38JSID_TO_SYMBOL Added in SpiderMonkey 38SYMBOL_TO_JSID Added in SpiderMonkey 38JSID_IS_GCTHINGJSID_TO_GCTHINGJSID_IS_OBJECT Obsolete since JSAPI 33JSID_IS_DEFAULT_XML_NAMESPACE Obsolete since JSAPI 21These API features are used to define custom classes—object types that are implemented in C/C++ code but accessible from JavaScript.
JSClass
JSFunctionSpecJSPropertySpecJS_InitClassJS_LinkConstructorAndPrototype Added in SpiderMonkey 17JS::PropertySpecNameIsSymbol Added in SpiderMonkey 38JS::PropertySpecNameEqualsId Added in SpiderMonkey 38JS::PropertySpecNameToPermanentId Added in SpiderMonkey 38JS_GetReservedSlotJS_SetReservedSlotJSExtendedClass Obsolete since JavaScript 1.8.5JSObjectOps Obsolete since JavaScript 1.8.5JSXMLObjectOps Obsolete since JavaScript 1.8.5JSProperty Obsolete since JSAPI 16Adding native properties and methods to classes:
JSNativeJSFunctionSpecJS_FS Added in SpiderMonkey 1.8JS_FN Added in SpiderMonkey 1.8JS_SYM_FN Added in SpiderMonkey 38JS_FNINFO Added in SpiderMonkey 17JS_SELF_HOSTED_FN Added in SpiderMonkey 31JS_SELF_HOSTED_SYM_FN Added in SpiderMonkey 38JS_SYM_FNSPEC Added in SpiderMonkey 38JS_FNSPEC Added in SpiderMonkey 31JS_FS_END Added in SpiderMonkey 1.8JSPropertySpecJS_PSG Added in SpiderMonkey 17JS_PSGS Added in SpiderMonkey 17JS_SELF_HOSTED_GET Added in SpiderMonkey 31JS_SELF_HOSTED_GETSET Added in SpiderMonkey 31JS_PS_END Added in SpiderMonkey 17JSFastNative Added in SpiderMonkey 1.8 Obsolete since JavaScript 1.8.5The behavior of a JSClass can be customized using these flags:
JSClass.flags
JSCLASS_HAS_PRIVATEJSCLASS_PRIVATE_IS_NSISUPPORTSJSCLASS_IS_DOMJSCLASS Added in SpiderMonkey 17JSCLASS_IMPLEMENTS_BARRIERS Added in SpiderMonkey 17JSCLASS_EMULATES_UNDEFINED Added in SpiderMonkey 24JSCLASS_HAS_RESERVED_SLOTS(n)JSCLASS_GLOBAL_FLAGSJSCLASS_NEW_ENUMERATE Obsolete since JSAPI 37JSCLASS_NEW_RESOLVE Obsolete since JSAPI 36JSCLASS_SHARE_ALL_PROPERTIES Obsolete since JavaScript 1.8.5JSCLASS_NEW_RESOLVE_GETS_START Obsolete since JSAPI 16JSCLASS_CONSTRUCT_PROTOTYPE Obsolete since JSAPI 11JSCLASS_IS_EXTENDED Obsolete since JSAPI 17JSCLASS_MARK_IS_TRACE Obsolete since JSAPI 5The behavior of a JSClass and its instances can be customized in many ways using callback functions.
JSClass method types:
JSPropertyOpJSStrictPropertyOp Added in SpiderMonkey 1.9.3JSDeletePropertyOp Added in SpiderMonkey 24JSEnumerateOpJSNewEnumerateOpJSResolveOpJSConvertOpJSFinalizeOpJSHasInstanceOpJSTraceOpJSCheckAccessOp ObsoleteJSXDRObjectOp Obsolete since JSAPI 13JSNewResolveOp Obsolete since JSAPI 36JSMarkOp Obsolete since JSAPI 5JSGetObjectOps Obsolete since JavaScript 1.8.5JSReserveSlotsOp Obsolete since JavaScript 1.8.5These stub functions can be used when creating a custom JSClass:
JS_ConvertStub Obsolete since JSAPI 37JS_DeletePropertyStub Obsolete since JSAPI 37JS_EnumerateStub Obsolete since JSAPI 37JS_FinalizeStub Obsolete since JSAPI 15JS_ResolveStub Obsolete since JSAPI 37JSExtendedClass method types:
In JS 1.8.5, JSExtendedClass has made private.
JSIteratorOp Obsolete since JSAPI 26JSEqualityOp Obsolete since JavaScript 1.8.5JSObjectOp Obsolete since JavaScript 1.8.5JSObjectOps method types:
In JS 1.8.5, JSObjectOps has been made private.
JSNewObjectMapOp Obsolete since JavaScript 1.8.5JSObjectMapOp Obsolete since JavaScript 1.8.5JSLookupPropOp Obsolete since JavaScript 1.8.5JSDefinePropOp Obsolete since JavaScript 1.8.5JSPropertyIdOp Obsolete since JavaScript 1.8.5JSAttributesOp Obsolete since JavaScript 1.8.5JSObjectOps.defaultValue Obsolete since JavaScript 1.8.5JSCheckAccessIdOp Obsolete since JavaScript 1.8.5JSObjectOp Obsolete since JavaScript 1.8.5JSPropertyRefOp Obsolete since JavaScript 1.8.5JSSetObjectSlotOp Obsolete since JavaScript 1.8.5JSGetRequiredSlotOp Obsolete since JavaScript 1.8.5JSSetRequiredSlotOp Obsolete since JavaScript 1.8.5JSXMLObjectOps method types:
In JS 1.8.5, JSXMLObjectOps has been made private.
JSGetMethodOp Obsolete since JavaScript 1.8.5JSSetMethodOp Obsolete since JavaScript 1.8.5JSEnumerateValuesOp Obsolete since JavaScript 1.8.5JSConcatenateOp Obsolete since JavaScript 1.8.5JS_HasArrayLength Obsolete since JSAPI 8JS_AliasElement Obsolete since JSAPI 8JS_LookupElement Obsolete since JSAPI 37JS_DeleteElement2 Obsolete since JSAPI 39Calling a function or a method of an object:
JS::CallArgs Added in SpiderMonkey 17JS::CallArgsFromVp Added in SpiderMonkey 17JS::Call Added in SpiderMonkey 17JS::Construct Added in SpiderMonkey 38JS_CallFunctionJS_CallFunctionNameJS_CallFunctionValueJS::IsCallable Added in SpiderMonkey 38JS::IsConstructor Added in SpiderMonkey 38JS_IsNativeFunction Added in SpiderMonkey 17JS_IsConstructor Added in SpiderMonkey 24JS_BindCallable Added in SpiderMonkey 17JS_IsBuiltinEvalFunction Added in SpiderMonkey 17JS_IsBuiltinFunctionConstructor Added in SpiderMonkey 17Function accessors:
JS_ObjectIsFunctionJS_GetFunctionArityJS_GetFunctionIdJS_GetFunctionDisplayId Added in SpiderMonkey 17JS_GetFunctionScript Added in SpiderMonkey 38JS_GetFunctionObjectJS_GetFunctionFlags Obsolete since JSAPI 19JS_GetFunctionName Obsolete since JavaScript 1.8.5Creating functions:
JS::CloneFunctionObject Added in SpiderMonkey 36JS_DefineFunctionJS_DefineUCFunctionJS_DefineFunctionById Added in SpiderMonkey 17JS_DefineFunctions
PropertyDefinitionBehavior Added in SpiderMonkey 38JS_NewFunctionJS::GetSelfHostedFunction Added in JSAPI 31JS::NewFunctionFromSpec Added in JSAPI 45JS_NewFunctionById Added in SpiderMonkey 17 Obsolete since JSAPI 44JS_CloneFunctionObject Obsolete since JSAPI 36JS_NewRegExpObject
JS_NewUCRegExpObjectJS_NewRegExpObjectNoStaticsJS_NewUCRegExpObjectNoStaticsJS_SetRegExpInputJS_ClearRegExpStaticsJS_ObjectIsRegExp Added in SpiderMonkey 17JS_GetRegExpFlags Added in SpiderMonkey 17JS_GetRegExpSource Added in SpiderMonkey 17JS_ExecuteRegExpJS_ExecuteRegExpNoStaticsJS_ClearRegExpRoots Obsolete since JavaScript 1.8.5JSStructuredCloneCallbacksJSPrincipalsJS_SetObjectPrincipalsFinder Obsolete since JavaScript 1.8JS_SetPrincipalsTranscoder Obsolete since JavaScript 1.8JSAccessMode Obsolete since JSAPI 29JS_CheckAccess Obsolete since JSAPI 29JSObjectOps.checkAccess Obsolete since JavaScript 1.8JSClass.checkAccess Obsolete since JSAPI 29JS_SetCheckObjectAccessCallback Obsolete since JavaScript 1.8Added in SpiderMonkey 1.8.1 Security callbacks are set per-runtime.
JSSecurityCallbacksJS_GetSecurityCallbacks Added in SpiderMonkey 13JS_SetSecurityCallbacks Added in SpiderMonkey 13JS_SetContextSecurityCallbacks Obsolete since JSAPI 13JS_GetRuntimeSecurityCallbacks Obsolete since JSAPI 13JS_SetRuntimeSecurityCallbacks Obsolete since JSAPI 13The 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_YieldRequest Obsolete since JSAPI 18JS_SuspendRequest Obsolete since JSAPI 18JS_ResumeRequest Obsolete since JSAPI 18JS_GetContextThread Obsolete since JSAPI 8JS_SetContextThread Obsolete since JSAPI 8JS_ClearContextThread Obsolete since JSAPI 8The following functions are always available, but in non- builds, they do nothing:JS_THREADSAFE
JS_LockRuntime Obsolete since JSAPI 12JS_UnlockRuntime Obsolete since JSAPI 12JS_Lock Obsolete since JSAPI 12JS_Unlock Obsolete since JSAPI 12Native function types:
JSNativeJSFastNative Obsolete since JavaScript 1.8.5Other callback types:
JS::LargeAllocationFailureCallbackJS::SetLargeAllocationFailureCallback Added in SpiderMonkey 31JS::OffThreadCompileCallbackJS::CompileOffThread Added in SpiderMonkey 26JS::SetOutOfMemoryCallbackJS::OutOfMemoryCallback Added in SpiderMonkey 31JSCompartmentNameCallbackJS_SetCompartmentNameCallback Added in SpiderMonkey 17JSContextCallbackJS_SetContextCallbackJSDestroyCompartmentCallbackJS_SetDestroyCompartmentCallback Added in SpiderMonkey 17JSEnumerateDiagnosticMemoryCallbackJS_EnumerateDiagnosticMemoryRegions Added in SpiderMonkey 17JSErrorCallbackJS_ReportErrorNumber and friendsJSErrorReporterJS_SetErrorReporterJSGCCallbackJS_SetGCCallbackJSFinalizeCallback Added in SpiderMonkey 17JS_AddFinalizeCallback Added in SpiderMonkey 38JS_SetFinalizeCallback Added in SpiderMonkey 17 Obsolete since JSAPI 32JSIterateCompartmentCallbackJS_IterateCompartments Added in SpiderMonkey 17JSBranchCallbackJS_SetBranchCallback Obsolete since JavaScript 1.8.1JSArgumentFormatterJS_AddArgumentFormatter Obsolete since JSAPI 18JSFunctionCallbackJS_SetFunctionCallback Obsolete since JSAPI 37JSGCRootMapFunJS_MapGCRoots Obsolete since JSAPI 19JSObjectPrincipalsFinderJS_SetObjectPrincipalsFinder Obsolete since JavaScript 1.8JSPrincipalsTranscoderJS_SetPrincipalsTranscoder Obsolete since JavaScript 1.8JSStringFinalizeOpJS_AddExternalStringFinalizer Obsolete since JSAPI 13JSTraceCallbackJS_TRACER_INIT Obsolete since JSAPI 12JSTraceDataOpJS_SetExtraGCRoots Obsolete since JSAPI 25JSTraceNamePrinterJS_SET_TRACING_DETAILS Obsolete since JSAPI 26See also Classes, above.
JS_DEFAULT_XML_NAMESPACE_ID Obsolete since JSAPI 21JSFUN_BOUND_METHOD Obsolete since JavaScript 1.8.5JSFUN_GETTER Obsolete since JavaScript 1.8.5JSFUN_SETTER Obsolete since JavaScript 1.8.5JSFUN_GLOBAL_PARENT Obsolete since JavaScript 1.8.5JSFUN_HEAVYWEIGHT Obsolete since JSAPI 19JSFUN_LAMBDA Obsolete since JSAPI 19JSAutoRequestJSAutoLocalRootScope Obsolete since JavaScript 1.8.5jsperf.h)JS_SetFunctionCallback Added in SpiderMonkey 1.8.5 Obsolete since JSAPI 37JS_GetFunctionCallback Added in SpiderMonkey 1.8.5 Obsolete since JSAPI 37