Module mozjs_sys::jsapi[][src]

Modules

JS
__gnu_cxx
glue
js
mozilla
std

Structs

JSAddonId
JSAtom
JSAtomState
JSAutoByteString
JSAutoCompartment
JSAutoNullableCompartment
JSAutoRequest
JSAutoStructuredCloneBuffer

RAII sugar for JS_WriteStructuredClone.

JSClass
JSClassOps
JSCompartment
JSConstScalarSpec
JSContext
JSCrossCompartmentCall
JSErrorFormatString
JSErrorReport
JSExceptionState
JSFlatString
JSFreeOp
JSFunction
JSFunctionSpec

To define a native function, set call to a JSNativeWrapper. To define a self-hosted function, set selfHostedName to the name of a function compiled during JSRuntime::initSelfHosting.

JSFunctionSpecWithHelp
JSJitGetterCallArgs

A class, expected to be passed by value, which represents the CallArgs for a JSJitGetterOp.

JSJitMethodCallArgs
JSJitMethodCallArgsTraits
JSJitSetterCallArgs

A class, expected to be passed by value, which represents the CallArgs for a JSJitSetterOp.

JSLinearString
JSLocaleCallbacks

Locale specific string conversion and error message callbacks.

JSNativeWrapper

Wrapper to relace JSNative for JSPropertySpecs and JSFunctionSpecs. This will allow us to pass one JSJitInfo per function with the property/function spec, without additional field overhead.

JSObject
JSObjectMap
JSPrincipals
JSPrincipals__bindgen_vtable
JSPropertyName
JSPropertySpec

Description of a property. JS_DefineProperties and JS_InitClass take arrays of these and define many properties at once. JS_PSG, JS_PSGS and JS_PS_END are helper macros for defining such arrays.

JSPropertySpec_SelfHostedWrapper
JSRuntime
JSScript
JSSecurityCallbacks
JSString
JSStringFinalizer

Finalizes external strings created by JS_NewExternalString.

JSStructuredCloneCallbacks
JSStructuredCloneReader
JSStructuredCloneWriter
JSTracer
JSTypedMethodJitInfo
JSWrapObjectCallbacks
PRCallOnceType
_IO_FILE
_IO_marker
__BindgenBitfieldUnit
__va_list_tag
_bindgen_ty_17
_bindgen_ty_18
jsid
jsval_layout__bindgen_ty_1
nsISupports

Enums

DetachDataDisposition
JSAutoStructuredCloneBuffer__bindgen_ty_1
JSErrNum

Report an exception, which is currently realized as a printf-style format string and its arguments.

JSExnType

Possible exception types. These types are part of a JSErrorFormatString structure. They define which error to throw in case of a runtime error.

JSFinalizeStatus
JSGCInvocationKind

Kinds of js_GC invocation.

JSGCMode
JSGCParamKey
JSGCStatus
JSJitCompilerOption
JSJitInfo_AliasSet

An enum that describes what this getter/setter/method aliases. This determines what things can be hoisted past this call, and if this call is movable what it can be hoisted past.

JSJitInfo_ArgType
JSJitInfo_OpType
JSProtoKey
JSTracer_TracerKindTag
JSType
JSValueShiftedTag
JSValueTag
JSValueType
JSVersion
JSWhyMagic
PromiseRejectionHandlingState
PropertyCopyBehavior
WeakMapTraceKind
_bindgen_ty_16

Constants

