@@ -1543,6 +1543,37 @@ declare namespace WebAssembly {
1543
1543
( message ?: string ) : CompileError ;
1544
1544
} ;
1545
1545
1546
+ /**
1547
+ * The **`WebAssembly.Exception`** object represents a runtime exception thrown from WebAssembly to JavaScript, or thrown from JavaScript to a WebAssembly exception handler.
1548
+ *
1549
+ * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Exception)
1550
+ */
1551
+ interface Exception {
1552
+ /**
1553
+ * The read-only **`stack`** property of an object instance of type WebAssembly.Exception may contain a stack trace.
1554
+ *
1555
+ * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Exception/stack)
1556
+ */
1557
+ readonly stack : string | undefined ;
1558
+ /**
1559
+ * 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.
1560
+ *
1561
+ * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Exception/getArg)
1562
+ */
1563
+ getArg ( index : number ) : any ;
1564
+ /**
1565
+ * The **`is()`** prototype method of the Exception object can be used to test if the Exception matches a given tag.
1566
+ *
1567
+ * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Exception/is)
1568
+ */
1569
+ is ( exceptionTag : Tag ) : boolean ;
1570
+ }
1571
+
1572
+ var Exception : {
1573
+ prototype : Exception ;
1574
+ new ( exceptionTag : Tag , payload : any [ ] , options ?: ExceptionOptions ) : Exception ;
1575
+ } ;
1576
+
1546
1577
/**
1547
1578
* A **`WebAssembly.Global`** object represents a global variable instance, accessible from both JavaScript and importable/exportable across one or more WebAssembly.Module instances. This allows dynamic linking of multiple modules.
1548
1579
*
@@ -1603,7 +1634,7 @@ declare namespace WebAssembly {
1603
1634
*
1604
1635
* [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Memory/grow)
1605
1636
*/
1606
- grow ( delta : number ) : number ;
1637
+ grow ( delta : AddressValue ) : AddressValue ;
1607
1638
}
1608
1639
1609
1640
var Memory : {
@@ -1621,7 +1652,7 @@ declare namespace WebAssembly {
1621
1652
1622
1653
var Module : {
1623
1654
prototype : Module ;
1624
- new ( bytes : BufferSource ) : Module ;
1655
+ new ( bytes : BufferSource , options ?: WebAssemblyCompileOptions ) : Module ;
1625
1656
/**
1626
1657
* 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
1658
*
@@ -1662,40 +1693,58 @@ declare namespace WebAssembly {
1662
1693
*
1663
1694
* [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Table/length)
1664
1695
*/
1665
- readonly length : number ;
1696
+ readonly length : AddressValue ;
1666
1697
/**
1667
1698
* The **`get()`** prototype method of the WebAssembly.Table() object retrieves the element stored at a given index.
1668
1699
*
1669
1700
* [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Table/get)
1670
1701
*/
1671
- get ( index : number ) : any ;
1702
+ get ( index : AddressValue ) : any ;
1672
1703
/**
1673
1704
* 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
1705
*
1675
1706
* [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Table/grow)
1676
1707
*/
1677
- grow ( delta : number , value ?: any ) : number ;
1708
+ grow ( delta : AddressValue , value ?: any ) : AddressValue ;
1678
1709
/**
1679
1710
* The **`set()`** prototype method of the WebAssembly.Table object mutates a reference stored at a given index to a different value.
1680
1711
*
1681
1712
* [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Table/set)
1682
1713
*/
1683
- set ( index : number , value ?: any ) : void ;
1714
+ set ( index : AddressValue , value ?: any ) : void ;
1684
1715
}
1685
1716
1686
1717
var Table : {
1687
1718
prototype : Table ;
1688
1719
new ( descriptor : TableDescriptor , value ?: any ) : Table ;
1689
1720
} ;
1690
1721
1722
+ /**
1723
+ * The **`WebAssembly.Tag`** object defines a type of a WebAssembly exception that can be thrown to/from WebAssembly code.
1724
+ *
1725
+ * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Tag)
1726
+ */
1727
+ interface Tag {
1728
+ }
1729
+
1730
+ var Tag : {
1731
+ prototype : Tag ;
1732
+ new ( type : TagType ) : Tag ;
1733
+ } ;
1734
+
1735
+ interface ExceptionOptions {
1736
+ traceStack ?: boolean ;
1737
+ }
1738
+
1691
1739
interface GlobalDescriptor < T extends ValueType = ValueType > {
1692
1740
mutable ?: boolean ;
1693
1741
value : T ;
1694
1742
}
1695
1743
1696
1744
interface MemoryDescriptor {
1697
- initial : number ;
1698
- maximum ?: number ;
1745
+ address ?: AddressType ;
1746
+ initial : AddressValue ;
1747
+ maximum ?: AddressValue ;
1699
1748
shared ?: boolean ;
1700
1749
}
1701
1750
@@ -1711,9 +1760,14 @@ declare namespace WebAssembly {
1711
1760
}
1712
1761
1713
1762
interface TableDescriptor {
1763
+ address ?: AddressType ;
1714
1764
element : TableKind ;
1715
- initial : number ;
1716
- maximum ?: number ;
1765
+ initial : AddressValue ;
1766
+ maximum ?: AddressValue ;
1767
+ }
1768
+
1769
+ interface TagType {
1770
+ parameters : ValueType [ ] ;
1717
1771
}
1718
1772
1719
1773
interface ValueTypeMap {
@@ -1726,26 +1780,34 @@ declare namespace WebAssembly {
1726
1780
v128 : never ;
1727
1781
}
1728
1782
1783
+ interface WebAssemblyCompileOptions {
1784
+ builtins ?: string [ ] ;
1785
+ importedStringConstants ?: string | null ;
1786
+ }
1787
+
1729
1788
interface WebAssemblyInstantiatedSource {
1730
1789
instance : Instance ;
1731
1790
module : Module ;
1732
1791
}
1733
1792
1734
- type ImportExportKind = "function" | "global" | "memory" | "table" ;
1793
+ type AddressType = "i32" | "i64" ;
1794
+ type ImportExportKind = "function" | "global" | "memory" | "table" | "tag" ;
1735
1795
type TableKind = "anyfunc" | "externref" ;
1796
+ type AddressValue = number ;
1736
1797
type ExportValue = Function | Global | Memory | Table ;
1737
1798
type Exports = Record < string , ExportValue > ;
1738
1799
type ImportValue = ExportValue | number ;
1739
1800
type Imports = Record < string , ModuleImports > ;
1740
1801
type ModuleImports = Record < string , ImportValue > ;
1741
1802
type ValueType = keyof ValueTypeMap ;
1803
+ var JSTag : Tag ;
1742
1804
/** [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/compile_static) */
1743
- function compile ( bytes : BufferSource ) : Promise < Module > ;
1805
+ function compile ( bytes : BufferSource , options ?: WebAssemblyCompileOptions ) : Promise < Module > ;
1744
1806
/** [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/instantiate_static) */
1745
- function instantiate ( bytes : BufferSource , importObject ?: Imports ) : Promise < WebAssemblyInstantiatedSource > ;
1807
+ function instantiate ( bytes : BufferSource , importObject ?: Imports , options ?: WebAssemblyCompileOptions ) : Promise < WebAssemblyInstantiatedSource > ;
1746
1808
function instantiate ( moduleObject : Module , importObject ?: Imports ) : Promise < Instance > ;
1747
1809
/** [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/validate_static) */
1748
- function validate ( bytes : BufferSource ) : boolean ;
1810
+ function validate ( bytes : BufferSource , options ?: WebAssemblyCompileOptions ) : boolean ;
1749
1811
}
1750
1812
1751
1813
/** The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). */
0 commit comments