@@ -33,6 +33,10 @@ interface EventListenerOptions {
33
33
capture ?: boolean ;
34
34
}
35
35
36
+ interface ExceptionOptions {
37
+ traceStack ?: boolean ;
38
+ }
39
+
36
40
interface MessageEventInit < T = any > extends EventInit {
37
41
data ?: T ;
38
42
lastEventId ?: string ;
@@ -128,6 +132,10 @@ interface StructuredSerializeOptions {
128
132
transfer ?: Transferable [ ] ;
129
133
}
130
134
135
+ interface TagType {
136
+ parameters : ValueType [ ] ;
137
+ }
138
+
131
139
interface TextDecodeOptions {
132
140
stream ?: boolean ;
133
141
}
@@ -181,6 +189,11 @@ interface UnderlyingSource<R = any> {
181
189
type ?: ReadableStreamType ;
182
190
}
183
191
192
+ interface WebAssemblyCompileOptions {
193
+ builtins ?: string [ ] ;
194
+ importedStringConstants ?: string | null ;
195
+ }
196
+
184
197
/**
185
198
* The **`AbortController`** interface represents a controller object that allows you to abort one or more Web requests as and when desired.
186
199
*
@@ -1543,6 +1556,37 @@ declare namespace WebAssembly {
1543
1556
( message ?: string ) : CompileError ;
1544
1557
} ;
1545
1558
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
+
1546
1590
/**
1547
1591
* A **`WebAssembly.Global`** object represents a global variable instance, accessible from both JavaScript and importable/exportable across one or more `WebAssembly.Module` instances.
1548
1592
*
@@ -1603,7 +1647,7 @@ declare namespace WebAssembly {
1603
1647
*
1604
1648
* [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Memory/grow)
1605
1649
*/
1606
- grow ( delta : number ) : number ;
1650
+ grow ( delta : AddressValue ) : AddressValue ;
1607
1651
}
1608
1652
1609
1653
var Memory : {
@@ -1621,7 +1665,7 @@ declare namespace WebAssembly {
1621
1665
1622
1666
var Module : {
1623
1667
prototype : Module ;
1624
- new ( bytes : BufferSource ) : Module ;
1668
+ new ( bytes : BufferSource , options ?: WebAssemblyCompileOptions ) : Module ;
1625
1669
/**
1626
1670
* 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.
1627
1671
*
@@ -1662,40 +1706,54 @@ declare namespace WebAssembly {
1662
1706
*
1663
1707
* [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Table/length)
1664
1708
*/
1665
- readonly length : number ;
1709
+ readonly length : AddressValue ;
1666
1710
/**
1667
1711
* The **`get()`** prototype method of the `WebAssembly.Table()` object retrieves the element stored at a given index.
1668
1712
*
1669
1713
* [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Table/get)
1670
1714
*/
1671
- get ( index : number ) : any ;
1715
+ get ( index : AddressValue ) : any ;
1672
1716
/**
1673
1717
* 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.
1674
1718
*
1675
1719
* [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Table/grow)
1676
1720
*/
1677
- grow ( delta : number , value ?: any ) : number ;
1721
+ grow ( delta : AddressValue , value ?: any ) : AddressValue ;
1678
1722
/**
1679
1723
* The **`set()`** prototype method of the `WebAssembly.Table` object mutates a reference stored at a given index to a different value.
1680
1724
*
1681
1725
* [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Table/set)
1682
1726
*/
1683
- set ( index : number , value ?: any ) : void ;
1727
+ set ( index : AddressValue , value ?: any ) : void ;
1684
1728
}
1685
1729
1686
1730
var Table : {
1687
1731
prototype : Table ;
1688
1732
new ( descriptor : TableDescriptor , value ?: any ) : Table ;
1689
1733
} ;
1690
1734
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
+
1691
1748
interface GlobalDescriptor < T extends ValueType = ValueType > {
1692
1749
mutable ?: boolean ;
1693
1750
value : T ;
1694
1751
}
1695
1752
1696
1753
interface MemoryDescriptor {
1697
- initial : number ;
1698
- maximum ?: number ;
1754
+ address ?: AddressType ;
1755
+ initial : AddressValue ;
1756
+ maximum ?: AddressValue ;
1699
1757
shared ?: boolean ;
1700
1758
}
1701
1759
@@ -1711,9 +1769,10 @@ declare namespace WebAssembly {
1711
1769
}
1712
1770
1713
1771
interface TableDescriptor {
1772
+ address ?: AddressType ;
1714
1773
element : TableKind ;
1715
- initial : number ;
1716
- maximum ?: number ;
1774
+ initial : AddressValue ;
1775
+ maximum ?: AddressValue ;
1717
1776
}
1718
1777
1719
1778
interface ValueTypeMap {
@@ -1731,21 +1790,22 @@ declare namespace WebAssembly {
1731
1790
module : Module ;
1732
1791
}
1733
1792
1734
- type ImportExportKind = "function" | "global" | "memory" | "table" ;
1793
+ type ImportExportKind = "function" | "global" | "memory" | "table" | "tag" ;
1735
1794
type TableKind = "anyfunc" | "externref" ;
1736
1795
type ExportValue = Function | Global | Memory | Table ;
1737
1796
type Exports = Record < string , ExportValue > ;
1738
1797
type ImportValue = ExportValue | number ;
1739
1798
type Imports = Record < string , ModuleImports > ;
1740
1799
type ModuleImports = Record < string , ImportValue > ;
1741
1800
type ValueType = keyof ValueTypeMap ;
1801
+ var JSTag : Tag ;
1742
1802
/** [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 > ;
1744
1804
/** [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 > ;
1746
1806
function instantiate ( moduleObject : Module , importObject ?: Imports ) : Promise < Instance > ;
1747
1807
/** [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 ;
1749
1809
}
1750
1810
1751
1811
/** The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). */
@@ -1946,6 +2006,7 @@ declare var sampleRate: number;
1946
2006
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletGlobalScope/registerProcessor)
1947
2007
*/
1948
2008
declare function registerProcessor ( name : string , processorCtor : AudioWorkletProcessorConstructor ) : void ;
2009
+ type AddressValue = any ;
1949
2010
type AllowSharedBufferSource = ArrayBufferLike | ArrayBufferView < ArrayBufferLike > ;
1950
2011
type BufferSource = ArrayBufferView < ArrayBuffer > | ArrayBuffer ;
1951
2012
type DOMHighResTimeStamp = number ;
@@ -1955,6 +2016,7 @@ type ReadableStreamController<T> = ReadableStreamDefaultController<T> | Readable
1955
2016
type ReadableStreamReadResult < T > = ReadableStreamReadValueResult < T > | ReadableStreamReadDoneResult < T > ;
1956
2017
type ReadableStreamReader < T > = ReadableStreamDefaultReader < T > | ReadableStreamBYOBReader ;
1957
2018
type Transferable = MessagePort | ReadableStream | WritableStream | TransformStream | ArrayBuffer ;
2019
+ type AddressType = "i32" | "i64" ;
1958
2020
type CompressionFormat = "deflate" | "deflate-raw" | "gzip" ;
1959
2021
type ReadableStreamReaderMode = "byob" ;
1960
2022
type ReadableStreamType = "bytes" ;
0 commit comments