JSAutoStructuredCloneBuffer_IgnoreTransferablesIfAny
JSAutoStructuredCloneBuffer_NoTransferables
JSAutoStructuredCloneBuffer_OwnsTransferablesIfAny
JSCLASS_BACKGROUND_FINALIZE
JSCLASS_CACHED_PROTO_SHIFT
JSCLASS_DELAY_METADATA_BUILDER
JSCLASS_EMULATES_UNDEFINED
JSCLASS_GLOBAL_APPLICATION_SLOTS
JSCLASS_HAS_PRIVATE
JSCLASS_HAS_XRAYED_CONSTRUCTOR
JSCLASS_HIGH_FLAGS_SHIFT
JSCLASS_INTERNAL_FLAG2
JSCLASS_INTERNAL_FLAG3
JSCLASS_IS_ANONYMOUS
JSCLASS_IS_DOMJSCLASS
JSCLASS_IS_GLOBAL
JSCLASS_IS_PROXY
JSCLASS_IS_WRAPPED_NATIVE
JSCLASS_PRIVATE_IS_NSISUPPORTS
JSCLASS_RESERVED_SLOTS_SHIFT
JSCLASS_RESERVED_SLOTS_WIDTH
JSCLASS_SKIP_NURSERY_FINALIZE
JSCLASS_USERBIT1
JSCLASS_USERBIT2
JSCLASS_USERBIT3
JSExnType_JSEXN_FIRST
JSFUN_CONSTRUCTOR
JSFUN_FLAGS_MASK
JSFUN_HAS_REST
JSFUN_STUB_GSOPS
JSITER_ENUMERATE
JSITER_FOREACH
JSITER_HIDDEN
JSITER_KEYVALUE
JSITER_OWNONLY
JSITER_SYMBOLS
JSITER_SYMBOLSONLY
JSPROP_ENUMERATE
JSPROP_GETTER
JSPROP_IGNORE_ENUMERATE
JSPROP_IGNORE_PERMANENT
JSPROP_IGNORE_READONLY
JSPROP_IGNORE_VALUE
JSPROP_INTERNAL_USE_BIT
JSPROP_PERMANENT
JSPROP_PROPOP_ACCESSORS
JSPROP_READONLY
JSPROP_REDEFINE_NONCONFIGURABLE
JSPROP_RESOLVING
JSPROP_SETTER
JSPROP_SHARED
JSVersion_JSVERSION_LATEST
JS_BITS_PER_BYTE
JS_BITS_PER_BYTE_LOG2
JS_BITS_PER_WORD
JS_CODEGEN_X64
JS_CPU_X64
JS_DEFAULT_JITREPORT_GRANULARITY
JS_HAS_BLOCK_SCOPE
JS_HAS_CATCH_GUARD
JS_HAS_CONST
JS_HAS_DESTRUCTURING
JS_HAS_EXPONENTIATION
JS_HAS_EXPR_CLOSURES
JS_HAS_FOR_EACH_IN
JS_HAS_FUN_EXPR_STMT
JS_HAS_GENERATORS
JS_HAS_GENERATOR_EXPRS
JS_HAS_NEW_GLOBAL_OBJECT
JS_HAS_OBJ_PROTO_PROP
JS_HAS_OBJ_WATCHPOINT
JS_HAS_STR_HTML_HELPERS
JS_HAS_TOSOURCE
JS_HAS_UNEVAL
JS_HAVE_ENDIAN_H
JS_OLD_GETTER_SETTER_METHODS
JS_POSIX_NSPR
JS_PUNBOX64
JS_SCERR_DUP_TRANSFERABLE
JS_SCERR_RECURSION
JS_SCERR_TRANSFERABLE
JS_SCERR_UNSUPPORTED_TYPE
JS_STACK_GROWTH_DIRECTION
JS_STRUCTURED_CLONE_VERSION
JS_TELEMETRY_ADDON_EXCEPTIONS
JS_TELEMETRY_DEFINE_GETTER_SETTER_THIS_NULL_UNDEFINED
JS_TELEMETRY_DEPRECATED_LANGUAGE_EXTENSIONS_IN_ADDONS
JS_TELEMETRY_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT
JS_TELEMETRY_END
JS_TELEMETRY_GC_ANIMATION_MS
JS_TELEMETRY_GC_BUDGET_MS
JS_TELEMETRY_GC_COMPACT_MS
JS_TELEMETRY_GC_INCREMENTAL_DISABLED
JS_TELEMETRY_GC_IS_COMPARTMENTAL
JS_TELEMETRY_GC_MARK_GRAY_MS
JS_TELEMETRY_GC_MARK_MS
JS_TELEMETRY_GC_MARK_ROOTS_MS
JS_TELEMETRY_GC_MAX_PAUSE_MS
JS_TELEMETRY_GC_MINOR_REASON
JS_TELEMETRY_GC_MINOR_REASON_LONG
JS_TELEMETRY_GC_MINOR_US
JS_TELEMETRY_GC_MMU_50
JS_TELEMETRY_GC_MS
JS_TELEMETRY_GC_NON_INCREMENTAL
JS_TELEMETRY_GC_REASON
JS_TELEMETRY_GC_RESET
JS_TELEMETRY_GC_SCC_SWEEP_MAX_PAUSE_MS
JS_TELEMETRY_GC_SCC_SWEEP_TOTAL_MS
JS_TELEMETRY_GC_SLICE_MS
JS_TELEMETRY_GC_SLOW_PHASE
JS_TELEMETRY_GC_SWEEP_MS
JS_TRACE_LOGGING

Statics

JSID_VOID
JSJitInfo_maxSlotIndex
JSJitMethodCallArgsTraits_offsetOfArgc
JSJitMethodCallArgsTraits_offsetOfArgv

Functions

ExceptionStackOrNull

If the given object is an exception object (or an unwrappable cross-compartment wrapper for one), return the stack for that exception, if any. Will return null if the given object is not an exception object (including if it's null or a security wrapper that can't be unwrapped) or if the exception has no stack.

INTERNED_STRING_TO_JSID

Only JSStrings that have been interned via the JSAPI can be turned into jsids by API clients.

JS_AbortIfWrongThread

A JS runtime always has an "owner thread". The owner thread is set when the runtime is created (to the current thread) and practically all entry points into the JS engine check that a runtime (or anything contained in the runtime: context, compartment, object, etc) is only touched by its owner thread. Embeddings may check this invariant outside the JS engine by calling JS_AbortIfWrongThread (which will abort if not on the owner thread, even for non-debug builds).

JS_AddExtraGCRootsTracer

Register externally maintained GC roots.

JS_AddFinalizeCallback
JS_AddWeakPointerCompartmentCallback
JS_AddWeakPointerZoneGroupCallback
JS_AlreadyHasOwnElement
JS_AlreadyHasOwnProperty
JS_AlreadyHasOwnPropertyById
JS_AlreadyHasOwnUCProperty
JS_ArrayBufferHasData

Return true if the arrayBuffer contains any data. This will return false for ArrayBuffer.prototype and detached ArrayBuffers.

JS_Assert
JS_AtomizeAndPinJSString
JS_AtomizeAndPinString
JS_AtomizeAndPinStringN
JS_AtomizeAndPinUCString
JS_AtomizeAndPinUCStringN
JS_AtomizeString
JS_AtomizeStringN
JS_AtomizeUCString
JS_AtomizeUCStringN
JS_BasicObjectToString
JS_BeginRequest
JS_BufferIsCompilableUnit

Given a buffer, return false if the buffer might become a valid javascript statement with the addition of more lines. Otherwise return true. The intent is to support interactive compilation - accumulate lines in a buffer until JS_BufferIsCompilableUnit is true, then pass it to the compiler.

JS_CallFunction
JS_CallFunctionName

Perform the method call rval = obj[name](args).

JS_CallFunctionValue

Call a function, passing a this-value and arguments. This is the C++ equivalent of rval = Reflect.apply(fun, obj, args).

JS_CallOnce

The first call to JS_CallOnce by any thread in a process will call 'func'. Later calls to JS_CallOnce with the same JSCallOnceType object will be suppressed.

JS_CharsToId

Convert chars into a jsid.

JS_CheckForInterrupt
JS_ClearPendingException
JS_ClearRegExpStatics
JS_ClearStructuredClone
JS_CloneObject
JS_CompareStrings
JS_CompileScript

|script| will always be set. On failure, it will be set to nullptr.

