Documentation
¶
Overview ¶
Package engine implements the JavaScript virtual machine: the interpreter and the abstract operations of the language. The values and objects are in the package storage, and the built-in objects are in the package builtin.
Index ¶
- Constants
- func CopyPolled[T any](cx *ExecutionContext, dst, src []T) int
- func ErrorPrototypeIntrinsic(k ErrorKind) storage.Intrinsic
- func GoString(v storage.Value) string
- func IsPromise(v storage.Value) bool
- func NewExecutionContext(hostDefined any) (*ExecutionContext, *Host)
- func PushElements(q quiet.Context, o *storage.Object, vals []storage.Value) (uint32, bool)
- func RegisterIteratorNext(yieldRealm IteratorYieldRealm, step IteratorStepFunc) storage.Native
- func RegisterNative(f NativeFunc) storage.Native
- func RegisterNativeWithKernels(f NativeFunc, k Kernels) storage.Native
- func RegisterPlainIteratorNext[T any](yieldRealm IteratorYieldRealm, receiverError string, ...) storage.Native
- func RevokeProxy(p *storage.Object)
- func ThrownMessage(v storage.Value) string
- func TypedArrayConstructorIntrinsic(t element.Type) storage.Intrinsic
- func TypedArrayPrototypeIntrinsic(t element.Type) storage.Intrinsic
- func WeakMapData(v storage.Value) *storage.WeakTable
- func WeakSetData(v storage.Value) *storage.WeakTable
- type AwaitHandler
- type DisposeCapability
- type DisposeHint
- type ErrorKind
- type ExceptionLocation
- type ExecutionContext
- func (ag ExecutionContext) ActiveNativeState() any
- func (cx *ExecutionContext) AddDisposableResource(dc *DisposeCapability, v storage.Value, hint DisposeHint, ...)
- func (ag ExecutionContext) AgentCanSuspend() bool
- func (cx *ExecutionContext) Append(a, b storage.Value) storage.Value
- func (cx *ExecutionContext) AsyncIteratorClose(it storage.Value, v storage.Value, thrown bool, k AwaitHandler)
- func (ag ExecutionContext) AvailableDefaultLocale() string
- func (cx *ExecutionContext) Await(v storage.Value, k AwaitHandler)
- func (ag ExecutionContext) AwaitJobs() (bool, error)
- func (cx *ExecutionContext) BigIntToString(v storage.Value, radix int) wtf8.String
- func (cx *ExecutionContext) BindModule(u *UnboundModule, hostDefined any) *Module
- func (cx *ExecutionContext) BindScript(u *UnboundScript) *Script
- func (cx *ExecutionContext) BoundFunctionCreate(target *storage.Object, this storage.Value, args []storage.Value) *storage.Object
- func (cx *ExecutionContext) BuiltinTag(o *storage.Object) wtf8.String
- func (cx *ExecutionContext) Call(f *storage.Object, this storage.Value, args ...storage.Value) storage.Value
- func (cx *ExecutionContext) CallCapabilityResolve(c *PromiseCapability, v storage.Value)
- func (cx *ExecutionContext) CallValue(f, this storage.Value, args ...storage.Value) storage.Value
- func (cx *ExecutionContext) CanAccessReceiver(receiver storage.Value) bool
- func (ag ExecutionContext) CapabilityReject(c *PromiseCapability) storage.Value
- func (ag ExecutionContext) CapabilityResolve(c *PromiseCapability) storage.Value
- func (ag ExecutionContext) ClearInterrupt()
- func (cx *ExecutionContext) Completion(f func()) (storage.Value, bool)
- func (cx *ExecutionContext) Concat(a, b storage.Value) storage.Value
- func (cx *ExecutionContext) ConcatStrings(parts []storage.Value) storage.Value
- func (cx *ExecutionContext) Construct(f *storage.Object, args []storage.Value, newTarget *storage.Object) *storage.Object
- func (ag ExecutionContext) ContinuationData() any
- func (cx *ExecutionContext) CreateAsyncFromSyncIterator(it, next storage.Value) (storage.Value, storage.Value)
- func (cx *ExecutionContext) CreateDataProperty(o *storage.Object, k storage.PropKey, val storage.Value) bool
- func (cx *ExecutionContext) CreateDataPropertyOrThrow(o *storage.Object, k storage.PropKey, val storage.Value)
- func (cx *ExecutionContext) CreateDefaultExportSyntheticModule(v storage.Value, hostDefined any) *Module
- func (cx *ExecutionContext) CreateDynamicFunction(kind FunctionKind, args []storage.Value) storage.Value
- func (ag ExecutionContext) CreateRealm(install func(*ExecutionContext)) *ExecutionContext
- func (cx *ExecutionContext) CreateResolvingFunctions(p *storage.Object) *PromiseCapability
- func (cx *ExecutionContext) CreateSyntheticModule(exports []SyntheticExport, hostDefined any) *Module
- func (ag ExecutionContext) DefaultLocale() string
- func (ag ExecutionContext) DefaultTimeZone() datetime.TimeZone
- func (ag ExecutionContext) DeferUnhandledRejections()
- func (cx *ExecutionContext) DefineConstructorPrototype(c *storage.Object, id storage.Intrinsic)
- func (cx *ExecutionContext) DefineOwnProperty(o *storage.Object, k storage.PropKey, d storage.PropDesc) bool
- func (cx *ExecutionContext) DefinePropertyOrThrow(o *storage.Object, k storage.PropKey, d storage.PropDesc)
- func (cx *ExecutionContext) DeleteProp(o *storage.Object, k storage.PropKey) bool
- func (cx *ExecutionContext) DetachGlobalProxy()
- func (ag ExecutionContext) DisplayString(v storage.Value) string
- func (cx *ExecutionContext) DisposeResources(dc *DisposeCapability, v storage.Value, thrown bool, k AwaitHandler)
- func (cx *ExecutionContext) EnterJoin(o *storage.Object) bool
- func (cx *ExecutionContext) EnterLocaleJoin(o *storage.Object) bool
- func (cx *ExecutionContext) EnumerableOwnKeys(o *storage.Object, keys []storage.PropKey) []storage.PropKey
- func (cx *ExecutionContext) EvalInRealm(target *ExecutionContext, src wtf8.String) (storage.Value, bool)
- func (cx *ExecutionContext) ExceptionDescription(v, objectToString, errorToString storage.Value) storage.Value
- func (cx *ExecutionContext) FromPropertyDescriptor(d storage.PropDesc) storage.Value
- func (cx *ExecutionContext) FunctionArguments(f storage.Value) storage.Value
- func (cx *ExecutionContext) FunctionCaller(f storage.Value) storage.Value
- func (cx *ExecutionContext) FunctionContext(f *storage.Object) *ExecutionContext
- func (cx *ExecutionContext) Get(o *storage.Object, k storage.PropKey) storage.Value
- func (cx *ExecutionContext) GetIterator(v storage.Value) (it, next storage.Value)
- func (cx *ExecutionContext) GetIteratorFlattenable(v storage.Value, iterateStrings bool) (it, next storage.Value)
- func (cx *ExecutionContext) GetIteratorFromMethod(v storage.Value, method *storage.Object) (it, next storage.Value)
- func (cx *ExecutionContext) GetMethod(v storage.Value, key *storage.Object) *storage.Object
- func (ag ExecutionContext) GetNewTarget() *storage.Object
- func (cx *ExecutionContext) GetOwnProperty(o *storage.Object, k storage.PropKey) (storage.PropDesc, bool)
- func (cx *ExecutionContext) GetPrototypeFromConstructor(ctor *storage.Object, defaultProto storage.Intrinsic) *storage.Object
- func (cx *ExecutionContext) GetV(v storage.Value, key *storage.Object) storage.Value
- func (cx *ExecutionContext) GetVCached(v storage.Value, k storage.PropKey, c *PropertyCache) storage.Value
- func (cx *ExecutionContext) GetWithReceiver(o *storage.Object, k storage.PropKey, receiver storage.Value) storage.Value
- func (cx *ExecutionContext) GlobalObject() storage.Value
- func (ag ExecutionContext) HasCustomClock() bool
- func (cx *ExecutionContext) HasOwnProperty(o *storage.Object, k storage.PropKey) bool
- func (cx *ExecutionContext) HasProperty(o *storage.Object, k storage.PropKey) bool
- func (cx *ExecutionContext) HostCall(f, this storage.Value, args []storage.Value) (storage.Value, error)
- func (cx *ExecutionContext) HostCallMethod(v, key storage.Value, args []storage.Value) (storage.Value, error)
- func (cx *ExecutionContext) HostConstruct(f storage.Value, args []storage.Value) (storage.Value, error)
- func (cx *ExecutionContext) HostDelete(v, key storage.Value) error
- func (cx *ExecutionContext) HostGet(v, key storage.Value) (storage.Value, error)
- func (cx *ExecutionContext) HostInstanceOf(v, t storage.Value) (storage.Value, error)
- func (cx *ExecutionContext) HostReject(c *PromiseCapability, v storage.Value) error
- func (cx *ExecutionContext) HostResolve(c *PromiseCapability, v storage.Value) error
- func (cx *ExecutionContext) HostSet(v, key, val storage.Value) error
- func (cx *ExecutionContext) IfAbruptCloseIterator(it storage.Value, f func())
- func (cx *ExecutionContext) IfAbruptCloseIterators(its []storage.Value, f func())
- func (cx *ExecutionContext) IfAbruptRejectPromise(c *PromiseCapability, f func()) bool
- func (cx *ExecutionContext) ImportInRealm(specifier wtf8.String) *storage.Object
- func (cx *ExecutionContext) Index(v storage.Value, i uint32) storage.Value
- func (ag ExecutionContext) InitLazyObject(o *storage.Object)
- func (cx *ExecutionContext) InstallGlobalProxy(foreignView *storage.Object, previous *ExecutionContext, shareAccess bool) storage.Value
- func (ag ExecutionContext) Interrupt(cause error)
- func (cx *ExecutionContext) IntlFallbackSymbol() *storage.Object
- func (cx *ExecutionContext) IntrinsicValue(id storage.Intrinsic) storage.Value
- func (cx *ExecutionContext) IsArray(v storage.Value) bool
- func (cx *ExecutionContext) IsConstructor(f *storage.Object) bool
- func (cx *ExecutionContext) IsEnteredRealm() bool
- func (cx *ExecutionContext) IsExtensible(o *storage.Object) bool
- func (cx *ExecutionContext) IsIntrinsicOfOtherRealm(f *storage.Object, id storage.Intrinsic) bool
- func (cx *ExecutionContext) IsRegExpOfCurrentRealm(o *storage.Object) bool
- func (cx *ExecutionContext) Iterate(v storage.Value, f func(storage.Value) bool)
- func (cx *ExecutionContext) IterateFromMethod(v storage.Value, method *storage.Object, f func(storage.Value) bool)
- func (cx *ExecutionContext) IterateRecord(it, next storage.Value, f func(storage.Value) bool)
- func (cx *ExecutionContext) IteratorClose(it storage.Value)
- func (cx *ExecutionContext) IteratorCloseAll(its []storage.Value)
- func (cx *ExecutionContext) IteratorStep(it, next storage.Value) bool
- func (cx *ExecutionContext) IteratorStepValue(it, next storage.Value) (storage.Value, bool)
- func (cx *ExecutionContext) IteratorToList(v storage.Value, method *storage.Object) []storage.Value
- func (ag ExecutionContext) KeyString(k storage.PropKey) wtf8.String
- func (cx *ExecutionContext) KeyValue(k storage.PropKey) storage.Value
- func (cx *ExecutionContext) LeaveJoin()
- func (cx *ExecutionContext) LeaveLocaleJoin()
- func (cx *ExecutionContext) LegacyRegExpInput() storage.Value
- func (cx *ExecutionContext) LegacyRegExpMatch() (s storage.Value, caps []int)
- func (cx *ExecutionContext) LendRegExpLiteralReceivers(f *storage.Object)
- func (cx *ExecutionContext) LendRegExpLiterals(f *storage.Object)
- func (cx *ExecutionContext) LengthOfArrayLike(o *storage.Object) int64
- func (cx *ExecutionContext) MapASCII(s storage.Value, upper bool) (mapped storage.Value, ok bool)
- func (ag ExecutionContext) ModuleSourceClassName(v storage.Value) (name string, ok bool)
- func (cx *ExecutionContext) NewArrayBufferObject(proto *storage.Object, byteLength, maxByteLength int64, shared bool) *storage.Object
- func (cx *ExecutionContext) NewArrayIterator(o *storage.Object, kind quiet.IterationKind) *storage.Object
- func (cx *ExecutionContext) NewArrayIteratorNext() *storage.Object
- func (cx *ExecutionContext) NewArrayOf(elems []storage.Value) storage.Value
- func (cx *ExecutionContext) NewBooleanObject(b bool, proto *storage.Object) *storage.Object
- func (cx *ExecutionContext) NewDateObject(proto *storage.Object, tv float64) *storage.Object
- func (cx *ExecutionContext) NewDisposableStackObject(proto *storage.Object, async bool, state any) *storage.Object
- func (cx *ExecutionContext) NewError(kind ErrorKind, msg string) storage.Value
- func (cx *ExecutionContext) NewErrorObject(proto *storage.Object) *storage.Object
- func (cx *ExecutionContext) NewFinalizationRegistryObject(proto *storage.Object, callback *storage.Object) *storage.Object
- func (cx *ExecutionContext) NewFunction(name string, f NativeFunc) storage.Value
- func (cx *ExecutionContext) NewGoError(err error) storage.Value
- func (cx *ExecutionContext) NewHTMLDDA(f NativeFunc) storage.Value
- func (cx *ExecutionContext) NewInstance(proto *storage.Object) *storage.Object
- func (cx *ExecutionContext) NewIntlObject(proto *storage.Object, data any) *storage.Object
- func (cx *ExecutionContext) NewIteratorObject(proto *storage.Object, state any) *storage.Object
- func (cx *ExecutionContext) NewLazyObject(proto *storage.Object, init func(*ExecutionContext, *storage.Object)) *storage.Object
- func (cx *ExecutionContext) NewModuleSourceObject(proto *storage.Object, className string) *storage.Object
- func (cx *ExecutionContext) NewNative(name wtf8.String, length int, f storage.Native) *storage.Object
- func (cx *ExecutionContext) NewNativeConstructor(name wtf8.String, length int, f storage.Native) *storage.Object
- func (cx *ExecutionContext) NewNativeWithState(name wtf8.String, length int, f storage.Native, state any) *storage.Object
- func (cx *ExecutionContext) NewNumberObject(n float64, proto *storage.Object) *storage.Object
- func (cx *ExecutionContext) NewOrdinaryObject() *storage.Object
- func (cx *ExecutionContext) NewPlainObject() storage.Value
- func (cx *ExecutionContext) NewPromiseCapability(c storage.Value) *PromiseCapability
- func (cx *ExecutionContext) NewPromiseObject(proto *storage.Object) *storage.Object
- func (cx *ExecutionContext) NewRawJSONObject() *storage.Object
- func (cx *ExecutionContext) NewScript(code *bytecode.Func) *Script
- func (cx *ExecutionContext) NewShadowRealmObject(proto *storage.Object, target *ExecutionContext) *storage.Object
- func (cx *ExecutionContext) NewStringBytes(s []byte) storage.Value
- func (cx *ExecutionContext) NewStringObject(s *storage.Object, proto *storage.Object) *storage.Object
- func (cx *ExecutionContext) NewTemporalObject(proto *storage.Object, data any) *storage.Object
- func (cx *ExecutionContext) NewWeakMapObject(proto *storage.Object) *storage.Object
- func (cx *ExecutionContext) NewWeakRefObject(proto *storage.Object, v storage.Value) *storage.Object
- func (cx *ExecutionContext) NewWeakSetObject(proto *storage.Object) *storage.Object
- func (cx *ExecutionContext) NotifyWaiters(b *storage.ArrayBuffer, byteIndex int, count float64) int
- func (ag ExecutionContext) Now() time.Time
- func (cx *ExecutionContext) ObjectTagString(tag wtf8.String) storage.Value
- func (cx *ExecutionContext) OrdinaryHasInstance(c, v storage.Value) bool
- func (cx *ExecutionContext) OrdinaryToPrimitive(o *storage.Object, h Hint) storage.Value
- func (cx *ExecutionContext) OwnKeys(o *storage.Object) []storage.PropKey
- func (cx *ExecutionContext) OwnRegExp(v storage.Value) storage.Value
- func (cx *ExecutionContext) PadShort(s, fill storage.Value, target, need int, atStart bool) (padded storage.Value, ok bool)
- func (cx *ExecutionContext) ParseJSONModule(src string, hostDefined any) (*Module, error)
- func (cx *ExecutionContext) ParseModule(file, src string, hostDefined any) (*Module, error)
- func (cx *ExecutionContext) ParseScript(file string, src wtf8.String) (*Script, error)
- func (cx *ExecutionContext) PerformEval(x storage.Value) storage.Value
- func (cx *ExecutionContext) PerformPromiseThen(p storage.Value, onFulfilled, onRejected storage.Value, c *PromiseCapability) storage.Value
- func (ag ExecutionContext) Poll()
- func (ag ExecutionContext) PollAt(i int64)
- func (ag ExecutionContext) PollStep()
- func (cx *ExecutionContext) PreventExtensions(o *storage.Object) bool
- func (cx *ExecutionContext) PrivateGet(o storage.Value, name *storage.Object) storage.Value
- func (cx *ExecutionContext) PrivateSet(o storage.Value, name *storage.Object, v storage.Value)
- func (cx *ExecutionContext) PromiseResolve(c *storage.Object, x storage.Value) storage.Value
- func (cx *ExecutionContext) ProtoOf(o *storage.Object) *storage.Object
- func (cx *ExecutionContext) ProxyCreate(target, handler storage.Value) *storage.Object
- func (cx *ExecutionContext) QueryKey(v storage.Value) storage.QueryKey
- func (cx *ExecutionContext) QueryOwnProperty(o *storage.Object, k storage.QueryKey) bool
- func (cx *ExecutionContext) QueryProperty(o *storage.Object, k storage.QueryKey) bool
- func (cx *ExecutionContext) QueueMicrotask(callback storage.Value)
- func (cx *ExecutionContext) Quiet() quiet.Context
- func (ag ExecutionContext) RandomNumber() float64
- func (cx *ExecutionContext) RealmHostDefined() any
- func (ag ExecutionContext) RecordStack(e *storage.Object, msg string, newTarget *storage.Object)
- func (cx *ExecutionContext) RegExpAlloc(newTarget *storage.Object) *storage.Object
- func (cx *ExecutionContext) RegExpFlagsString(f regexp.Flags) storage.Value
- func (cx *ExecutionContext) RegExpInitialize(o *storage.Object, pattern, flags storage.Value) *storage.Object
- func (cx *ExecutionContext) RejectCapability(c *PromiseCapability, v storage.Value)
- func (cx *ExecutionContext) RepeatShort(s storage.Value, count int) (repeated storage.Value, ok bool)
- func (cx *ExecutionContext) RequireObjectCoercible(v storage.Value, what string)
- func (cx *ExecutionContext) ResolveCapability(c *PromiseCapability, v storage.Value)
- func (cx *ExecutionContext) ResumeAsyncGenerator(gen storage.Value, mode ResumeMode, v storage.Value) storage.Value
- func (cx *ExecutionContext) ResumeGenerator(gen storage.Value, mode ResumeMode, v storage.Value) (storage.Value, bool)
- func (cx *ExecutionContext) Run(f func())
- func (cx *ExecutionContext) RunJobs() error
- func (ag ExecutionContext) Running() bool
- func (cx *ExecutionContext) Set(o *storage.Object, k storage.PropKey, val storage.Value)
- func (ag ExecutionContext) SetAgentCanSuspend(canSuspend bool)
- func (ag ExecutionContext) SetAvailableDefaultLocale(locale string)
- func (ag ExecutionContext) SetClock(now func() time.Time)
- func (ag ExecutionContext) SetContinuationData(data any)
- func (ag ExecutionContext) SetDefaultLocale(tag string)
- func (ag ExecutionContext) SetDefaultTimeZone(tz datetime.TimeZone)
- func (cx *ExecutionContext) SetExceptionReporter(report func(storage.Value, ExceptionLocation))
- func (ag ExecutionContext) SetExtremum(f *storage.Object, e storage.Extremum)
- func (ag ExecutionContext) SetFrameless(f *storage.Object)
- func (ag ExecutionContext) SetHostGetImportMetaProperties(f HostGetImportMetaPropertiesFunc)
- func (ag ExecutionContext) SetHostLoadImportedModule(f HostLoadImportedModuleFunc)
- func (ag ExecutionContext) SetHostUnhandledRejection(f UnhandledRejectionFunc)
- func (cx *ExecutionContext) SetLegacyRegExpInput(s storage.Value)
- func (cx *ExecutionContext) SetPrototypeOf(o *storage.Object, proto *storage.Object) bool
- func (ag ExecutionContext) SetRandomSource(src rand.Source)
- func (cx *ExecutionContext) SetRealmHostDefined(v any)
- func (cx *ExecutionContext) SetWithReceiver(o *storage.Object, k storage.PropKey, val storage.Value, ...) bool
- func (cx *ExecutionContext) StringFromGo(s string) storage.Value
- func (cx *ExecutionContext) SubstringBetween(s storage.Value, start, end wtf8.Pos) storage.Value
- func (ag ExecutionContext) SystemUTCEpochMilliseconds() float64
- func (ag ExecutionContext) TakeUnhandledRejection() (storage.Value, bool)
- func (ag ExecutionContext) Throw(v storage.Value)
- func (cx *ExecutionContext) ThrowRangeError(msg string)
- func (cx *ExecutionContext) ThrowReferenceError(msg string)
- func (cx *ExecutionContext) ThrowSyntaxError(msg string)
- func (cx *ExecutionContext) ThrowTypeError(msg string)
- func (cx *ExecutionContext) ToBigInt(v storage.Value) storage.Value
- func (cx *ExecutionContext) ToElementValue(t element.Type, v storage.Value) storage.Value
- func (cx *ExecutionContext) ToInt32(v storage.Value) int32
- func (cx *ExecutionContext) ToIntegerOrInfinity(v storage.Value) float64
- func (cx *ExecutionContext) ToNumber(v storage.Value) float64
- func (cx *ExecutionContext) ToNumeric(v storage.Value) storage.Value
- func (cx *ExecutionContext) ToObject(v storage.Value) *storage.Object
- func (cx *ExecutionContext) ToPrimitive(v storage.Value, h Hint) storage.Value
- func (cx *ExecutionContext) ToPropertyDescriptor(v storage.Value) storage.PropDesc
- func (cx *ExecutionContext) ToPropertyKey(v storage.Value) storage.PropKey
- func (cx *ExecutionContext) ToString(v storage.Value) wtf8.String
- func (cx *ExecutionContext) ToStringValue(v storage.Value) storage.Value
- func (cx *ExecutionContext) ToUint32(v storage.Value) uint32
- func (cx *ExecutionContext) ToWellFormed(s storage.Value) storage.Value
- func (cx *ExecutionContext) TransferArrayBuffer(o *storage.Object, proto *storage.Object, newByteLength, maxByteLength int64, ...) *storage.Object
- func (cx *ExecutionContext) TrimString(s storage.Value, start, end bool) storage.Value
- func (cx *ExecutionContext) ValidateShadowRealmObject(o storage.Value) *ExecutionContext
- func (cx *ExecutionContext) Wait(t *storage.TypedArray, i int, v uint64, timeout float64, async bool) (storage.Value, bool)
- type FinalizationRegistry
- type FunctionKind
- type Hint
- type Host
- func (h *Host) ActiveContext() *ExecutionContext
- func (ag *Host) ActiveNativeState() any
- func (ag *Host) AgentCanSuspend() bool
- func (ag *Host) AvailableDefaultLocale() string
- func (ag *Host) AwaitJobs() (bool, error)
- func (ag *Host) CapabilityReject(c *PromiseCapability) storage.Value
- func (ag *Host) CapabilityResolve(c *PromiseCapability) storage.Value
- func (ag *Host) ClearInterrupt()
- func (ag *Host) ContinuationData() any
- func (ag *Host) CreateRealm(install func(*ExecutionContext)) *ExecutionContext
- func (ag *Host) DefaultLocale() string
- func (ag *Host) DefaultTimeZone() datetime.TimeZone
- func (ag *Host) DeferUnhandledRejections()
- func (ag *Host) DisplayString(v storage.Value) string
- func (ag *Host) GetNewTarget() *storage.Object
- func (ag *Host) HasCustomClock() bool
- func (ag *Host) InitLazyObject(o *storage.Object)
- func (ag *Host) Interrupt(cause error)
- func (ag *Host) KeyString(k storage.PropKey) wtf8.String
- func (ag *Host) ModuleSourceClassName(v storage.Value) (name string, ok bool)
- func (ag *Host) Now() time.Time
- func (ag *Host) Poll()
- func (ag *Host) PollAt(i int64)
- func (ag *Host) PollStep()
- func (ag *Host) RandomNumber() float64
- func (ag *Host) RecordStack(e *storage.Object, msg string, newTarget *storage.Object)
- func (ag *Host) Running() bool
- func (ag *Host) SetAgentCanSuspend(canSuspend bool)
- func (ag *Host) SetAvailableDefaultLocale(locale string)
- func (ag *Host) SetClock(now func() time.Time)
- func (ag *Host) SetContinuationData(data any)
- func (ag *Host) SetDefaultLocale(tag string)
- func (ag *Host) SetDefaultTimeZone(tz datetime.TimeZone)
- func (ag *Host) SetExtremum(f *storage.Object, e storage.Extremum)
- func (ag *Host) SetFrameless(f *storage.Object)
- func (ag *Host) SetHostGetImportMetaProperties(f HostGetImportMetaPropertiesFunc)
- func (ag *Host) SetHostLoadImportedModule(f HostLoadImportedModuleFunc)
- func (ag *Host) SetHostUnhandledRejection(f UnhandledRejectionFunc)
- func (ag *Host) SetRandomSource(src rand.Source)
- func (ag *Host) SystemUTCEpochMilliseconds() float64
- func (ag *Host) TakeUnhandledRejection() (storage.Value, bool)
- func (ag *Host) Throw(v storage.Value)
- type HostGetImportMetaPropertiesFunc
- type HostLoadImportedModuleFunc
- type ImportAttribute
- type ImportMetaProperty
- type InterruptedError
- type IteratorPairStepFunc
- type IteratorStepFunc
- type IteratorYieldRealm
- type Kernels
- type MethodKernel0
- type MethodKernel1
- type MethodKernel2
- type Module
- type ModuleRequest
- type NativeFunc
- type NumberKernel1
- type NumberKernel2
- type Pacer
- type PanicError
- type PromiseCapability
- type PromiseState
- type PropertyCache
- type ResumeMode
- type Script
- type ShortcutContract
- type ShortcutFrame
- type ShortcutPace
- type SyntaxError
- type SyntheticExport
- type UnboundModule
- type UnboundScript
- type UnhandledRejectionFunc
Constants ¶
const ( ExtremumNone storage.Extremum = iota ExtremumMin ExtremumMax )
const MaxBigIntBits = numconv.MaxBigIntBits
MaxBigIntBits is the largest number of bits of the magnitude of a BigInt.
const MaxBufferLength = min(1<<32-1, math.MaxInt)
MaxBufferLength is the largest length of an ArrayBuffer in bytes. It keeps every valid integer index of a typed array an array index, and every length an int.
Variables ¶
This section is empty.
Functions ¶
func CopyPolled ¶
func CopyPolled[T any](cx *ExecutionContext, dst, src []T) int
CopyPolled is copy for slices that do not overlap, checking for an interruption while it copies many elements.
func ErrorPrototypeIntrinsic ¶
ErrorPrototypeIntrinsic returns the intrinsic that is the prototype of the native error type k.
func GoString ¶
GoString returns the content of the string v as UTF-8, with lone surrogates replaced by U+FFFD.
func NewExecutionContext ¶
func NewExecutionContext(hostDefined any) (*ExecutionContext, *Host)
NewExecutionContext creates an agent and returns its initial realm's context and host handle. The realm starts without the standard built-ins.
func PushElements ¶
PushElements appends vals to the array o and returns its new length and true. If o requires the generic Array.prototype.push algorithm, it leaves o unchanged and returns 0, false.
func RegisterIteratorNext ¶
func RegisterIteratorNext(yieldRealm IteratorYieldRealm, step IteratorStepFunc) storage.Native
RegisterIteratorNext registers the next method of built-in iterators, which returns the iterator result for what step returns. It must be called only in the initialization of a package.
func RegisterNative ¶
func RegisterNative(f NativeFunc) storage.Native
RegisterNative registers the native function with the code f. It must be called only in the initialization of a package.
func RegisterNativeWithKernels ¶
func RegisterNativeWithKernels(f NativeFunc, k Kernels) storage.Native
RegisterNativeWithKernels is RegisterNative for a function with the kernels k.
func RegisterPlainIteratorNext ¶
func RegisterPlainIteratorNext[T any](yieldRealm IteratorYieldRealm, receiverError string, step func(quiet.Context, *storage.Object, T) (storage.Value, bool), pairStep IteratorPairStepFunc) storage.Native
RegisterPlainIteratorNext registers the next method of the built-in iterators with state T. For a compatible receiver, step must neither throw nor run JavaScript. pairStep is the pair step of the method, for which the same contract holds, or nil. RegisterPlainIteratorNext must be called only in the initialization of a package.
func RevokeProxy ¶
RevokeProxy revokes the proxy p: every internal method of p throws a TypeError from then on.
func ThrownMessage ¶
ThrownMessage describes the thrown value v for a Go error, without running any JavaScript.
func TypedArrayConstructorIntrinsic ¶
TypedArrayConstructorIntrinsic returns the intrinsic constructor for the element type t.
func TypedArrayPrototypeIntrinsic ¶
TypedArrayPrototypeIntrinsic returns the intrinsic prototype for the element type t.
func WeakMapData ¶
WeakMapData returns the [WeakMapData] of the WeakMap object v, or nil when v is not a WeakMap object.
func WeakSetData ¶
WeakSetData returns the [WeakSetData] of the WeakSet object v, or nil when v is not a WeakSet object.
Types ¶
type AwaitHandler ¶
type AwaitHandler func(cx *ExecutionContext, v storage.Value, rejected bool)
AwaitHandler continues a built-in async function after an Await: v is the value of the awaited promise, or its rejection reason when rejected is set.
type DisposeCapability ¶
type DisposeCapability struct {
// contains filtered or unexported fields
}
DisposeCapability is a DisposeCapability Record.
func NewDisposeCapability ¶
func NewDisposeCapability() *DisposeCapability
NewDisposeCapability implements NewDisposeCapability.
type DisposeHint ¶
type DisposeHint uint8
DisposeHint is the hint of a disposable resource.
const ( SyncDispose DisposeHint = iota AsyncDispose )
type ExceptionLocation ¶
ExceptionLocation identifies the throw site. Line and Column are 1-based, Column counts UTF-16 code units, and zero indicates an unknown position.
type ExecutionContext ¶
type ExecutionContext struct {
// contains filtered or unexported fields
}
ExecutionContext binds engine operations to one realm of an agent.
func CreationContext ¶
func CreationContext(o *storage.Object) *ExecutionContext
CreationContext returns the creation realm's context for the JavaScript object o, or nil for a detached global proxy.
func IteratorStateAndContext ¶
func IteratorStateAndContext(v storage.Value) (any, *ExecutionContext)
IteratorStateAndContext returns the state and creation context of a built-in iterator. For other values it returns two nil values.
func (ExecutionContext) ActiveNativeState ¶
func (ag ExecutionContext) ActiveNativeState() any
ActiveNativeState returns the internal slots of the active native function.
func (*ExecutionContext) AddDisposableResource ¶
func (cx *ExecutionContext) AddDisposableResource(dc *DisposeCapability, v storage.Value, hint DisposeHint, method *storage.Object)
AddDisposableResource implements AddDisposableResource. A nil method is not present.
func (ExecutionContext) AgentCanSuspend ¶
func (ag ExecutionContext) AgentCanSuspend() bool
AgentCanSuspend implements AgentCanSuspend.
func (*ExecutionContext) Append ¶ added in v0.2.0
func (cx *ExecutionContext) Append(a, b storage.Value) storage.Value
Append returns the concatenation of the strings a and b for an append to a variable that holds a and receives the result. A result that is a new tail is marked storage.ObjExclusive.
func (*ExecutionContext) AsyncIteratorClose ¶
func (cx *ExecutionContext) AsyncIteratorClose(it storage.Value, v storage.Value, thrown bool, k AwaitHandler)
AsyncIteratorClose implements AsyncIteratorClose for a built-in async function: it closes the iterator it for the completion with the value v, which is a throw completion when thrown is set, and calls k with the resulting completion, now or in a later job.
func (ExecutionContext) AvailableDefaultLocale ¶
func (ag ExecutionContext) AvailableDefaultLocale() string
AvailableDefaultLocale returns the available locale of the default locale, or empty when it is not known.
func (*ExecutionContext) Await ¶
func (cx *ExecutionContext) Await(v storage.Value, k AwaitHandler)
Await implements Await for a built-in async function: k continues the function in a later job with the value that v settles to. An exception that PromiseResolve throws propagates, and k is not called then.
func (ExecutionContext) AwaitJobs ¶
AwaitJobs waits for pending jobs, a waiter notification or a timeout. It returns false if there are no jobs or waiters, or an InterruptedError if interrupted.
func (*ExecutionContext) BigIntToString ¶
BigIntToString implements BigInt::toString. It throws a RangeError when the result would be longer than MaxStringLength.
func (*ExecutionContext) BindModule ¶ added in v0.2.0
func (cx *ExecutionContext) BindModule(u *UnboundModule, hostDefined any) *Module
BindModule creates a fresh module record of u in the current realm.
func (*ExecutionContext) BindScript ¶
func (cx *ExecutionContext) BindScript(u *UnboundScript) *Script
BindScript returns the script of u for the current realm, as ExecutionContext.ParseScript returns it for the source of u.
func (*ExecutionContext) BoundFunctionCreate ¶
func (cx *ExecutionContext) BoundFunctionCreate(target *storage.Object, this storage.Value, args []storage.Value) *storage.Object
BoundFunctionCreate implements BoundFunctionCreate. It copies args.
func (*ExecutionContext) BuiltinTag ¶
func (cx *ExecutionContext) BuiltinTag(o *storage.Object) wtf8.String
BuiltinTag returns the name that Object.prototype.toString uses for o when o has no Symbol.toStringTag property.
func (*ExecutionContext) Call ¶
func (cx *ExecutionContext) Call(f *storage.Object, this storage.Value, args ...storage.Value) storage.Value
Call calls the callable object f.
func (*ExecutionContext) CallCapabilityResolve ¶
func (cx *ExecutionContext) CallCapabilityResolve(c *PromiseCapability, v storage.Value)
CallCapabilityResolve calls the [[Resolve]] function of c with v, as ExecutionContext.ResolveCapability does, and shows the frame of the function where the call can be observed.
func (*ExecutionContext) CallValue ¶
CallValue calls f, which must be callable, or throws a TypeError.
func (*ExecutionContext) CanAccessReceiver ¶
func (cx *ExecutionContext) CanAccessReceiver(receiver storage.Value) bool
CanAccessReceiver reports whether a non-strict host call may use receiver in the current realm.
func (ExecutionContext) CapabilityReject ¶
func (ag ExecutionContext) CapabilityReject(c *PromiseCapability) storage.Value
CapabilityReject returns the [[Reject]] function of c.
func (ExecutionContext) CapabilityResolve ¶
func (ag ExecutionContext) CapabilityResolve(c *PromiseCapability) storage.Value
CapabilityResolve returns the [[Resolve]] function of c.
func (ExecutionContext) ClearInterrupt ¶
func (ag ExecutionContext) ClearInterrupt()
ClearInterrupt withdraws a request of [agent.Interrupt] that no script has observed.
func (*ExecutionContext) Completion ¶
func (cx *ExecutionContext) Completion(f func()) (storage.Value, bool)
Completion runs f and reports whether it completed normally. When it throws, the result is the exception.
func (*ExecutionContext) Concat ¶
func (cx *ExecutionContext) Concat(a, b storage.Value) storage.Value
Concat returns the concatenation of the strings a and b.
func (*ExecutionContext) ConcatStrings ¶
func (cx *ExecutionContext) ConcatStrings(parts []storage.Value) storage.Value
ConcatStrings returns the concatenation of the strings parts.
func (*ExecutionContext) Construct ¶
func (cx *ExecutionContext) Construct(f *storage.Object, args []storage.Value, newTarget *storage.Object) *storage.Object
Construct implements Construct: new f(...args) with the given new.target.
func (ExecutionContext) ContinuationData ¶
func (ag ExecutionContext) ContinuationData() any
ContinuationData returns the continuation data, the value of the host that promise reactions, awaits and FinalizationRegistry objects capture when they are made, and that their jobs run with.
func (*ExecutionContext) CreateAsyncFromSyncIterator ¶
func (cx *ExecutionContext) CreateAsyncFromSyncIterator(it, next storage.Value) (storage.Value, storage.Value)
CreateAsyncFromSyncIterator implements CreateAsyncFromSyncIterator for the iterator it and its next method, and returns the async iterator and its next method.
func (*ExecutionContext) CreateDataProperty ¶
func (cx *ExecutionContext) CreateDataProperty(o *storage.Object, k storage.PropKey, val storage.Value) bool
CreateDataProperty implements CreateDataProperty. It reports false when the definition is refused.
func (*ExecutionContext) CreateDataPropertyOrThrow ¶
func (cx *ExecutionContext) CreateDataPropertyOrThrow(o *storage.Object, k storage.PropKey, val storage.Value)
CreateDataPropertyOrThrow implements CreateDataPropertyOrThrow.
func (*ExecutionContext) CreateDefaultExportSyntheticModule ¶
func (cx *ExecutionContext) CreateDefaultExportSyntheticModule(v storage.Value, hostDefined any) *Module
CreateDefaultExportSyntheticModule returns a synthetic module whose only export is default.
func (*ExecutionContext) CreateDynamicFunction ¶
func (cx *ExecutionContext) CreateDynamicFunction(kind FunctionKind, args []storage.Value) storage.Value
CreateDynamicFunction implements CreateDynamicFunction for the running native constructor. The last of args is the body.
func (ExecutionContext) CreateRealm ¶
func (ag ExecutionContext) CreateRealm(install func(*ExecutionContext)) *ExecutionContext
CreateRealm returns the context of a new realm after calling install with that context active.
func (*ExecutionContext) CreateResolvingFunctions ¶
func (cx *ExecutionContext) CreateResolvingFunctions(p *storage.Object) *PromiseCapability
CreateResolvingFunctions implements CreateResolvingFunctions for the promise p. The result is a capability whose resolving functions are those functions.
func (*ExecutionContext) CreateSyntheticModule ¶ added in v0.2.0
func (cx *ExecutionContext) CreateSyntheticModule(exports []SyntheticExport, hostDefined any) *Module
CreateSyntheticModule returns a synthetic module with the given exports and [[HostDefined]]. The export names must be unique. It may reorder exports.
func (ExecutionContext) DefaultLocale ¶
func (ag ExecutionContext) DefaultLocale() string
DefaultLocale returns the configured default locale, or empty for the host default.
func (ExecutionContext) DefaultTimeZone ¶
DefaultTimeZone returns the time zone of local time. It is the local time zone of the host unless [agent.SetDefaultTimeZone] changed it.
func (ExecutionContext) DeferUnhandledRejections ¶
func (ag ExecutionContext) DeferUnhandledRejections()
DeferUnhandledRejections postpones rejection reports across job checkpoints.
func (*ExecutionContext) DefineConstructorPrototype ¶
func (cx *ExecutionContext) DefineConstructorPrototype(c *storage.Object, id storage.Intrinsic)
DefineConstructorPrototype defines the property prototype of the constructor c, which NewNativeConstructor returned in the current realm, as the intrinsic id, which the property then holds for good.
func (*ExecutionContext) DefineOwnProperty ¶
func (cx *ExecutionContext) DefineOwnProperty(o *storage.Object, k storage.PropKey, d storage.PropDesc) bool
DefineOwnProperty implements [[DefineOwnProperty]]. It reports false when the definition is refused.
func (*ExecutionContext) DefinePropertyOrThrow ¶
func (cx *ExecutionContext) DefinePropertyOrThrow(o *storage.Object, k storage.PropKey, d storage.PropDesc)
DefinePropertyOrThrow implements DefinePropertyOrThrow.
func (*ExecutionContext) DeleteProp ¶
DeleteProp implements [[Delete]]. It reports false when the property is not configurable.
func (*ExecutionContext) DetachGlobalProxy ¶
func (cx *ExecutionContext) DetachGlobalProxy()
DetachGlobalProxy disconnects the current realm's installed global proxy.
func (ExecutionContext) DisplayString ¶
DisplayString describes v for messages, without running any JavaScript. A long string is shortened.
func (*ExecutionContext) DisposeResources ¶
func (cx *ExecutionContext) DisposeResources(dc *DisposeCapability, v storage.Value, thrown bool, k AwaitHandler)
DisposeResources implements DisposeResources for a built-in function, for the completion v, which is a throw completion when thrown is set. k receives the resulting completion, now or, when a disposal awaits, in a later job.
func (*ExecutionContext) EnterJoin ¶
func (cx *ExecutionContext) EnterJoin(o *storage.Object) bool
EnterJoin starts Array.prototype.join of the current realm for o and reports whether it was not running for o. ExecutionContext.LeaveJoin must be called when it reports true.
func (*ExecutionContext) EnterLocaleJoin ¶
func (cx *ExecutionContext) EnterLocaleJoin(o *storage.Object) bool
EnterLocaleJoin is ExecutionContext.EnterJoin for Array.prototype.toLocaleString.
func (*ExecutionContext) EnumerableOwnKeys ¶
func (cx *ExecutionContext) EnumerableOwnKeys(o *storage.Object, keys []storage.PropKey) []storage.PropKey
EnumerableOwnKeys implements EnumerableOwnProperties with the kind key. It appends the keys to keys and returns the extended slice.
func (*ExecutionContext) EvalInRealm ¶
func (cx *ExecutionContext) EvalInRealm(target *ExecutionContext, src wtf8.String) (storage.Value, bool)
EvalInRealm evaluates the script src in the target realm as an indirect eval there would, as code without a ScriptOrModule. It throws a SyntaxError of the current realm when src is not a valid script. It reports false when the evaluation throws, and the result is the exception then.
func (*ExecutionContext) ExceptionDescription ¶
func (cx *ExecutionContext) ExceptionDescription(v, objectToString, errorToString storage.Value) storage.Value
ExceptionDescription describes a thrown Error or proxy without invoking JavaScript. It returns undefined when the host should convert the thrown value to a string. objectToString and errorToString are the reporting realm's original built-in methods.
func (*ExecutionContext) FromPropertyDescriptor ¶
func (cx *ExecutionContext) FromPropertyDescriptor(d storage.PropDesc) storage.Value
FromPropertyDescriptor implements FromPropertyDescriptor for a descriptor that is not undefined.
func (*ExecutionContext) FunctionArguments ¶
func (cx *ExecutionContext) FunctionArguments(f storage.Value) storage.Value
FunctionArguments returns the value of the arguments property of the non-strict ordinary function f: a new arguments object of the innermost running call of f, or null. It throws a TypeError when f is not such a function.
func (*ExecutionContext) FunctionCaller ¶
func (cx *ExecutionContext) FunctionCaller(f storage.Value) storage.Value
FunctionCaller returns the value of the caller property of the non-strict ordinary function f: the function that made the innermost running call of f, or null. It throws a TypeError when f is not such a function.
func (*ExecutionContext) FunctionContext ¶
func (cx *ExecutionContext) FunctionContext(f *storage.Object) *ExecutionContext
FunctionContext returns the context of GetFunctionRealm(f).
func (*ExecutionContext) GetIterator ¶
func (cx *ExecutionContext) GetIterator(v storage.Value) (it, next storage.Value)
GetIterator implements GetIterator for a sync iterator and returns the iterator and its next method.
func (*ExecutionContext) GetIteratorFlattenable ¶
func (cx *ExecutionContext) GetIteratorFlattenable(v storage.Value, iterateStrings bool) (it, next storage.Value)
GetIteratorFlattenable returns an iterator and its next method, accepting strings when iterateStrings is set.
func (*ExecutionContext) GetIteratorFromMethod ¶
func (cx *ExecutionContext) GetIteratorFromMethod(v storage.Value, method *storage.Object) (it, next storage.Value)
GetIteratorFromMethod returns the iterator and next method obtained by calling method on v.
func (*ExecutionContext) GetMethod ¶
GetMethod implements GetMethod: the callable property key of v, or nil when it is undefined or null.
func (ExecutionContext) GetNewTarget ¶
GetNewTarget implements GetNewTarget for the running native function: it returns the constructor the function is being constructed for, or nil when it was called.
func (*ExecutionContext) GetOwnProperty ¶
func (cx *ExecutionContext) GetOwnProperty(o *storage.Object, k storage.PropKey) (storage.PropDesc, bool)
GetOwnProperty implements [[GetOwnProperty]].
func (*ExecutionContext) GetPrototypeFromConstructor ¶
func (cx *ExecutionContext) GetPrototypeFromConstructor(ctor *storage.Object, defaultProto storage.Intrinsic) *storage.Object
GetPrototypeFromConstructor implements GetPrototypeFromConstructor. A nil ctor selects defaultProto in the current realm.
func (*ExecutionContext) GetVCached ¶
func (cx *ExecutionContext) GetVCached(v storage.Value, k storage.PropKey, c *PropertyCache) storage.Value
GetVCached implements GetV(v, k), using and updating c.
func (*ExecutionContext) GetWithReceiver ¶
func (cx *ExecutionContext) GetWithReceiver(o *storage.Object, k storage.PropKey, receiver storage.Value) storage.Value
GetWithReceiver implements o.[[Get]](k, receiver).
func (*ExecutionContext) GlobalObject ¶
func (cx *ExecutionContext) GlobalObject() storage.Value
GlobalObject returns the global object.
func (ExecutionContext) HasCustomClock ¶
func (ag ExecutionContext) HasCustomClock() bool
HasCustomClock reports whether reading the clock calls a host function.
func (*ExecutionContext) HasOwnProperty ¶
HasOwnProperty reports whether o has the own property k.
func (*ExecutionContext) HasProperty ¶
HasProperty implements [[HasProperty]].
func (*ExecutionContext) HostCall ¶
func (cx *ExecutionContext) HostCall(f, this storage.Value, args []storage.Value) (storage.Value, error)
HostCall calls f with the given this value and arguments.
func (*ExecutionContext) HostCallMethod ¶
func (cx *ExecutionContext) HostCallMethod(v, key storage.Value, args []storage.Value) (storage.Value, error)
HostCallMethod calls the method v[key] with v as this.
func (*ExecutionContext) HostConstruct ¶
func (cx *ExecutionContext) HostConstruct(f storage.Value, args []storage.Value) (storage.Value, error)
HostConstruct implements new f(...args).
func (*ExecutionContext) HostDelete ¶
func (cx *ExecutionContext) HostDelete(v, key storage.Value) error
HostDelete deletes v[key] the way strict mode code does.
func (*ExecutionContext) HostInstanceOf ¶
HostInstanceOf implements v instanceof t.
func (*ExecutionContext) HostReject ¶
func (cx *ExecutionContext) HostReject(c *PromiseCapability, v storage.Value) error
HostReject rejects the promise of c with v, as the [[Reject]] function of c does.
func (*ExecutionContext) HostResolve ¶
func (cx *ExecutionContext) HostResolve(c *PromiseCapability, v storage.Value) error
HostResolve resolves the promise of c with v, as the [[Resolve]] function of c does.
func (*ExecutionContext) HostSet ¶
func (cx *ExecutionContext) HostSet(v, key, val storage.Value) error
HostSet stores v[key] = val the way strict mode code does.
func (*ExecutionContext) IfAbruptCloseIterator ¶
func (cx *ExecutionContext) IfAbruptCloseIterator(it storage.Value, f func())
IfAbruptCloseIterator implements IfAbruptCloseIterator for what f does: when f throws, it closes the iterator it, ignoring any error of closing, and throws the exception again.
func (*ExecutionContext) IfAbruptCloseIterators ¶
func (cx *ExecutionContext) IfAbruptCloseIterators(its []storage.Value, f func())
IfAbruptCloseIterators implements IfAbruptCloseIterators for what f does: when f throws, it closes the iterators its in reverse order, skipping undefined entries, and rethrows the original exception.
func (*ExecutionContext) IfAbruptRejectPromise ¶
func (cx *ExecutionContext) IfAbruptRejectPromise(c *PromiseCapability, f func()) bool
IfAbruptRejectPromise implements IfAbruptRejectPromise for what f does: when f throws, it rejects c with the exception and reports false.
func (*ExecutionContext) ImportInRealm ¶
func (cx *ExecutionContext) ImportInRealm(specifier wtf8.String) *storage.Object
ImportInRealm loads specifier with the execution realm as the referrer and returns a promise of that realm for the module namespace.
func (ExecutionContext) InitLazyObject ¶
InitLazyObject runs the init function of o, an object of ExecutionContext.NewLazyObject, unless it has run already.
func (*ExecutionContext) InstallGlobalProxy ¶
func (cx *ExecutionContext) InstallGlobalProxy(foreignView *storage.Object, previous *ExecutionContext, shareAccess bool) storage.Value
InstallGlobalProxy makes a proxy the global this value of the current realm. A previous realm supplies its proxy after detachment. If shareAccess is true, the realm joins the previous realm's group after detachment, or the entered realm's group when previous is nil. Property operations on globals outside the group use foreignView.
func (ExecutionContext) Interrupt ¶
func (ag ExecutionContext) Interrupt(cause error)
Interrupt stops execution with an InterruptedError carrying cause at the next loop or call. It may be called from any goroutine and remains pending until observed or cleared. Interrupted module evaluations are rejected with an Error whose message is "ekuma: interrupted" and whose storage.GoError is cause, or the InterruptedError when cause is nil.
func (*ExecutionContext) IntlFallbackSymbol ¶
func (cx *ExecutionContext) IntlFallbackSymbol() *storage.Object
IntlFallbackSymbol returns the [[FallbackSymbol]] of %Intl% of the execution realm.
func (*ExecutionContext) IntrinsicValue ¶
func (cx *ExecutionContext) IntrinsicValue(id storage.Intrinsic) storage.Value
IntrinsicValue returns the intrinsic object id of the execution realm, which must be set, as a value.
func (*ExecutionContext) IsArray ¶
func (cx *ExecutionContext) IsArray(v storage.Value) bool
IsArray implements IsArray.
func (*ExecutionContext) IsConstructor ¶
func (cx *ExecutionContext) IsConstructor(f *storage.Object) bool
IsConstructor implements IsConstructor.
func (*ExecutionContext) IsEnteredRealm ¶
func (cx *ExecutionContext) IsEnteredRealm() bool
IsEnteredRealm reports whether the execution realm is the agent's entered realm.
func (*ExecutionContext) IsExtensible ¶
func (cx *ExecutionContext) IsExtensible(o *storage.Object) bool
IsExtensible implements [[IsExtensible]].
func (*ExecutionContext) IsIntrinsicOfOtherRealm ¶
IsIntrinsicOfOtherRealm reports whether the function f is the intrinsic id of GetFunctionRealm(f), and that realm is not the current one.
func (*ExecutionContext) IsRegExpOfCurrentRealm ¶
func (cx *ExecutionContext) IsRegExpOfCurrentRealm(o *storage.Object) bool
IsRegExpOfCurrentRealm reports whether the [[Realm]] of the RegExp object o is the current realm.
func (*ExecutionContext) Iterate ¶
Iterate calls f for every value that iterating v yields. When f returns false, the iteration stops and the iterator is closed.
func (*ExecutionContext) IterateFromMethod ¶
func (cx *ExecutionContext) IterateFromMethod(v storage.Value, method *storage.Object, f func(storage.Value) bool)
IterateFromMethod is ExecutionContext.Iterate for the iterator that GetIteratorFromMethod(v, method) returns.
func (*ExecutionContext) IterateRecord ¶
IterateRecord is ExecutionContext.Iterate for the iterator record of the iterator it and its next method next.
func (*ExecutionContext) IteratorClose ¶
func (cx *ExecutionContext) IteratorClose(it storage.Value)
IteratorClose implements IteratorClose for a normal completion.
func (*ExecutionContext) IteratorCloseAll ¶
func (cx *ExecutionContext) IteratorCloseAll(its []storage.Value)
IteratorCloseAll implements IteratorCloseAll for a normal completion: it closes the iterators its in reverse order, skipping undefined entries.
func (*ExecutionContext) IteratorStep ¶
func (cx *ExecutionContext) IteratorStep(it, next storage.Value) bool
IteratorStep implements IteratorStep for the iterator it and its next method next, without the result: it reports false when the iterator is done.
func (*ExecutionContext) IteratorStepValue ¶
IteratorStepValue implements IteratorStepValue for the iterator it and its next method next: it returns the next value, or reports false when the iterator is done.
func (*ExecutionContext) IteratorToList ¶
IteratorToList implements IteratorToList(GetIteratorFromMethod(v, method)).
func (*ExecutionContext) KeyValue ¶
func (cx *ExecutionContext) KeyValue(k storage.PropKey) storage.Value
KeyValue returns the key k as a string or symbol value.
func (*ExecutionContext) LeaveJoin ¶
func (cx *ExecutionContext) LeaveJoin()
LeaveJoin ends what the last successful call of ExecutionContext.EnterJoin started.
func (*ExecutionContext) LeaveLocaleJoin ¶
func (cx *ExecutionContext) LeaveLocaleJoin()
LeaveLocaleJoin is ExecutionContext.LeaveJoin for Array.prototype.toLocaleString.
func (*ExecutionContext) LegacyRegExpInput ¶
func (cx *ExecutionContext) LegacyRegExpInput() storage.Value
LegacyRegExpInput returns the [[RegExpInput]] slot of %RegExp%, or undefined for empty.
func (*ExecutionContext) LegacyRegExpMatch ¶
func (cx *ExecutionContext) LegacyRegExpMatch() (s storage.Value, caps []int)
LegacyRegExpMatch returns the subject and the capture indices of the last match that the legacy static properties of %RegExp% show. s is undefined when they are unavailable. Before the first match, s is the empty string and caps is empty. caps is valid until the next match.
func (*ExecutionContext) LendRegExpLiteralReceivers ¶
func (cx *ExecutionContext) LendRegExpLiteralReceivers(f *storage.Object)
LendRegExpLiteralReceivers is like ExecutionContext.LendRegExpLiterals for the this value of a method call on a regular expression literal.
func (*ExecutionContext) LendRegExpLiterals ¶
func (cx *ExecutionContext) LendRegExpLiterals(f *storage.Object)
LendRegExpLiterals marks the native function f as one that may receive, as the first argument of a call in the current realm written with a regular expression literal there, a RegExp object that other evaluations of the literal reuse instead of a new one. Unless f replaces that argument by ExecutionContext.OwnRegExp before using it, f must not keep it, expose it to script code, or use it after running script code.
func (*ExecutionContext) LengthOfArrayLike ¶
func (cx *ExecutionContext) LengthOfArrayLike(o *storage.Object) int64
LengthOfArrayLike implements LengthOfArrayLike.
func (*ExecutionContext) MapASCII ¶
MapASCII converts s to uppercase if upper is true, or lowercase otherwise. s must be a string; false means it is non-ASCII or too long to pack.
func (ExecutionContext) ModuleSourceClassName ¶
ModuleSourceClassName returns the [[ModuleSourceClassName]] of v. ok is false when v has no such slot.
func (*ExecutionContext) NewArrayBufferObject ¶
func (cx *ExecutionContext) NewArrayBufferObject(proto *storage.Object, byteLength, maxByteLength int64, shared bool) *storage.Object
NewArrayBufferObject implements AllocateArrayBuffer and AllocateSharedArrayBuffer: it returns a buffer object of byteLength zero bytes with the prototype proto. maxByteLength is -1 for a buffer whose length is fixed. It throws a RangeError when the lengths are too large.
func (*ExecutionContext) NewArrayIterator ¶
func (cx *ExecutionContext) NewArrayIterator(o *storage.Object, kind quiet.IterationKind) *storage.Object
NewArrayIterator returns an array iterator over the array-like object o.
func (*ExecutionContext) NewArrayIteratorNext ¶
func (cx *ExecutionContext) NewArrayIteratorNext() *storage.Object
NewArrayIteratorNext returns the next method of array iterators.
func (*ExecutionContext) NewArrayOf ¶
func (cx *ExecutionContext) NewArrayOf(elems []storage.Value) storage.Value
NewArrayOf returns a new array with the given elements, which it keeps.
func (*ExecutionContext) NewBooleanObject ¶
NewBooleanObject returns a Boolean object for b with the prototype proto.
func (*ExecutionContext) NewDateObject ¶
NewDateObject returns a Date object with the prototype proto whose [[DateValue]] is tv.
func (*ExecutionContext) NewDisposableStackObject ¶
func (cx *ExecutionContext) NewDisposableStackObject(proto *storage.Object, async bool, state any) *storage.Object
NewDisposableStackObject returns a DisposableStack object, or an AsyncDisposableStack object when async is set, with the prototype proto. state is what storage.DisposableStackState returns for it.
func (*ExecutionContext) NewError ¶
func (cx *ExecutionContext) NewError(kind ErrorKind, msg string) storage.Value
NewError returns a new error object of the given type in the execution realm with the message msg, which is UTF-8.
func (*ExecutionContext) NewErrorObject ¶
func (cx *ExecutionContext) NewErrorObject(proto *storage.Object) *storage.Object
NewErrorObject returns an Error object with prototype proto and no own properties.
func (*ExecutionContext) NewFinalizationRegistryObject ¶
func (cx *ExecutionContext) NewFinalizationRegistryObject(proto *storage.Object, callback *storage.Object) *storage.Object
NewFinalizationRegistryObject returns a FinalizationRegistry object with the prototype proto and the cleanup callback callback.
func (*ExecutionContext) NewFunction ¶
func (cx *ExecutionContext) NewFunction(name string, f NativeFunc) storage.Value
NewFunction returns a function implemented by f. name is UTF-8.
func (*ExecutionContext) NewGoError ¶
func (cx *ExecutionContext) NewGoError(err error) storage.Value
NewGoError returns a new Error object whose message is the text of err and that storage.GoError maps back to err.
func (*ExecutionContext) NewHTMLDDA ¶
func (cx *ExecutionContext) NewHTMLDDA(f NativeFunc) storage.Value
NewHTMLDDA returns a function implemented by f that has the [[IsHTMLDDA]] internal slot.
func (*ExecutionContext) NewInstance ¶
func (cx *ExecutionContext) NewInstance(proto *storage.Object) *storage.Object
NewInstance returns a new empty ordinary instance with prototype proto, which may be nil.
func (*ExecutionContext) NewIntlObject ¶
NewIntlObject returns an object of one of the Intl types with the prototype proto, whose internal slots are data.
func (*ExecutionContext) NewIteratorObject ¶
NewIteratorObject returns a built-in iterator object with the prototype proto. state is what storage.IteratorState returns for it.
func (*ExecutionContext) NewLazyObject ¶
func (cx *ExecutionContext) NewLazyObject(proto *storage.Object, init func(*ExecutionContext, *storage.Object)) *storage.Object
NewLazyObject returns an ordinary object with prototype proto. The first operation that needs its own properties, or a call to [agent.InitLazyObject], runs init once.
func (*ExecutionContext) NewModuleSourceObject ¶
func (cx *ExecutionContext) NewModuleSourceObject(proto *storage.Object, className string) *storage.Object
NewModuleSourceObject returns a module source object with the prototype proto whose [[ModuleSourceClassName]] is className.
func (*ExecutionContext) NewNative ¶
func (cx *ExecutionContext) NewNative(name wtf8.String, length int, f storage.Native) *storage.Object
NewNative returns a function object of the native function f.
func (*ExecutionContext) NewNativeConstructor ¶
func (cx *ExecutionContext) NewNativeConstructor(name wtf8.String, length int, f storage.Native) *storage.Object
NewNativeConstructor returns a function object of the native function f that can be called with new. f learns the constructor it is constructing for from [agent.GetNewTarget].
func (*ExecutionContext) NewNativeWithState ¶
func (cx *ExecutionContext) NewNativeWithState(name wtf8.String, length int, f storage.Native, state any) *storage.Object
NewNativeWithState returns a function object of the native function f whose internal slots are state. f finds them with [agent.ActiveNativeState].
func (*ExecutionContext) NewNumberObject ¶
NewNumberObject returns a Number object for n with the prototype proto.
func (*ExecutionContext) NewOrdinaryObject ¶
func (cx *ExecutionContext) NewOrdinaryObject() *storage.Object
NewOrdinaryObject returns a new empty ordinary object whose prototype is %Object.prototype%.
func (*ExecutionContext) NewPlainObject ¶
func (cx *ExecutionContext) NewPlainObject() storage.Value
NewPlainObject returns a new empty object.
func (*ExecutionContext) NewPromiseCapability ¶
func (cx *ExecutionContext) NewPromiseCapability(c storage.Value) *PromiseCapability
NewPromiseCapability implements NewPromiseCapability.
func (*ExecutionContext) NewPromiseObject ¶
func (cx *ExecutionContext) NewPromiseObject(proto *storage.Object) *storage.Object
NewPromiseObject returns a pending Promise object with the prototype proto.
func (*ExecutionContext) NewRawJSONObject ¶
func (cx *ExecutionContext) NewRawJSONObject() *storage.Object
NewRawJSONObject returns an object without any property or prototype that has the internal slot [[IsRawJSON]].
func (*ExecutionContext) NewScript ¶
func (cx *ExecutionContext) NewScript(code *bytecode.Func) *Script
NewScript binds a compiled script to the current realm and takes ownership of its bytecode.
func (*ExecutionContext) NewShadowRealmObject ¶
func (cx *ExecutionContext) NewShadowRealmObject(proto *storage.Object, target *ExecutionContext) *storage.Object
NewShadowRealmObject returns a ShadowRealm object with the prototype proto whose [[ShadowRealm]] is the realm of target.
func (*ExecutionContext) NewStringBytes ¶
func (cx *ExecutionContext) NewStringBytes(s []byte) storage.Value
NewStringBytes returns a string value containing the canonical WTF-8 bytes s.
func (*ExecutionContext) NewStringObject ¶
func (cx *ExecutionContext) NewStringObject(s *storage.Object, proto *storage.Object) *storage.Object
NewStringObject returns the String object that wraps the string s.
func (*ExecutionContext) NewTemporalObject ¶
NewTemporalObject returns an object of one of the Temporal types with the prototype proto, whose internal slots are data.
func (*ExecutionContext) NewWeakMapObject ¶
func (cx *ExecutionContext) NewWeakMapObject(proto *storage.Object) *storage.Object
NewWeakMapObject returns a WeakMap object without entries with the prototype proto.
func (*ExecutionContext) NewWeakRefObject ¶
func (cx *ExecutionContext) NewWeakRefObject(proto *storage.Object, v storage.Value) *storage.Object
NewWeakRefObject returns a WeakRef object with the prototype proto whose target is v, for which CanBeHeldWeakly must hold.
func (*ExecutionContext) NewWeakSetObject ¶
func (cx *ExecutionContext) NewWeakSetObject(proto *storage.Object) *storage.Object
NewWeakSetObject returns a WeakSet object without entries with the prototype proto.
func (*ExecutionContext) NotifyWaiters ¶
func (cx *ExecutionContext) NotifyWaiters(b *storage.ArrayBuffer, byteIndex int, count float64) int
NotifyWaiters implements RemoveWaiters and NotifyWaiter for the waiters of byteIndex of the shared buffer b, which may belong to any agent: it notifies the first count waiters, and returns how many it notified. count must not be negative and may be +Inf.
func (ExecutionContext) Now ¶
The limits of the current time: the limits of time values, and of epoch nanoseconds of Temporal.Instant. Now returns the current time of the clock, clamped to the range of time values. It implements HostSystemUTCEpochNanoseconds.
func (*ExecutionContext) ObjectTagString ¶
func (cx *ExecutionContext) ObjectTagString(tag wtf8.String) storage.Value
ObjectTagString returns the string "[object tag]". It throws a RangeError when that is too long.
func (*ExecutionContext) OrdinaryHasInstance ¶
func (cx *ExecutionContext) OrdinaryHasInstance(c, v storage.Value) bool
OrdinaryHasInstance implements OrdinaryHasInstance.
func (*ExecutionContext) OrdinaryToPrimitive ¶
OrdinaryToPrimitive implements OrdinaryToPrimitive. h is HintString or HintNumber.
func (*ExecutionContext) OwnKeys ¶
func (cx *ExecutionContext) OwnKeys(o *storage.Object) []storage.PropKey
OwnKeys implements [[OwnPropertyKeys]]: array indices in ascending order, then strings and then symbols, each in the order of creation.
func (*ExecutionContext) OwnRegExp ¶
func (cx *ExecutionContext) OwnRegExp(v storage.Value) storage.Value
OwnRegExp returns v, or a new RegExp object for the same literal when v is a RegExp object lent by ExecutionContext.LendRegExpLiterals. v must not have been used since it was lent.
func (*ExecutionContext) PadShort ¶
func (cx *ExecutionContext) PadShort(s, fill storage.Value, target, need int, atStart bool) (padded storage.Value, ok bool)
PadShort pads s with fill to target UTF-16 units and reports whether the result fits. s and fill must be strings, fill must be nonempty, and need must be positive and equal target minus s's length.
func (*ExecutionContext) ParseJSONModule ¶
func (cx *ExecutionContext) ParseJSONModule(src string, hostDefined any) (*Module, error)
ParseJSONModule implements ParseJSONModule for the source text src. hostDefined is the [[HostDefined]]. A src that is not JSON is reported as an *storage.Error holding the JavaScript SyntaxError.
func (*ExecutionContext) ParseModule ¶
func (cx *ExecutionContext) ParseModule(file, src string, hostDefined any) (*Module, error)
ParseModule implements ParseModule for the source text src. file names the module in error messages and stack traces, and hostDefined is the [[HostDefined]]. The error is a *SyntaxError.
func (*ExecutionContext) ParseScript ¶
ParseScript implements ParseScript for the current realm. file names the script in error messages. The error is a *SyntaxError when src is not a valid script.
func (*ExecutionContext) PerformEval ¶
func (cx *ExecutionContext) PerformEval(x storage.Value) storage.Value
PerformEval implements PerformEval for an indirect eval.
func (*ExecutionContext) PerformPromiseThen ¶
func (cx *ExecutionContext) PerformPromiseThen(p storage.Value, onFulfilled, onRejected storage.Value, c *PromiseCapability) storage.Value
PerformPromiseThen implements PerformPromiseThen for the promise p. c is nil when the result capability is undefined, and the result is then undefined.
func (ExecutionContext) Poll ¶
func (ag ExecutionContext) Poll()
Poll stops the script when an interruption was requested. It also takes the notifications of other agents, which raise the interrupt flag too. A loop calls it only between runs of many steps, such as storage.PollInterval steps.
func (ExecutionContext) PollAt ¶
func (ag ExecutionContext) PollAt(i int64)
PollAt calls [agent.Poll] when i ends a run of storage.PollInterval indices, so that a loop over consecutive indices checks for an interruption regularly.
func (ExecutionContext) PollStep ¶
func (ag ExecutionContext) PollStep()
PollStep calls [agent.Poll] when an interruption may be pending. It is for every step of a loop whose steps can be long, such as looking up a property in a long prototype chain.
func (*ExecutionContext) PreventExtensions ¶
func (cx *ExecutionContext) PreventExtensions(o *storage.Object) bool
PreventExtensions implements [[PreventExtensions]].
func (*ExecutionContext) PrivateGet ¶
PrivateGet implements PrivateGet.
func (*ExecutionContext) PrivateSet ¶
PrivateSet implements PrivateSet.
func (*ExecutionContext) PromiseResolve ¶
PromiseResolve implements PromiseResolve for the constructor c.
func (*ExecutionContext) ProtoOf ¶
func (cx *ExecutionContext) ProtoOf(o *storage.Object) *storage.Object
ProtoOf implements [[GetPrototypeOf]].
func (*ExecutionContext) ProxyCreate ¶
func (cx *ExecutionContext) ProxyCreate(target, handler storage.Value) *storage.Object
ProxyCreate implements ProxyCreate.
func (*ExecutionContext) QueryKey ¶
func (cx *ExecutionContext) QueryKey(v storage.Value) storage.QueryKey
QueryKey returns ToPropertyKey(v) as a query key, which is valid until code runs or a property key is made.
func (*ExecutionContext) QueryOwnProperty ¶
QueryOwnProperty is HasOwnProperty of o and k.
func (*ExecutionContext) QueryProperty ¶
QueryProperty is HasProperty of o and k.
func (*ExecutionContext) QueueMicrotask ¶
func (cx *ExecutionContext) QueueMicrotask(callback storage.Value)
QueueMicrotask queues a call to callback with no arguments and reports an exception in the callback's creation realm. It throws a TypeError if callback is not callable.
func (*ExecutionContext) Quiet ¶
func (cx *ExecutionContext) Quiet() quiet.Context
Quiet returns the quiet context of the realm of cx.
func (ExecutionContext) RandomNumber ¶
func (ag ExecutionContext) RandomNumber() float64
RandomNumber returns a number in [0, 1) for Math.random. With a source, it is the number that rand.Rand.Float64 would return.
func (*ExecutionContext) RealmHostDefined ¶
func (cx *ExecutionContext) RealmHostDefined() any
RealmHostDefined returns the [[HostDefined]] field of the execution realm.
func (ExecutionContext) RecordStack ¶
RecordStack records the stack trace of the new error object e, whose message is msg in UTF-8, as what storage.ErrorStack returns. The running native function constructs e for newTarget: the trace leaves out that function, and the frames up to the call of newTarget when newTarget is running.
func (*ExecutionContext) RegExpAlloc ¶
func (cx *ExecutionContext) RegExpAlloc(newTarget *storage.Object) *storage.Object
RegExpAlloc implements RegExpAlloc: it returns a RegExp object for the constructor newTarget, with an own lastIndex property and no matcher yet.
func (*ExecutionContext) RegExpFlagsString ¶
func (cx *ExecutionContext) RegExpFlagsString(f regexp.Flags) storage.Value
RegExpFlagsString returns the string of the flags f in the order of the flags getter.
func (*ExecutionContext) RegExpInitialize ¶
func (cx *ExecutionContext) RegExpInitialize(o *storage.Object, pattern, flags storage.Value) *storage.Object
RegExpInitialize implements RegExpInitialize for the RegExp object o and returns o. It throws a SyntaxError for an invalid pattern or invalid flags.
func (*ExecutionContext) RejectCapability ¶
func (cx *ExecutionContext) RejectCapability(c *PromiseCapability, v storage.Value)
RejectCapability calls the [[Reject]] function of c with v.
func (*ExecutionContext) RepeatShort ¶
func (cx *ExecutionContext) RepeatShort(s storage.Value, count int) (repeated storage.Value, ok bool)
RepeatShort returns count copies of s and reports whether the result fits a packed string. s must be a string, and count must be nonnegative.
func (*ExecutionContext) RequireObjectCoercible ¶
func (cx *ExecutionContext) RequireObjectCoercible(v storage.Value, what string)
RequireObjectCoercible throws a TypeError when v is undefined or null.
func (*ExecutionContext) ResolveCapability ¶
func (cx *ExecutionContext) ResolveCapability(c *PromiseCapability, v storage.Value)
ResolveCapability calls the [[Resolve]] function of c with v.
func (*ExecutionContext) ResumeAsyncGenerator ¶
func (cx *ExecutionContext) ResumeAsyncGenerator(gen storage.Value, mode ResumeMode, v storage.Value) storage.Value
ResumeAsyncGenerator implements the next, return and throw methods of async generators, selected by mode, for the receiver gen. It returns the promise of the iterator result.
func (*ExecutionContext) ResumeGenerator ¶
func (cx *ExecutionContext) ResumeGenerator(gen storage.Value, mode ResumeMode, v storage.Value) (storage.Value, bool)
ResumeGenerator continues the generator gen with the value v and returns the iterator result. It reports false, without running anything, when gen is not a generator.
func (*ExecutionContext) Run ¶
func (cx *ExecutionContext) Run(f func())
Run calls f with cx active for host reentry.
func (*ExecutionContext) RunJobs ¶
func (cx *ExecutionContext) RunJobs() error
RunJobs runs the pending jobs, as the end of an outermost call into cx does. It must not be called while [agent.Running] reports true.
func (ExecutionContext) Running ¶
func (ag ExecutionContext) Running() bool
Running reports whether a call from Go into ag is running.
func (*ExecutionContext) Set ¶
Set stores val as the property k of o and throws a TypeError when the store is refused.
func (ExecutionContext) SetAgentCanSuspend ¶
func (ag ExecutionContext) SetAgentCanSuspend(canSuspend bool)
SetAgentCanSuspend sets whether the agent can suspend, which Atomics.wait requires. An agent that can suspend must not run on a thread that must not block.
func (ExecutionContext) SetAvailableDefaultLocale ¶
func (ag ExecutionContext) SetAvailableDefaultLocale(locale string)
SetAvailableDefaultLocale sets the available locale of the default locale, until [agent.SetDefaultLocale] changes that.
func (ExecutionContext) SetClock ¶
SetClock sets now as the clock of [agent.Now]. A nil now restores time.Now.
func (ExecutionContext) SetContinuationData ¶
func (ag ExecutionContext) SetContinuationData(data any)
SetContinuationData sets data as the continuation data.
func (ExecutionContext) SetDefaultLocale ¶
func (ag ExecutionContext) SetDefaultLocale(tag string)
SetDefaultLocale sets the default locale to a well-formed language tag or empty.
func (ExecutionContext) SetDefaultTimeZone ¶
SetDefaultTimeZone sets the time zone of local time to tz. A nil tz restores the local time zone of the host.
func (*ExecutionContext) SetExceptionReporter ¶
func (cx *ExecutionContext) SetExceptionReporter(report func(storage.Value, ExceptionLocation))
SetExceptionReporter sets the current realm's handler for exceptions escaping an outermost host call or a queued callback. The handler receives the thrown value and its source location before the next microtask runs.
func (ExecutionContext) SetExtremum ¶
SetExtremum says that the native function f is Math.min or Math.max, as e names. The contract of its number kernels holds for what the interpreter computes.
func (ExecutionContext) SetFrameless ¶
SetFrameless makes calls of the native function f show no frame: stack traces leave them out, and the caller of a function that f calls is the one that called f.
func (ExecutionContext) SetHostGetImportMetaProperties ¶
func (ag ExecutionContext) SetHostGetImportMetaProperties(f HostGetImportMetaPropertiesFunc)
SetHostGetImportMetaProperties sets the implementation of HostGetImportMetaProperties. Without one, import.meta has no properties.
func (ExecutionContext) SetHostLoadImportedModule ¶
func (ag ExecutionContext) SetHostLoadImportedModule(f HostLoadImportedModuleFunc)
SetHostLoadImportedModule sets the implementation of HostLoadImportedModule. Without one, every import fails with a TypeError.
func (ExecutionContext) SetHostUnhandledRejection ¶
func (ag ExecutionContext) SetHostUnhandledRejection(f UnhandledRejectionFunc)
SetHostUnhandledRejection sets f as the function that is told about the unhandled rejections, in the order of rejection, after the jobs ran. f may call into ag. Without one, the unhandled rejections are discarded.
func (*ExecutionContext) SetLegacyRegExpInput ¶
func (cx *ExecutionContext) SetLegacyRegExpInput(s storage.Value)
SetLegacyRegExpInput sets the [[RegExpInput]] slot of %RegExp% to the string s.
func (*ExecutionContext) SetPrototypeOf ¶
SetPrototypeOf implements [[SetPrototypeOf]].
func (ExecutionContext) SetRandomSource ¶
SetRandomSource sets src as the source of [agent.RandomNumber]. A nil src restores the global source of math/rand/v2.
func (*ExecutionContext) SetRealmHostDefined ¶
func (cx *ExecutionContext) SetRealmHostDefined(v any)
SetRealmHostDefined sets the [[HostDefined]] field of the execution realm to v.
func (*ExecutionContext) SetWithReceiver ¶
func (cx *ExecutionContext) SetWithReceiver(o *storage.Object, k storage.PropKey, val storage.Value, receiver storage.Value) bool
SetWithReceiver implements o.[[Set]](k, val, receiver). It reports false when the store was refused.
func (*ExecutionContext) StringFromGo ¶
func (cx *ExecutionContext) StringFromGo(s string) storage.Value
StringFromGo returns the Go string s, which is taken to be UTF-8, as a value.
func (*ExecutionContext) SubstringBetween ¶
SubstringBetween is like storage.RealmPart.Substring for the positions start and end in the text of s, which must be in order.
func (ExecutionContext) SystemUTCEpochMilliseconds ¶
func (ag ExecutionContext) SystemUTCEpochMilliseconds() float64
SystemUTCEpochMilliseconds returns the current time as a time value.
func (ExecutionContext) TakeUnhandledRejection ¶
TakeUnhandledRejection ends deferral, returning the first unhandled reason and clearing all reports.
func (*ExecutionContext) ThrowRangeError ¶
func (cx *ExecutionContext) ThrowRangeError(msg string)
ThrowRangeError throws a RangeError in the execution realm with the given message. It does not return.
func (*ExecutionContext) ThrowReferenceError ¶
func (cx *ExecutionContext) ThrowReferenceError(msg string)
ThrowReferenceError throws a ReferenceError in the execution realm with the given message. It does not return.
func (*ExecutionContext) ThrowSyntaxError ¶
func (cx *ExecutionContext) ThrowSyntaxError(msg string)
ThrowSyntaxError throws a SyntaxError in the execution realm with the given message. It does not return.
func (*ExecutionContext) ThrowTypeError ¶
func (cx *ExecutionContext) ThrowTypeError(msg string)
ThrowTypeError throws a TypeError in the execution realm with the given message. It does not return.
func (*ExecutionContext) ToBigInt ¶
func (cx *ExecutionContext) ToBigInt(v storage.Value) storage.Value
ToBigInt implements ToBigInt. The result is a BigInt.
func (*ExecutionContext) ToElementValue ¶
ToElementValue converts v as TypedArraySetElement does for an element of the type t: by ToBigInt for a BigInt type and by ToNumber otherwise.
func (*ExecutionContext) ToInt32 ¶
func (cx *ExecutionContext) ToInt32(v storage.Value) int32
ToInt32 implements ToInt32.
func (*ExecutionContext) ToIntegerOrInfinity ¶
func (cx *ExecutionContext) ToIntegerOrInfinity(v storage.Value) float64
ToIntegerOrInfinity implements ToIntegerOrInfinity.
func (*ExecutionContext) ToNumber ¶
func (cx *ExecutionContext) ToNumber(v storage.Value) float64
ToNumber implements ToNumber.
func (*ExecutionContext) ToNumeric ¶
func (cx *ExecutionContext) ToNumeric(v storage.Value) storage.Value
ToNumeric implements ToNumeric: the result is a number or a BigInt.
func (*ExecutionContext) ToObject ¶
func (cx *ExecutionContext) ToObject(v storage.Value) *storage.Object
ToObject implements ToObject.
func (*ExecutionContext) ToPrimitive ¶
ToPrimitive implements ToPrimitive.
func (*ExecutionContext) ToPropertyDescriptor ¶
func (cx *ExecutionContext) ToPropertyDescriptor(v storage.Value) storage.PropDesc
ToPropertyDescriptor implements ToPropertyDescriptor.
func (*ExecutionContext) ToPropertyKey ¶
func (cx *ExecutionContext) ToPropertyKey(v storage.Value) storage.PropKey
ToPropertyKey implements ToPropertyKey.
func (*ExecutionContext) ToString ¶
func (cx *ExecutionContext) ToString(v storage.Value) wtf8.String
ToString implements ToString.
func (*ExecutionContext) ToStringValue ¶
func (cx *ExecutionContext) ToStringValue(v storage.Value) storage.Value
ToStringValue implements ToString and returns the result as a value.
func (*ExecutionContext) ToUint32 ¶
func (cx *ExecutionContext) ToUint32(v storage.Value) uint32
ToUint32 implements ToUint32.
func (*ExecutionContext) ToWellFormed ¶
func (cx *ExecutionContext) ToWellFormed(s storage.Value) storage.Value
ToWellFormed returns s with lone surrogates replaced by U+FFFD.
func (*ExecutionContext) TransferArrayBuffer ¶
func (cx *ExecutionContext) TransferArrayBuffer(o *storage.Object, proto *storage.Object, newByteLength, maxByteLength int64, immutable bool) *storage.Object
TransferArrayBuffer implements the end of ArrayBufferCopyAndDetach: it returns a new ArrayBuffer with the prototype proto that has the first newByteLength bytes of the buffer object o, zero-filled beyond its length, and detaches o. maxByteLength is -1 for a buffer whose length is fixed. The new buffer is immutable when immutable is set. o must be mutable and have no detach key. It throws a RangeError when the lengths are too large.
func (*ExecutionContext) TrimString ¶
TrimString trims whitespace from the selected ends of the string s.
func (*ExecutionContext) ValidateShadowRealmObject ¶
func (cx *ExecutionContext) ValidateShadowRealmObject(o storage.Value) *ExecutionContext
ValidateShadowRealmObject implements ValidateShadowRealmObject, and returns the context of its shadow realm.
func (*ExecutionContext) Wait ¶
func (cx *ExecutionContext) Wait(t *storage.TypedArray, i int, v uint64, timeout float64, async bool) (storage.Value, bool)
Wait implements the steps of DoWait from the critical section on, for the element i of the Int32Array or BigInt64Array t on a shared buffer, the encoding v and a timeout in milliseconds that is not negative and may be +Inf. A synchronous wait suspends the agent, which must be able to, and returns "ok", "not-equal" or "timed-out". An asynchronous wait returns "not-equal" or "timed-out" without waiting, or reports true and returns a promise that resolves to "ok" when ExecutionContext.NotifyWaiters in any agent notifies the waiter, or to "timed-out" after the timeout.
An interruption ends a synchronous wait.
type FinalizationRegistry ¶
type FinalizationRegistry struct {
// contains filtered or unexported fields
}
FinalizationRegistry is the state of a FinalizationRegistry object.
func FinalizationRegistryData ¶
func FinalizationRegistryData(v storage.Value) *FinalizationRegistry
FinalizationRegistryData returns the state of the FinalizationRegistry object v, or nil when v is not a FinalizationRegistry object.
func (*FinalizationRegistry) Register ¶
func (r *FinalizationRegistry) Register(target, held, token storage.Value)
Register adds a cell with the target target, the held value held and the unregister token token. target, and token unless it is undefined, must be values for which CanBeHeldWeakly holds.
func (*FinalizationRegistry) Unregister ¶
func (r *FinalizationRegistry) Unregister(token storage.Value, poll func()) bool
Unregister removes the cells whose unregister token is token and reports whether there was any. token must be a value for which CanBeHeldWeakly holds. poll, which may be nil, is called now and then over many cells and may stop the removal by panicking, leaving the cells that were not removed yet.
type FunctionKind ¶
type FunctionKind uint8
FunctionKind is the kind of function that CreateDynamicFunction creates.
const ( NormalFunction FunctionKind = iota GeneratorFunction AsyncFunction AsyncGeneratorFunction )
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
Host provides agent-wide operations and the active context for host calls. A Host must not be copied.
func (*Host) ActiveContext ¶
func (h *Host) ActiveContext() *ExecutionContext
ActiveContext returns the execution context for a host entry.
func (*Host) ActiveNativeState ¶
func (ag *Host) ActiveNativeState() any
ActiveNativeState returns the internal slots of the active native function.
func (*Host) AgentCanSuspend ¶
func (ag *Host) AgentCanSuspend() bool
AgentCanSuspend implements AgentCanSuspend.
func (*Host) AvailableDefaultLocale ¶
func (ag *Host) AvailableDefaultLocale() string
AvailableDefaultLocale returns the available locale of the default locale, or empty when it is not known.
func (*Host) AwaitJobs ¶
AwaitJobs waits for pending jobs, a waiter notification or a timeout. It returns false if there are no jobs or waiters, or an InterruptedError if interrupted.
func (*Host) CapabilityReject ¶
func (ag *Host) CapabilityReject(c *PromiseCapability) storage.Value
CapabilityReject returns the [[Reject]] function of c.
func (*Host) CapabilityResolve ¶
func (ag *Host) CapabilityResolve(c *PromiseCapability) storage.Value
CapabilityResolve returns the [[Resolve]] function of c.
func (*Host) ClearInterrupt ¶
func (ag *Host) ClearInterrupt()
ClearInterrupt withdraws a request of [agent.Interrupt] that no script has observed.
func (*Host) ContinuationData ¶
func (ag *Host) ContinuationData() any
ContinuationData returns the continuation data, the value of the host that promise reactions, awaits and FinalizationRegistry objects capture when they are made, and that their jobs run with.
func (*Host) CreateRealm ¶
func (ag *Host) CreateRealm(install func(*ExecutionContext)) *ExecutionContext
CreateRealm returns the context of a new realm after calling install with that context active.
func (*Host) DefaultLocale ¶
func (ag *Host) DefaultLocale() string
DefaultLocale returns the configured default locale, or empty for the host default.
func (*Host) DefaultTimeZone ¶
DefaultTimeZone returns the time zone of local time. It is the local time zone of the host unless [agent.SetDefaultTimeZone] changed it.
func (*Host) DeferUnhandledRejections ¶
func (ag *Host) DeferUnhandledRejections()
DeferUnhandledRejections postpones rejection reports across job checkpoints.
func (*Host) DisplayString ¶
DisplayString describes v for messages, without running any JavaScript. A long string is shortened.
func (*Host) GetNewTarget ¶
GetNewTarget implements GetNewTarget for the running native function: it returns the constructor the function is being constructed for, or nil when it was called.
func (*Host) HasCustomClock ¶
func (ag *Host) HasCustomClock() bool
HasCustomClock reports whether reading the clock calls a host function.
func (*Host) InitLazyObject ¶
InitLazyObject runs the init function of o, an object of ExecutionContext.NewLazyObject, unless it has run already.
func (*Host) Interrupt ¶
func (ag *Host) Interrupt(cause error)
Interrupt stops execution with an InterruptedError carrying cause at the next loop or call. It may be called from any goroutine and remains pending until observed or cleared. Interrupted module evaluations are rejected with an Error whose message is "ekuma: interrupted" and whose storage.GoError is cause, or the InterruptedError when cause is nil.
func (*Host) ModuleSourceClassName ¶
ModuleSourceClassName returns the [[ModuleSourceClassName]] of v. ok is false when v has no such slot.
func (*Host) Now ¶
The limits of the current time: the limits of time values, and of epoch nanoseconds of Temporal.Instant. Now returns the current time of the clock, clamped to the range of time values. It implements HostSystemUTCEpochNanoseconds.
func (*Host) Poll ¶
func (ag *Host) Poll()
Poll stops the script when an interruption was requested. It also takes the notifications of other agents, which raise the interrupt flag too. A loop calls it only between runs of many steps, such as storage.PollInterval steps.
func (*Host) PollAt ¶
func (ag *Host) PollAt(i int64)
PollAt calls [agent.Poll] when i ends a run of storage.PollInterval indices, so that a loop over consecutive indices checks for an interruption regularly.
func (*Host) PollStep ¶
func (ag *Host) PollStep()
PollStep calls [agent.Poll] when an interruption may be pending. It is for every step of a loop whose steps can be long, such as looking up a property in a long prototype chain.
func (*Host) RandomNumber ¶
func (ag *Host) RandomNumber() float64
RandomNumber returns a number in [0, 1) for Math.random. With a source, it is the number that rand.Rand.Float64 would return.
func (*Host) RecordStack ¶
RecordStack records the stack trace of the new error object e, whose message is msg in UTF-8, as what storage.ErrorStack returns. The running native function constructs e for newTarget: the trace leaves out that function, and the frames up to the call of newTarget when newTarget is running.
func (*Host) Running ¶
func (ag *Host) Running() bool
Running reports whether a call from Go into ag is running.
func (*Host) SetAgentCanSuspend ¶
func (ag *Host) SetAgentCanSuspend(canSuspend bool)
SetAgentCanSuspend sets whether the agent can suspend, which Atomics.wait requires. An agent that can suspend must not run on a thread that must not block.
func (*Host) SetAvailableDefaultLocale ¶
func (ag *Host) SetAvailableDefaultLocale(locale string)
SetAvailableDefaultLocale sets the available locale of the default locale, until [agent.SetDefaultLocale] changes that.
func (*Host) SetContinuationData ¶
func (ag *Host) SetContinuationData(data any)
SetContinuationData sets data as the continuation data.
func (*Host) SetDefaultLocale ¶
func (ag *Host) SetDefaultLocale(tag string)
SetDefaultLocale sets the default locale to a well-formed language tag or empty.
func (*Host) SetDefaultTimeZone ¶
SetDefaultTimeZone sets the time zone of local time to tz. A nil tz restores the local time zone of the host.
func (*Host) SetExtremum ¶
SetExtremum says that the native function f is Math.min or Math.max, as e names. The contract of its number kernels holds for what the interpreter computes.
func (*Host) SetFrameless ¶
SetFrameless makes calls of the native function f show no frame: stack traces leave them out, and the caller of a function that f calls is the one that called f.
func (*Host) SetHostGetImportMetaProperties ¶
func (ag *Host) SetHostGetImportMetaProperties(f HostGetImportMetaPropertiesFunc)
SetHostGetImportMetaProperties sets the implementation of HostGetImportMetaProperties. Without one, import.meta has no properties.
func (*Host) SetHostLoadImportedModule ¶
func (ag *Host) SetHostLoadImportedModule(f HostLoadImportedModuleFunc)
SetHostLoadImportedModule sets the implementation of HostLoadImportedModule. Without one, every import fails with a TypeError.
func (*Host) SetHostUnhandledRejection ¶
func (ag *Host) SetHostUnhandledRejection(f UnhandledRejectionFunc)
SetHostUnhandledRejection sets f as the function that is told about the unhandled rejections, in the order of rejection, after the jobs ran. f may call into ag. Without one, the unhandled rejections are discarded.
func (*Host) SetRandomSource ¶
SetRandomSource sets src as the source of [agent.RandomNumber]. A nil src restores the global source of math/rand/v2.
func (*Host) SystemUTCEpochMilliseconds ¶
func (ag *Host) SystemUTCEpochMilliseconds() float64
SystemUTCEpochMilliseconds returns the current time as a time value.
func (*Host) TakeUnhandledRejection ¶
TakeUnhandledRejection ends deferral, returning the first unhandled reason and clearing all reports.
type HostGetImportMetaPropertiesFunc ¶
type HostGetImportMetaPropertiesFunc func(cx *ExecutionContext, m *Module) []ImportMetaProperty
HostGetImportMetaPropertiesFunc implements HostGetImportMetaProperties: it returns the properties of the object import.meta of the module m, which is created then.
type HostLoadImportedModuleFunc ¶
type HostLoadImportedModuleFunc func(cx *ExecutionContext, referrer *Module, file string, referrerContext *ExecutionContext, req ModuleRequest) (*Module, error)
HostLoadImportedModuleFunc implements HostLoadImportedModule synchronously: it returns the module that the request req of the referrer resolves to. cx is the executing context. referrerContext is the context of the importing script, module, or realm. referrer is the importing module, or nil for a script or realm. file is the name of the script or module, or empty. The engine calls the loader at most once per successfully resolved request for a given referrer.
The error is an *storage.Error for a thrown value, a *SyntaxError, or any other error, which is thrown as an Error with its message.
type ImportAttribute ¶
ImportAttribute is an ImportAttribute Record.
type ImportMetaProperty ¶
ImportMetaProperty is a property that HostGetImportMetaProperties gives import.meta.
type InterruptedError ¶
type InterruptedError struct {
Cause error
}
InterruptedError reports the cause of an interruption by [agent.Interrupt].
func (*InterruptedError) Error ¶
func (e *InterruptedError) Error() string
func (*InterruptedError) Unwrap ¶
func (e *InterruptedError) Unwrap() error
type IteratorPairStepFunc ¶
IteratorPairStepFunc advances an entries iterator that yields pairs in its creation realm. It must decline incompatible state without advancing, and must neither throw nor run JavaScript.
type IteratorStepFunc ¶
IteratorStepFunc is the next method of a built-in iterator, without the iterator result: it returns the next value of the iterator this, or reports false when the iterator is done. It throws a TypeError when this is not an iterator of its kind.
type IteratorYieldRealm ¶
type IteratorYieldRealm uint8
IteratorYieldRealm identifies where a built-in iterator creates a yielded result.
const ( // IteratorMethodRealm is the realm of the next method. IteratorMethodRealm IteratorYieldRealm = iota // IteratorClosureRealm is the creation realm of an iterator produced by CreateIteratorFromClosure. IteratorClosureRealm )
type Kernels ¶
type Kernels struct {
// Number1 and Number2 stand for the calls with exactly one and two arguments that are numbers.
// They must return what the function returns for those arguments.
Number1 NumberKernel1
Number2 NumberKernel2
// Method0, Method1 and Method2 are tried for the calls with exactly no, one and two arguments.
// When they report true, the result must be what the function returns for the call.
Method0 MethodKernel0
Method1 MethodKernel1
Method2 MethodKernel2
// Contract is the contract of the kernels.
Contract ShortcutContract
}
Kernels are the kernels of a native function. Any of them may be nil.
type MethodKernel0 ¶
MethodKernel0, MethodKernel1 and MethodKernel2 compute a function for its this value and no, one or two arguments. They neither throw nor run code, and report false when the function has to be called instead.
type MethodKernel1 ¶
MethodKernel0, MethodKernel1 and MethodKernel2 compute a function for its this value and no, one or two arguments. They neither throw nor run code, and report false when the function has to be called instead.
type MethodKernel2 ¶
MethodKernel0, MethodKernel1 and MethodKernel2 compute a function for its this value and no, one or two arguments. They neither throw nor run code, and report false when the function has to be called instead.
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module is a Source Text Module Record or a Synthetic Module Record.
func (*Module) Evaluate ¶
Evaluate implements Evaluate, after Module.Link when m is not linked. It returns the promise of the evaluation. A failure to load or link, which comes before any module code runs, is reported as an *storage.Error.
func (*Module) GetModuleNamespace ¶
GetModuleNamespace implements GetModuleNamespace for the evaluation phase, after Module.Link when m is not linked. A thrown exception is reported as an *storage.Error.
func (*Module) HostDefined ¶
HostDefined returns the [[HostDefined]] of m.
func (*Module) Link ¶
Link implements Link, after Module.LoadRequestedModules when m is not loaded. Once m is linked, it does nothing. A thrown exception is reported as an *storage.Error.
func (*Module) LoadRequestedModules ¶
LoadRequestedModules implements LoadRequestedModules for a host whose loading completes synchronously: it loads the modules that m and its dependencies request. Once it has completed for m, it does nothing. A thrown exception is reported as an *storage.Error.
func (*Module) SetModuleSource ¶
SetModuleSource makes source, a module source object, the [[ModuleSource]] of m, which source phase imports of m give. m must not be a source text module.
type ModuleRequest ¶
type ModuleRequest struct {
Specifier wtf8.String
Attributes []ImportAttribute
}
ModuleRequest is a ModuleRequest Record. ModuleRequest.Attributes are sorted by key.
type NativeFunc ¶
NativeFunc is a function implemented in Go.
args is only valid until the function returns. An exception is thrown with the Throw methods of ExecutionContext, which do not return.
type NumberKernel1 ¶
NumberKernel1 and NumberKernel2 compute a function of one or two numbers. They neither throw nor run code.
type NumberKernel2 ¶
NumberKernel1 and NumberKernel2 compute a function of one or two numbers. They neither throw nor run code.
type Pacer ¶
type Pacer struct {
// contains filtered or unexported fields
}
Pacer counts the steps of a loop that runs no JavaScript and checks for an interruption every storage.PollInterval steps. The zero value is ready to use.
func (*Pacer) Step ¶
func (p *Pacer) Step(cx *ExecutionContext)
Step counts one step, and calls [agent.Poll] when a check is due.
func (*Pacer) Steps ¶
func (p *Pacer) Steps(cx *ExecutionContext, n int)
Steps counts n steps, and calls [agent.Poll] when a check is due.
type PanicError ¶
type PanicError struct {
// Value is the value of the panic.
Value any
}
PanicError is the cause of the end of the module evaluations that a Go panic passed through.
func (*PanicError) Error ¶
func (e *PanicError) Error() string
func (*PanicError) Unwrap ¶
func (e *PanicError) Unwrap() error
type PromiseCapability ¶
type PromiseCapability struct {
// contains filtered or unexported fields
}
PromiseCapability is a PromiseCapability Record.
func (*PromiseCapability) Promise ¶
func (c *PromiseCapability) Promise() storage.Value
Promise returns the [[Promise]] of c.
type PromiseState ¶
type PromiseState uint8
PromiseState is a value of [PromiseState].
const ( PromisePending PromiseState = iota PromiseFulfilled PromiseRejected )
func PromiseStateOf ¶
func PromiseStateOf(p storage.Value) (PromiseState, storage.Value)
PromiseStateOf returns the [PromiseState] and the [[PromiseResult]] of the promise p.
type PropertyCache ¶
type PropertyCache struct {
// contains filtered or unexported fields
}
PropertyCache remembers where ExecutionContext.GetVCached found a property, so that looking up the same key again on values with the same layout is fast. The zero value is empty.
type ResumeMode ¶
type ResumeMode uint8
ResumeMode is the way a suspended generator is continued.
const ( ResumeNext ResumeMode = bytecode.ResumeNext ResumeThrow ResumeMode = bytecode.ResumeThrow ResumeReturn ResumeMode = bytecode.ResumeReturn )
type Script ¶
type Script struct {
// contains filtered or unexported fields
}
Script is a Script Record.
func (*Script) CallScript ¶
CallScript evaluates s from a running host function and propagates its exception.
type ShortcutContract ¶
type ShortcutContract struct {
Frame ShortcutFrame
Pace ShortcutPace
}
ShortcutContract states what the forms of a native function that its callers use instead of calling it preserve of the call. The function shows a frame.
type ShortcutFrame ¶
type ShortcutFrame uint8
ShortcutFrame states how a shortcut accounts for the frame that calls of its function show.
const ( // FrameUndeclared is not a valid statement. FrameUndeclared ShortcutFrame = iota // FrameUnobservable says that nothing that the shortcut does can observe the frame: it // neither throws nor runs JavaScript or host code, and declines where the function may. FrameUnobservable // FrameRecorded says that the selected method records its frame around what can observe it. FrameRecorded )
type ShortcutPace ¶
type ShortcutPace uint8
ShortcutPace states how a shortcut accounts for the interruptions that its function takes.
const ( // PaceUndeclared is not a valid statement. PaceUndeclared ShortcutPace = iota // PaceShort says that the function takes no interruption where the shortcut does not // decline: it does a bounded number of operations on its operands. PaceShort // PacePolled says that the shortcut can run for a time that depends on the script, and // checks for an interruption as often as the function. PacePolled )
type SyntaxError ¶
type SyntaxError struct {
// File is the name of the script.
File string
// Line is the 1-based line of the error.
Line int
Message string
}
SyntaxError is a script that could not be parsed or compiled.
func (*SyntaxError) Error ¶
func (e *SyntaxError) Error() string
type SyntheticExport ¶ added in v0.2.0
SyntheticExport is an export name and its value in a synthetic module.
type UnboundModule ¶ added in v0.2.0
type UnboundModule struct {
// contains filtered or unexported fields
}
UnboundModule is a compiled source text module that can be bound by multiple agents.
func ParseUnboundModule ¶ added in v0.2.0
func ParseUnboundModule(file, src string) (*UnboundModule, error)
ParseUnboundModule parses src as a source text module for no particular agent.
type UnboundScript ¶
type UnboundScript struct {
// contains filtered or unexported fields
}
UnboundScript is a script parsed for no particular agent. Any number of agents may bind it with ExecutionContext.BindScript, also at the same time.
func ParseUnboundScript ¶
func ParseUnboundScript(file, src string) (*UnboundScript, error)
ParseUnboundScript parses src as the source text of a script for no particular agent. file names the script in error messages. The error is a *SyntaxError when src is not a valid script.
type UnhandledRejectionFunc ¶
type UnhandledRejectionFunc func(cx *ExecutionContext, promise, reason storage.Value)
UnhandledRejectionFunc is the type of the function that is told about a promise that was rejected with reason and has no handler.
Source Files
¶
- agent.go
- aliases.go
- arguments.go
- async.go
- atomics.go
- bigint.go
- binary.go
- clock.go
- concat.go
- concatmemo.go
- context.go
- conv.go
- decorator.go
- dispose.go
- enter.go
- eval.go
- generator.go
- host.go
- interp.go
- iter.go
- join.go
- legacy.go
- limits_notjs.go
- link.go
- locale.go
- module.go
- modulesource.go
- namespace.go
- natives.go
- nativetable.go
- object.go
- pace.go
- promise.go
- propkey.go
- props.go
- proxy.go
- push.go
- quiet.go
- realm.go
- regexp.go
- runtime.go
- script.go
- shadowrealm.go
- shortstring.go
- slots.go
- validate_off.go
- value.go
- weak.go