@@ -33,6 +33,10 @@ interface EventListenerOptions {
3333 capture ?: boolean ;
3434}
3535
36+ interface ExceptionOptions {
37+ traceStack ?: boolean ;
38+ }
39+
3640interface MessageEventInit < T = any > extends EventInit {
3741 data ?: T ;
3842 lastEventId ?: string ;
@@ -128,6 +132,10 @@ interface StructuredSerializeOptions {
128132 transfer ?: Transferable [ ] ;
129133}
130134
135+ interface TagType {
136+ parameters : ValueType [ ] ;
137+ }
138+
131139interface TextDecodeOptions {
132140 stream ?: boolean ;
133141}
@@ -181,6 +189,11 @@ interface UnderlyingSource<R = any> {
181189 type ?: ReadableStreamType ;
182190}
183191
192+ interface WebAssemblyCompileOptions {
193+ builtins ?: string [ ] ;
194+ importedStringConstants ?: string | null ;
195+ }
196+
184197/**
185198 * The **`AbortController`** interface represents a controller object that allows you to abort one or more Web requests as and when desired.
186199 *
@@ -1543,6 +1556,37 @@ declare namespace WebAssembly {
15431556 ( message ?: string ) : CompileError ;
15441557 } ;
15451558
1559+ /**
1560+ * The **`WebAssembly.Exception`** object represents a runtime exception thrown from WebAssembly to JavaScript, or thrown from JavaScript to a WebAssembly exception handler.
1561+ *
1562+ * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Exception)
1563+ */
1564+ interface Exception {
1565+ /**
1566+ * The read-only **`stack`** property of an object instance of type `WebAssembly.Exception` _may_ contain a stack trace.
1567+ *
1568+ * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Exception/stack)
1569+ */
1570+ readonly stack : string | undefined ;
1571+ /**
1572+ * The **`getArg()`** prototype method of the `Exception` object can be used to get the value of a specified item in the exception's data arguments.
1573+ *
1574+ * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Exception/getArg)
1575+ */
1576+ getArg ( index : number ) : any ;
1577+ /**
1578+ * The **`is()`** prototype method of the `Exception` object can be used to test if the `Exception` matches a given tag.
1579+ *
1580+ * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Exception/is)
1581+ */
1582+ is ( exceptionTag : Tag ) : boolean ;
1583+ }
1584+
1585+ var Exception : {
1586+ prototype : Exception ;
1587+ new ( exceptionTag : Tag , payload : any [ ] , options ?: ExceptionOptions ) : Exception ;
1588+ } ;
1589+
15461590 /**
15471591 * A **`WebAssembly.Global`** object represents a global variable instance, accessible from both JavaScript and importable/exportable across one or more `WebAssembly.Module` instances.
15481592 *
@@ -1603,7 +1647,7 @@ declare namespace WebAssembly {
16031647 *
16041648 * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Memory/grow)
16051649 */
1606- grow ( delta : number ) : number ;
1650+ grow ( delta : AddressValue ) : AddressValue ;
16071651 }
16081652
16091653 var Memory : {
@@ -1621,7 +1665,7 @@ declare namespace WebAssembly {
16211665
16221666 var Module : {
16231667 prototype : Module ;
1624- new ( bytes : BufferSource ) : Module ;
1668+ new ( bytes : BufferSource , options ?: WebAssemblyCompileOptions ) : Module ;
16251669 /**
16261670 * The **`WebAssembly.Module.customSections()`** static method returns a copy of the contents of all custom sections in the given module with the given string name.
16271671 *
@@ -1662,40 +1706,54 @@ declare namespace WebAssembly {
16621706 *
16631707 * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Table/length)
16641708 */
1665- readonly length : number ;
1709+ readonly length : AddressValue ;
16661710 /**
16671711 * The **`get()`** prototype method of the `WebAssembly.Table()` object retrieves the element stored at a given index.
16681712 *
16691713 * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Table/get)
16701714 */
1671- get ( index : number ) : any ;
1715+ get ( index : AddressValue ) : any ;
16721716 /**
16731717 * The **`grow()`** prototype method of the `WebAssembly.Table` object increases the size of the `Table` instance by a specified number of elements, filled with the provided value.
16741718 *
16751719 * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Table/grow)
16761720 */
1677- grow ( delta : number , value ?: any ) : number ;
1721+ grow ( delta : AddressValue , value ?: any ) : AddressValue ;
16781722 /**
16791723 * The **`set()`** prototype method of the `WebAssembly.Table` object mutates a reference stored at a given index to a different value.
16801724 *
16811725 * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Table/set)
16821726 */
1683- set ( index : number , value ?: any ) : void ;
1727+ set ( index : AddressValue , value ?: any ) : void ;
16841728 }
16851729
16861730 var Table : {
16871731 prototype : Table ;
16881732 new ( descriptor : TableDescriptor , value ?: any ) : Table ;
16891733 } ;
16901734
1735+ /**
1736+ * The **`WebAssembly.Tag`** object defines a _type_ of a WebAssembly exception that can be thrown to/from WebAssembly code.
1737+ *
1738+ * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Tag)
1739+ */
1740+ interface Tag {
1741+ }
1742+
1743+ var Tag : {
1744+ prototype : Tag ;
1745+ new ( type : TagType ) : Tag ;
1746+ } ;
1747+
16911748 interface GlobalDescriptor < T extends ValueType = ValueType > {
16921749 mutable ?: boolean ;
16931750 value : T ;
16941751 }
16951752
16961753 interface MemoryDescriptor {
1697- initial : number ;
1698- maximum ?: number ;
1754+ address ?: AddressType ;
1755+ initial : AddressValue ;
1756+ maximum ?: AddressValue ;
16991757 shared ?: boolean ;
17001758 }
17011759
@@ -1711,9 +1769,10 @@ declare namespace WebAssembly {
17111769 }
17121770
17131771 interface TableDescriptor {
1772+ address ?: AddressType ;
17141773 element : TableKind ;
1715- initial : number ;
1716- maximum ?: number ;
1774+ initial : AddressValue ;
1775+ maximum ?: AddressValue ;
17171776 }
17181777
17191778 interface ValueTypeMap {
@@ -1731,21 +1790,22 @@ declare namespace WebAssembly {
17311790 module : Module ;
17321791 }
17331792
1734- type ImportExportKind = "function" | "global" | "memory" | "table" ;
1793+ type ImportExportKind = "function" | "global" | "memory" | "table" | "tag" ;
17351794 type TableKind = "anyfunc" | "externref" ;
17361795 type ExportValue = Function | Global | Memory | Table ;
17371796 type Exports = Record < string , ExportValue > ;
17381797 type ImportValue = ExportValue | number ;
17391798 type Imports = Record < string , ModuleImports > ;
17401799 type ModuleImports = Record < string , ImportValue > ;
17411800 type ValueType = keyof ValueTypeMap ;
1801+ var JSTag : Tag ;
17421802 /** [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/compile_static) */
1743- function compile ( bytes : BufferSource ) : Promise < Module > ;
1803+ function compile ( bytes : BufferSource , options ?: WebAssemblyCompileOptions ) : Promise < Module > ;
17441804 /** [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/instantiate_static) */
1745- function instantiate ( bytes : BufferSource , importObject ?: Imports ) : Promise < WebAssemblyInstantiatedSource > ;
1805+ function instantiate ( bytes : BufferSource , importObject ?: Imports , options ?: WebAssemblyCompileOptions ) : Promise < WebAssemblyInstantiatedSource > ;
17461806 function instantiate ( moduleObject : Module , importObject ?: Imports ) : Promise < Instance > ;
17471807 /** [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/validate_static) */
1748- function validate ( bytes : BufferSource ) : boolean ;
1808+ function validate ( bytes : BufferSource , options ?: WebAssemblyCompileOptions ) : boolean ;
17491809}
17501810
17511811/** The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). */
@@ -1946,6 +2006,7 @@ declare var sampleRate: number;
19462006 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletGlobalScope/registerProcessor)
19472007 */
19482008declare function registerProcessor ( name : string , processorCtor : AudioWorkletProcessorConstructor ) : void ;
2009+ type AddressValue = any ;
19492010type AllowSharedBufferSource = ArrayBufferLike | ArrayBufferView < ArrayBufferLike > ;
19502011type BufferSource = ArrayBufferView < ArrayBuffer > | ArrayBuffer ;
19512012type DOMHighResTimeStamp = number ;
@@ -1955,6 +2016,7 @@ type ReadableStreamController<T> = ReadableStreamDefaultController<T> | Readable
19552016type ReadableStreamReadResult < T > = ReadableStreamReadValueResult < T > | ReadableStreamReadDoneResult < T > ;
19562017type ReadableStreamReader < T > = ReadableStreamDefaultReader < T > | ReadableStreamBYOBReader ;
19572018type Transferable = MessagePort | ReadableStream | WritableStream | TransformStream | ArrayBuffer ;
2019+ type AddressType = "i32" | "i64" ;
19582020type CompressionFormat = "deflate" | "deflate-raw" | "gzip" ;
19592021type ReadableStreamReaderMode = "byob" ;
19602022type ReadableStreamType = "bytes" ;
0 commit comments