JS_CompileUCScript

|script| will always be set. On failure, it will be set to nullptr.

JS_ConcatStrings

Concatenate two strings, possibly resulting in a rope. See above for thread safety comments.

JS_CopyPropertiesFrom

Copies all own properties from |obj| to |target|. |obj| must be a "native" object (that is to say, normal-ish - not an Array or a Proxy).

JS_CopyPropertyFrom
JS_CopyStringChars
JS_CreateMappedArrayBufferContents

Create memory mapped array buffer contents. Caller must take care of closing fd after calling this function.

JS_DecodeBytes

For JS_DecodeBytes, set *dstlenp to the size of the destination buffer before the call; on return, *dstlenp contains the number of characters actually stored. To determine the necessary destination buffer size, make a sizing call that passes nullptr for dst.

JS_DecodeInterpretedFunction
JS_DecodeScript
JS_DecompileFunction
JS_DecompileScript
JS_DeepFreezeObject

Freeze obj, and all objects it refers to, recursively. This will not recurse through non-extensible objects, on the assumption that those are already deep-frozen.

JS_DefineConstDoubles
JS_DefineConstIntegers
JS_DefineDebuggerObject
JS_DefineElement
JS_DefineElement1
JS_DefineElement2
JS_DefineElement3
JS_DefineElement4
JS_DefineElement5
JS_DefineFunction
JS_DefineFunctionById
JS_DefineFunctions
JS_DefineFunctionsWithHelp
JS_DefineObject

Other property-defining functions

JS_DefineProfilingFunctions

Add various profiling-related functions as properties of the given object. Defined in builtin/Profilers.cpp.

JS_DefineProperties
JS_DefineProperty
JS_DefineProperty1
JS_DefineProperty2
JS_DefineProperty3
JS_DefineProperty4
JS_DefineProperty5
JS_DefinePropertyById

Define a property on obj.

JS_DefinePropertyById1

Define a property on obj, throwing a TypeError if the attempt fails. This is the C++ equivalent of Object.defineProperty(obj, id, desc).

JS_DefinePropertyById2
JS_DefinePropertyById3
JS_DefinePropertyById4
JS_DefinePropertyById5
JS_DefinePropertyById6
JS_DefinePropertyById7
JS_DefineUCFunction
JS_DefineUCProperty
JS_DefineUCProperty1
JS_DefineUCProperty2
JS_DefineUCProperty3
JS_DefineUCProperty4
JS_DefineUCProperty5
JS_DefineUCProperty6
JS_DefineUCProperty7
JS_DeleteElement
JS_DeleteElement1
JS_DeleteProperty
JS_DeleteProperty1
JS_DeletePropertyById

Delete a property. This is the C++ equivalent of result = Reflect.deleteProperty(obj, id).

JS_DeletePropertyById1

Delete a property, ignoring strict failures. This is the C++ equivalent of the JS delete obj[id] in non-strict mode code.

JS_DeleteUCProperty
JS_DestroyRuntime
JS_DetachArrayBuffer

Detach an ArrayBuffer, causing all associated views to no longer refer to the ArrayBuffer's original attached memory.

JS_DoubleIsInt32
JS_DropExceptionState
JS_DropPrincipals
JS_EncodeInterpretedFunction
JS_EncodeScript
JS_EncodeString

A variation on JS_EncodeCharacters where a null terminated string is returned that you are expected to call JS_free on when done.

JS_EncodeStringToBuffer

Encode string into a buffer. The function does not stores an additional zero byte. The function returns (size_t) -1 if the string can not be encoded into bytes with no error reported. Otherwise it returns the number of bytes that are necessary to encode the string. If that exceeds the length parameter, the string will be cut and only length bytes will be written into the buffer.

JS_EncodeStringToUTF8

Same behavior as JS_EncodeString(), but encode into UTF-8 string

JS_EndRequest
JS_EnterCompartment

NB: This API is infallible; a nullptr return value does not indicate error.

JS_EnumerateStandardClasses
JS_ErrorFromException

If the given object is an exception object, the exception will have (or be able to lazily create) an error report struct, and this function will return the address of that struct. Otherwise, it returns nullptr. The lifetime of the error report struct that might be returned is the same as the lifetime of the exception object.

JS_ExecuteRegExp
JS_ExecuteRegExpNoStatics
JS_ExecuteScript

Evaluate a script in the scope of the current global of cx.

JS_ExecuteScript1
JS_ExecuteScript2

As above, but providing an explicit scope chain. scopeChain must not include the global object on it; that's implicit. It needs to contain the other objects that should end up on the script's scope chain.

JS_ExecuteScript3
JS_ExtensibleLexicalScope
JS_FileEscapedString
JS_FindCompilationScope
JS_FireOnNewGlobalObject
JS_FlatStringEqualsAscii
JS_FlattenString
JS_ForwardGetElementTo
JS_ForwardGetPropertyTo

Get the value of the property obj[id], or undefined if no such property exists. This is the C++ equivalent of vp = Reflect.get(obj, id, receiver).

JS_ForwardSetPropertyTo

Perform the same property assignment as Reflect.set(obj, id, v, receiver).

JS_FreezeObject

Freezes an object; see ES5's Object.freeze(obj) method.

JS_GC
JS_GetArrayBufferByteLength

Return the available byte length of an array buffer.

JS_GetArrayBufferData

Return a pointer to the start of the data referenced by a typed array. The data is still owned by the typed array, and should not be modified on another thread. Furthermore, the pointer can become invalid on GC (if the data is small and fits inside the array's GC header), so callers must take care not to hold on across anything that could GC.

JS_GetArrayBufferViewBuffer

Return the ArrayBuffer or SharedArrayBuffer underlying an ArrayBufferView. This may return a detached buffer. |obj| must be an object that would return true for JS_IsArrayBufferViewObject().

JS_GetArrayBufferViewByteLength

More generic name for JS_GetTypedArrayByteLength to cover DataViews as well

JS_GetArrayBufferViewData

Same as above, but for any kind of ArrayBufferView. Prefer the type-specific versions when possible.

JS_GetArrayBufferViewType
JS_GetArrayLength
JS_GetArrayPrototype

Returns the original value of |Array.prototype| from the global object in which |forObj| was created.

JS_GetClass
JS_GetClassObject
JS_GetClassPrototype
JS_GetCompartmentPrincipals
JS_GetCompartmentPrivate
JS_GetConstructor
JS_GetContext

Returns the runtime's JSContext. The plan is to expose a single type to the API, so this function will likely be removed soon.

JS_GetCurrentEmbedderTime

Return the time as computed using the current time function, or a suitable default if one has not been set.

JS_GetCurrentThread
JS_GetCustomIteratorCount
JS_GetDataViewByteLength

Return the byte length of a data view.

JS_GetDataViewByteOffset

Return the byte offset of a data view into its array buffer. |obj| must be a DataView.

JS_GetDataViewData

Return a pointer to the beginning of the data referenced by a DataView.

JS_GetDefaultFreeOp
JS_GetElement
JS_GetEmptyString
JS_GetEmptyStringValue
JS_GetErrorPrototype

Returns the original value of |Error.prototype| from the global object of the current compartment of cx.

JS_GetExternalStringFinalizer

Return the 'fin' arg passed to JS_NewExternalString.

JS_GetFlatStringCharAt
JS_GetFloat32ArrayData
JS_GetFloat64ArrayData
JS_GetFunctionArity
JS_GetFunctionDisplayId

Return a function's display name. This is the defined name if one was given where the function was defined, or it could be an inferred name by the JS engine in the case that the function was defined to be anonymous. This can still return nullptr if a useful display name could not be inferred. The same restrictions on rooting as those in JS_GetFunctionId apply.

JS_GetFunctionId

Return the function's identifier as a JSString, or null if fun is unnamed. The returned string lives as long as fun, so you don't need to root a saved reference to it if fun is well-connected or rooted, and provided you bound the use of the saved reference by fun's lifetime.

JS_GetFunctionObject
JS_GetFunctionPrototype

Returns the original value of |Function.prototype| from the global object in which |forObj| was created.

JS_GetFunctionScript
JS_GetGCParameter
JS_GetGlobalForCompartmentOrNull

May return nullptr, if |c| never had a global (e.g. the atoms compartment), or if |c|'s global has been collected.

JS_GetGlobalForObject
JS_GetGlobalFromScript
JS_GetGlobalJitCompilerOption
JS_GetImplementationVersion
JS_GetInstancePrivate
JS_GetInt16ArrayData
JS_GetInt32ArrayData
JS_GetInt8ArrayData
JS_GetInterruptCallback
JS_GetIsSecureContext
JS_GetIteratorPrototype

Returns the %IteratorPrototype% object that all built-in iterator prototype chains go through for the global object of the current compartment of cx.

JS_GetLatin1FlatStringChars
JS_GetLatin1StringCharsAndLength
JS_GetLocaleCallbacks

Return the address of the current locale callbacks struct, which may be nullptr.

JS_GetNaNValue

Don't want to export data, so provide accessors for non-inline Values.

JS_GetNegativeInfinityValue
JS_GetObjectAsArrayBuffer
JS_GetObjectAsArrayBufferView
JS_GetObjectAsFloat32Array
JS_GetObjectAsFloat64Array
JS_GetObjectAsInt16Array
JS_GetObjectAsInt32Array
JS_GetObjectAsInt8Array
JS_GetObjectAsUint16Array
JS_GetObjectAsUint32Array
JS_GetObjectAsUint8Array
JS_GetObjectAsUint8ClampedArray
JS_GetObjectFunction
JS_GetObjectPrototype

Returns the original value of |Object.prototype| from the global object in which |forObj| was created.

JS_GetObjectRuntime
JS_GetOwnPropertyDescriptor
JS_GetOwnPropertyDescriptorById

Get a description of one of obj's own properties. If no such property exists on obj, return true with desc.object() set to null.

JS_GetOwnUCPropertyDescriptor
JS_GetParentRuntime
JS_GetPendingException
JS_GetPositiveInfinityValue
JS_GetPrivate
JS_GetProperty
JS_GetPropertyById

Get the value of the property obj[id], or undefined if no such property exists. The result is stored in vp.

JS_GetPropertyDescriptor
JS_GetPropertyDescriptorById

Like JS_GetOwnPropertyDescriptorById, but also searches the prototype chain if no own property is found directly on obj. The object on which the property is found is returned in desc.object(). If the property is not found on the prototype chain, this returns true with desc.object() set to null.

JS_GetPrototype

Get the prototype of obj, storing it in result.

JS_GetPrototypeIfOrdinary

If |obj| (underneath any functionally-transparent wrapper proxies) has as its [[GetPrototypeOf]] trap the ordinary [[GetPrototypeOf]] behavior defined for ordinary objects, set |*isOrdinary = true| and store |obj|'s prototype in |result|. Otherwise set |*isOrdinary = false|. In case of error, both outparams have unspecified value.

JS_GetRegExpFlags
JS_GetRegExpSource
JS_GetReservedSlot
JS_GetRuntime
JS_GetRuntimePrivate
JS_GetScriptBaseLineNumber
JS_GetScriptFilename
JS_GetScriptPrincipals
JS_GetSecurityCallbacks
JS_GetSharedArrayBufferByteLength
JS_GetSharedArrayBufferData
JS_GetSharedArrayBufferViewType
JS_GetStringCharAt
JS_GetStringEncodingLength

Get number of bytes in the string encoding (without accounting for a terminating zero bytes. The function returns (size_t) -1 if the string can not be encoded into bytes and reports an error using cx accordingly.

JS_GetStringLength
JS_GetTraceThingInfo
JS_GetTwoByteExternalStringChars
JS_GetTwoByteFlatStringChars
JS_GetTwoByteStringCharsAndLength
JS_GetTypedArrayByteLength

Return the byte length of a typed array.

JS_GetTypedArrayByteOffset

Return the byte offset from the start of an array buffer to the start of a typed array view.

JS_GetTypedArrayLength

Return the number of elements in a typed array.

JS_GetTypedArraySharedness

Return the isShared flag of a typed array, which denotes whether the underlying buffer is a SharedArrayBuffer.

JS_GetUCProperty
JS_GetUint16ArrayData
JS_GetUint32ArrayData
JS_GetUint8ArrayData
JS_GetUint8ClampedArrayData
JS_GetVersion
JS_GetZoneUserData
JS_GlobalLexicalScope
JS_GlobalObjectTraceHook

Spidermonkey does not have a good way of keeping track of what compartments should be marked on their own. We can mark the roots unconditionally, but marking GC things only relevant in live compartments is hard. To mitigate this, we create a static trace hook, installed on each global object, from which we can be sure the compartment is relevant, and mark it.

JS_HasElement
JS_HasExtensibleLexicalScope
JS_HasInstance
JS_HasOwnProperty
JS_HasOwnPropertyById

Determine whether obj has an own property with the key id.

JS_HasProperty
JS_HasPropertyById

Compute the expression id in obj.

JS_HasUCProperty
JS_HoldPrincipals
JS_IdToProtoKey
JS_IdToValue
JS_ImmutablePrototypesEnabled
JS_IndexToId

Convert a uint32_t index into a jsid.

JS_Init

Initialize SpiderMonkey, returning true only if initialization succeeded. Once this method has succeeded, it is safe to call JS_NewRuntime and other JSAPI methods.

JS_InitClass
JS_InitDestroyPrincipalsCallback
JS_InitReadPrincipalsCallback
JS_InitReflectParse

Add 'Reflect.parse', a SpiderMonkey extension, to the Reflect object on the given global.

JS_InitStandardClasses

Initialize standard JS class constructors, prototypes, and any top-level functions and constants associated with the standard classes (e.g. isNaN for Number).

JS_InitWithFailureDiagnostic

A variant of JS_Init. On success it returns nullptr. On failure it returns a pointer to a string literal that describes how initialization failed, which can be useful for debugging purposes.

JS_InitializePropertiesFromCompatibleNativeObject

Copy the own properties of src to dst in a fast way. src and dst must both be native and must be in the compartment of cx. They must have the same class, the same parent, and the same prototype. Class reserved slots will NOT be copied.

JS_InstanceOf
JS_IsArrayBufferObject
JS_IsArrayBufferViewObject

Check whether obj supports JS_GetArrayBufferView* APIs. Note that this may return false if a security wrapper is encountered that denies the unwrapping. If this test or one of the more specific tests succeeds, then it is safe to call the various ArrayBufferView accessor JSAPI calls defined below.

JS_IsArrayObject

Returns true and sets |*isArray| indicating whether |value| is an Array object or a wrapper around one, otherwise returns false on failure.

JS_IsArrayObject1

Returns true and sets |*isArray| indicating whether |obj| is an Array object or a wrapper around one, otherwise returns false on failure.

JS_IsBuiltinEvalFunction

True iff fun is the global eval function.

JS_IsBuiltinFunctionConstructor

True iff fun is the Function constructor.

JS_IsConstructor

Return whether the given function is a valid constructor.

JS_IsDataViewObject

Check whether obj supports JS_GetDataView* APIs.

JS_IsDeadWrapper

Determine whether the given object is backed by a DeadObjectProxy.

JS_IsDetachedArrayBufferObject

Check whether the obj is a detached ArrayBufferObject. Note that this may return false if a security wrapper is encountered that denies the unwrapping.

JS_IsExceptionPending
JS_IsExtensible

Determine whether obj is extensible. Extensible objects can have new properties defined on them. Inextensible objects can't, and their [[Prototype]] slot is fixed as well.

JS_IsExternalString

Return whether 'str' was created with JS_NewExternalString or JS_NewExternalStringWithClosure.

JS_IsFloat32Array
JS_IsFloat64Array
JS_IsGlobalObject
JS_IsIdentifier

Test if the given string is a valid ECMAScript identifier

JS_IsIdentifier1

Test whether the given chars + length are a valid ECMAScript identifier. This version is infallible, so just returns whether the chars are an identifier.

JS_IsInt16Array
JS_IsInt32Array
JS_IsInt8Array
JS_IsMappedArrayBufferObject

Check whether the obj is ArrayBufferObject and memory mapped. Note that this may return false if a security wrapper is encountered that denies the unwrapping.

JS_IsNative
JS_IsNativeFunction
JS_IsRunning
JS_IsSharedArrayBufferObject
JS_IsStopIteration
JS_IsTypedArrayObject

Check whether obj supports JS_GetTypedArray* APIs. Note that this may return false if a security wrapper is encountered that denies the unwrapping. If this test or one of the JS_Is*Array tests succeeds, then it is safe to call the various accessor JSAPI calls defined below.

JS_IsUint16Array
JS_IsUint32Array
JS_IsUint8Array
JS_IsUint8ClampedArray
JS_IterateCompartments

This function calls |compartmentCallback| on every compartment. Beware that there is no guarantee that the compartment will survive after the callback returns. Also, barriers are disabled via the TraceSession.

JS_LeaveCompartment
JS_LinkConstructorAndPrototype

Set up ctor.prototype = proto and proto.constructor = ctor with the right property flags.

JS_LooselyEqual
JS_MayResolveStandardClass
JS_MaybeGC
JS_New

Invoke a constructor, like the JS expression new ctor(...args). Returns the new object, or null on error.

JS_NewArrayBuffer

Create a new ArrayBuffer with the given byte length.

JS_NewArrayBufferWithContents

Create a new array buffer with the given contents. It must be legal to pass these contents to free(). On success, the ownership is transferred to the new array buffer.

JS_NewArrayBufferWithExternalContents

Create a new array buffer with the given contents. The array buffer does not take ownership of contents, and JS_DetachArrayBuffer must be called before the contents are disposed of.

JS_NewArrayObject
JS_NewArrayObject1
JS_NewDataView

Create a new DataView using the given ArrayBuffer for storage. The given buffer must be an ArrayBuffer (or a cross-compartment wrapper of an ArrayBuffer), and the offset and length must fit within the bounds of the arrayBuffer. Currently, nullptr will be returned and an exception will be thrown if these conditions do not hold, but do not depend on that behavior.

JS_NewDateObject
JS_NewDependentString

Create a dependent string, i.e., a string that owns no character storage, but that refers to a slice of another string's chars. Dependent strings are mutable by definition, so the thread safety comments above apply.

JS_NewExternalString

Create a new JSString whose chars member refers to external memory, i.e., memory requiring application-specific finalization.

JS_NewFloat32Array
JS_NewFloat32ArrayFromArray
JS_NewFloat32ArrayWithBuffer
JS_NewFloat64Array
JS_NewFloat64ArrayFromArray
JS_NewFloat64ArrayWithBuffer
JS_NewFunction
JS_NewGlobalObject
JS_NewInt16Array
JS_NewInt16ArrayFromArray
JS_NewInt16ArrayWithBuffer
JS_NewInt32Array
JS_NewInt32ArrayFromArray
JS_NewInt32ArrayWithBuffer
JS_NewInt8Array
JS_NewInt8ArrayFromArray
JS_NewInt8ArrayWithBuffer
JS_NewMappedArrayBufferWithContents

Create a new mapped array buffer with the given memory mapped contents. It must be legal to free the contents pointer by unmapping it. On success, ownership is transferred to the new mapped array buffer.

JS_NewObject
JS_NewObjectForConstructor

A constructor can request that the JS engine create a default new 'this' object of the given class, using the callee to determine parentage and [[Prototype]].

JS_NewObjectWithGivenProto

Unlike JS_NewObject, JS_NewObjectWithGivenProto does not compute a default proto. If proto is nullptr, the JS object will have null as [[Prototype]].

JS_NewObjectWithUniqueType
JS_NewObjectWithoutMetadata

Allocate an object in exactly the same way as JS_NewObjectWithGivenProto, but without invoking the metadata callback on it. This allows creation of internal bookkeeping objects that are guaranteed to not have metadata attached to them.

JS_NewPlainObject

Creates a new plain object, like new Object(), with Object.prototype as [[Prototype]].

JS_NewRegExpObject
JS_NewRuntime
JS_NewSharedArrayBuffer

Create a new SharedArrayBuffer with the given byte length. This may only be called if JS::CompartmentCreationOptionsRef(cx).getSharedMemoryAndAtomicsEnabled() is true.

JS_NewStringCopyN
JS_NewStringCopyZ
JS_NewUCRegExpObject
JS_NewUCString
JS_NewUCStringCopyN
JS_NewUCStringCopyZ
JS_NewUint16Array
JS_NewUint16ArrayFromArray
JS_NewUint16ArrayWithBuffer
JS_NewUint32Array
JS_NewUint32ArrayFromArray
JS_NewUint32ArrayWithBuffer
JS_NewUint8Array
JS_NewUint8ArrayFromArray
JS_NewUint8ArrayWithBuffer
JS_NewUint8ClampedArray
JS_NewUint8ClampedArrayFromArray
JS_NewUint8ClampedArrayWithBuffer
JS_NondeterministicGetWeakMapKeys
JS_NondeterministicGetWeakSetKeys
JS_Now

Microseconds since the epoch, midnight, January 1, 1970 UTC.

JS_ObjectCountDynamicSlots
JS_ObjectIsDate

Returns true and sets |*isDate| indicating whether |obj| is a Date object or a wrapper around one, otherwise returns false on failure.

JS_ObjectIsFunction

Infallible predicate to test whether obj is a function object (faster than comparing obj's class name to "Function", but equivalent unless someone has overwritten the "Function" identifier with a different constructor and then created instances using that constructor that might be passed in as obj).

JS_ObjectIsRegExp

Returns true and sets |*isRegExp| indicating whether |obj| is a RegExp object or a wrapper around one, otherwise returns false on failure.

JS_ObjectNotWritten
JS_PCToLineNumber
JS_ParseJSON

JSON.parse as specified by ES5.

JS_ParseJSON1
JS_ParseJSONWithReviver
JS_ParseJSONWithReviver1
JS_PreventExtensions

Attempt to make |obj| non-extensible.

JS_PropertyStub
JS_PutEscapedFlatString
JS_PutEscapedString
JS_ReadBytes
JS_ReadStructuredClone

Note: if the *data contains transferable objects, it can be read only once.

JS_ReadTypedArray
JS_ReadUint32Pair
JS_RefreshCrossCompartmentWrappers
JS_ReleaseMappedArrayBufferContents

Release the allocated resource of mapped array buffer contents before the object is created. If a new object has been created by JS_NewMappedArrayBufferWithContents() with this content, then JS_DetachArrayBuffer() should be used instead to release the resource used by the object.

JS_RemoveExtraGCRootsTracer

Undo a call to JS_AddExtraGCRootsTracer.

JS_RemoveFinalizeCallback
JS_RemoveWeakPointerCompartmentCallback
JS_RemoveWeakPointerZoneGroupCallback
JS_ReportAllocationOverflow

Complain when an allocation size overflows the maximum supported limit.

JS_ReportError

Report an exception represented by the sprintf-like conversion of format and its arguments.

JS_ReportErrorFlagsAndNumber
JS_ReportErrorFlagsAndNumberUC
JS_ReportErrorNumber
JS_ReportErrorNumberUC
JS_ReportErrorNumberUCArray
JS_ReportOutOfMemory

Complain when out of memory.

JS_ReportWarning

As above, but report a warning instead (JSREPORT_IS_WARNING(report.flags)). Return true if there was no error trying to issue the warning, and if the warning was not converted into an error due to the JSOPTION_WERROR option being set, false otherwise.

JS_RequestInterruptCallback
JS_ResetDefaultLocale

Reset the default locale to OS defaults.

JS_ResolveStandardClass

Resolve id, which must contain either a string or an int, to a standard class name in obj if possible, defining the class's constructor and/or prototype and storing true in *resolved. If id does not name a standard class or a top-level property induced by initializing a standard class, store false in *resolved and just return true. Return false on error, as usual for bool result-typed API entry points.

JS_RestoreExceptionState
JS_SameValue
JS_SaveExceptionState
JS_ScriptHasMutedErrors
JS_SetAccumulateTelemetryCallback
JS_SetAllNonReservedSlotsToUndefined

Assign 'undefined' to all of the object's non-reserved slots. Note: this is done for all slots, regardless of the associated property descriptor.

JS_SetArrayLength
JS_SetCompartmentNameCallback
JS_SetCompartmentPrincipals
JS_SetCompartmentPrivate
JS_SetCurrentEmbedderTimeFunction

The embedding can specify a time function that will be used in some situations. The function can return the time however it likes; but the norm is to return times in units of milliseconds since an arbitrary, but consistent, epoch. If the time function is not set, a built-in default will be used.

JS_SetDefaultLocale

The default locale for the ECMAScript Internationalization API (Intl.Collator, Intl.NumberFormat, Intl.DateTimeFormat). Note that the Internationalization API encourages clients to specify their own locales. The locale string remains owned by the caller.

JS_SetDestroyCompartmentCallback
JS_SetDestroyZoneCallback
JS_SetElement
JS_SetElement1
JS_SetElement2
JS_SetElement3
JS_SetElement4
JS_SetElement5
JS_SetFutexCanWait
JS_SetGCCallback
JS_SetGCParameter
JS_SetGCParametersBasedOnAvailableMemory
JS_SetGlobalJitCompilerOption
JS_SetGrayGCRootsTracer
JS_SetICUMemoryFunctions

This function can be used to track memory used by ICU. If it is called, it must be called before JS_Init. Don't use it unless you know what you're doing!

JS_SetImmutablePrototype

Attempt to make the [[Prototype]] of |obj| immutable, such that any attempt to modify it will fail. If an error occurs during the attempt, return false (with a pending exception set, depending upon the nature of the error). If no error occurs, return true with |*succeeded| set to indicate whether the attempt successfully made the [[Prototype]] immutable.

JS_SetInterruptCallback
JS_SetLocaleCallbacks

Establish locale callbacks. The pointer must persist as long as the JSRuntime. Passing nullptr restores the default behaviour.

JS_SetNativeStackQuota

Set the size of the native stack that should not be exceed. To disable stack size checking pass 0.

JS_SetObjectsTenuredCallback
JS_SetOffthreadIonCompilationEnabled
JS_SetParallelParsingEnabled
JS_SetPendingException
JS_SetPrivate
JS_SetProperty
JS_SetPropertyById

Perform the assignment obj[id] = v.

JS_SetProtoCalled
JS_SetPrototype

Change the prototype of obj.

JS_SetRegExpInput
JS_SetReservedSlot
JS_SetRuntimePrivate
JS_SetSecurityCallbacks
JS_SetSizeOfIncludingThisCompartmentCallback
JS_SetSweepZoneCallback
JS_SetTrustedPrincipals
JS_SetUCProperty
JS_SetVersionForCompartment

Mutate the version on the compartment. This is generally discouraged, but necessary to support the version mutation in the js and xpc shell command set.

JS_SetWrapObjectCallbacks
JS_SetZoneUserData
JS_ShutDown

Destroy free-standing resources allocated by SpiderMonkey, not associated with any runtime, context, or other structure.

JS_SplicePrototype
JS_StealArrayBufferContents

Steal the contents of the given array buffer. The array buffer has its length set to 0 and its contents array cleared. The caller takes ownership of the return value and must free it or transfer ownership via JS_NewArrayBufferWithContents when done using it.

JS_StrictPropertyStub
JS_StrictlyEqual
JS_StringEqualsAscii
JS_StringHasBeenPinned
JS_StringHasLatin1Chars

Returns true iff the string's characters are stored as Latin1.

JS_StringIsFlat
JS_StringToId
JS_StringToVersion
JS_Stringify

JSON.stringify as specified by ES5.

JS_StructuredClone
JS_StructuredCloneHasTransferables
JS_THIS
JS_ThrowStopIteration
JS_TraceObjectGroupCycleCollectorChildren
JS_TraceShapeCycleCollectorChildren
JS_TransplantObject
JS_TypeOfValue
JS_UpdateWeakPointerAfterGC
JS_UpdateWeakPointerAfterGCUnbarriered
JS_ValueToConstructor
JS_ValueToFunction
JS_ValueToId
JS_ValueToObject
JS_ValueToSource
JS_VersionToString
JS_WrapObject
JS_WrapPropertyDescriptor
JS_WrapValue
JS_WriteBytes
JS_WriteString
JS_WriteStructuredClone

Note: On success, the caller is responsible for calling JS_ClearStructuredClone(*datap, nbytes, optionalCallbacks, closure).

JS_WriteTypedArray
JS_WriteUint32Pair
JS_free

A wrapper for js_free(p) that may delay js_free(p) invocation as a performance optimization. cx may be nullptr.

JS_freeop

A wrapper for js_free(p) that may delay js_free(p) invocation as a performance optimization as specified by the given JSFreeOp instance.

JS_malloc
JS_realloc
JS_strdup
JS_strdup1

Duplicate a string. Does not report an error on failure.

JS_updateMallocCounter

Type Definitions

FILE
FreeTransferStructuredCloneOp

Called when JS_ClearStructuredClone has to free an unknown transferable object. Note that it should never trigger a garbage collection (and will assert in a debug build if it does.)

JSAccumulateTelemetryDataCallback
JSAddPropertyOp

Add a property named by id to obj.

JSCSPEvalChecker
JSCallOnceType
JSClassInternal
JSCompartmentNameCallback
JSConstDoubleSpec
JSConstIntegerSpec
JSDeletePropertyOp

Delete a property named by id in obj.

JSDestroyCompartmentCallback
JSDestroyPrincipalsOp
JSEnqueuePromiseJobCallback
JSEnumerateOp

The old-style JSClass.enumerate op should define all lazy properties not yet reflected in obj.

JSErrorCallback
JSFinalizeCallback
JSFinalizeOp

Finalize obj, which the garbage collector has determined to be unreachable from other live objects or from GC roots. Obviously, finalizers must never store a reference to obj.

JSFunToStringOp

The type of ObjectOps::funToString. This callback allows an object to provide a custom string to use when Function.prototype.toString is invoked on that object. A null return value means OOM.

JSGCCallback
JSGetterOp

Get a property named by id in obj. Note the jsid id type -- id may be a string (Unicode property identifier) or an int (element index). The *vp out parameter, on success, is the new property value after the action.

JSHasInstanceOp

Check whether v is an instance of obj. Return false on error or exception, true on success with true in *bp if v is an instance of obj, false in *bp otherwise.

JSInitCallback
JSInterruptCallback
JSIterateCompartmentCallback
JSJitGetterOp
JSJitInfo
JSJitMethodCallArgs_Base
JSJitMethodOp
JSJitSetterOp
JSLocaleCompare
JSLocaleToLowerCase
JSLocaleToUnicode
JSLocaleToUpperCase
JSMayResolveOp

A class with a resolve hook can optionally have a mayResolve hook. This hook must have no side effects and must return true for a given id if the resolve hook may resolve this id. This is useful when we're doing a "pure" lookup: if mayResolve returns false, we know we don't have to call the effectful resolve hook.

JSNative
JSNewEnumerateOp

The type of ObjectOps::enumerate. This callback overrides a portion of SpiderMonkey's default [[Enumerate]] internal method. When an ordinary object is enumerated, that object and each object on its prototype chain is tested for an enumerate op, and those ops are called in order. The properties each op adds to the 'properties' vector are added to the set of values the for-in loop will iterate over. All of this is nonstandard.

JSONWriteCallback
JSObjectMovedOp
JSObjectsTenuredCallback
JSPreWrapCallback

Callback used by the wrap hook to ask the embedding to prepare an object for wrapping in a context. This might include unwrapping other wrappers or even finding a more suitable object for the new compartment.

JSProcessPromiseCallback
JSPromiseRejectionTrackerCallback
JSReadPrincipalsOp
JSResolveOp

Resolve a lazy property named by id in obj by defining it directly in obj. Lazy properties are those reflected from some peer native property space (e.g., the DOM attributes for a given node reflected as obj) on demand.

JSSetterOp

Set a property named by id in obj, treating the assignment as strict mode code if strict is true. Note the jsid id type -- id may be a string (Unicode property identifier) or an int (element index). The *vp out parameter, on success, is the new property value after the set.

JSSizeOfIncludingThisCompartmentCallback
JSSubsumesOp
JSTraceDataOp
JSTraceOp

Function type for trace operation of the class called to enumerate all traceable things reachable from obj's private data structure. For each such thing, a trace implementation must call one of the JS_Call*Tracer variants on the thing.

JSWeakPointerCompartmentCallback
JSWeakPointerZoneGroupCallback
JSWeakmapKeyDelegateOp
JSWrapObjectCallback

Callback used to ask the embedding for the cross compartment wrapper handler that implements the desired prolicy for this kind of object in the destination compartment. |obj| is the object to be wrapped. If |existing| is non-nullptr, it will point to an existing wrapper object that should be re-used if possible. |existing| is guaranteed to be a cross-compartment wrapper with a lazily-defined prototype and the correct global. It is guaranteed not to wrap a function.

JSZoneCallback
JS_CurrentEmbedderTimeFunction
JS_ICUAllocFn
JS_ICUFreeFn
JS_ICUReallocFn
ReadStructuredCloneOp

Read structured data from the reader r. This hook is used to read a value previously serialized by a call to the WriteStructuredCloneOp hook.

ReadTransferStructuredCloneOp

This is called when JS_ReadStructuredClone receives a transferable object not known to the engine. If this hook does not exist or returns false, the JS engine calls the reportError op if set, otherwise it throws a DATA_CLONE_ERR DOM Exception. This method is called before any other callback and must return a non-null object in returnObject on success.

StructuredCloneErrorOp

This is called when JS_WriteStructuredClone is given an invalid transferable. To follow HTML5, the application must throw a DATA_CLONE_ERR DOMException with error set to one of the JS_SCERR_* values.

TransferStructuredCloneOp

Called when JS_WriteStructuredClone receives a transferable object not handled by the engine. If this hook does not exist or returns false, the JS engine will call the reportError hook or fall back to throwing a DATA_CLONE_ERR DOM Exception. This method is called before any other callback.

WriteStructuredCloneOp

Structured data serialization hook. The engine can write primitive values, Objects, Arrays, Dates, RegExps, TypedArrays, ArrayBuffers, Sets, Maps, and SharedTypedArrays. Any other type of object requires application support. This callback must first use the JS_WriteUint32Pair API to write an object header, passing a value greater than JS_SCTAG_USER to the tag parameter. Then it can use the JS_Write* APIs to write any other relevant parts of the value v to the writer w. closure is any value passed to the JS_WriteStructuredClone function.

_IO_lock_t
__builtin_va_list
__off64_t
__off_t
jsbytecode
uint_fast8_t
va_list

Unions

jsval_layout
jsval_layout__bindgen_ty_1__bindgen_ty_1