Skip to content

Commit 0268fd4

Browse files
committed
Upgrade WebAssembly JS IDLs
Also adds WebAssembly Web APIs for `instantiateStreaming` and `compileStreaming` (which are now stable).
1 parent 353a0cf commit 0268fd4

File tree

5 files changed

+37
-15
lines changed

5 files changed

+37
-15
lines changed

baselines/dom.generated.d.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19039,7 +19039,7 @@ declare namespace WebAssembly {
1903919039

1904019040
var Global: {
1904119041
prototype: Global;
19042-
new(descriptor: GlobalDescriptor, value?: any): Global;
19042+
new(descriptor: GlobalDescriptor, v?: any): Global;
1904319043
};
1904419044

1904519045
interface Instance {
@@ -19075,9 +19075,9 @@ declare namespace WebAssembly {
1907519075
var Module: {
1907619076
prototype: Module;
1907719077
new(bytes: BufferSource): Module;
19078-
customSections(module: Module, sectionName: string): ArrayBuffer[];
19079-
exports(module: Module): ModuleExportDescriptor[];
19080-
imports(module: Module): ModuleImportDescriptor[];
19078+
customSections(moduleObject: Module, sectionName: string): ArrayBuffer[];
19079+
exports(moduleObject: Module): ModuleExportDescriptor[];
19080+
imports(moduleObject: Module): ModuleImportDescriptor[];
1908119081
};
1908219082

1908319083
interface RuntimeError {
@@ -19102,7 +19102,7 @@ declare namespace WebAssembly {
1910219102

1910319103
interface GlobalDescriptor {
1910419104
mutable?: boolean;
19105-
value: string;
19105+
value: ValueType;
1910619106
}
1910719107

1910819108
interface MemoryDescriptor {
@@ -19135,8 +19135,10 @@ declare namespace WebAssembly {
1913519135
type ImportExportKind = "function" | "table" | "memory" | "global";
1913619136
type TableKind = "anyfunc";
1913719137
function compile(bytes: BufferSource): Promise<Module>;
19138+
function compileStreaming(source: Response | Promise<Response>): Promise<Module>;
1913819139
function instantiate(bytes: BufferSource, importObject?: any): Promise<WebAssemblyInstantiatedSource>;
1913919140
function instantiate(moduleObject: Module, importObject?: any): Promise<Instance>;
19141+
function instantiateStreaming(source: Response | Promise<Response>, importObject?: any): Promise<WebAssemblyInstantiatedSource>;
1914019142
function validate(bytes: BufferSource): boolean;
1914119143
}
1914219144

@@ -20095,6 +20097,7 @@ type TouchType = "direct" | "stylus";
2009520097
type Transport = "usb" | "nfc" | "ble";
2009620098
type UserVerificationRequirement = "required" | "preferred" | "discouraged";
2009720099
type VRDisplayEventReason = "mounted" | "navigation" | "requested" | "unmounted";
20100+
type ValueType = "i32" | "i64" | "f32" | "f64";
2009820101
type VideoFacingModeEnum = "user" | "environment" | "left" | "right";
2009920102
type VisibilityState = "hidden" | "visible" | "prerender";
2010020103
type WebGLPowerPreference = "default" | "low-power" | "high-performance";

baselines/webworker.generated.d.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5600,7 +5600,7 @@ declare namespace WebAssembly {
56005600

56015601
var Global: {
56025602
prototype: Global;
5603-
new(descriptor: GlobalDescriptor, value?: any): Global;
5603+
new(descriptor: GlobalDescriptor, v?: any): Global;
56045604
};
56055605

56065606
interface Instance {
@@ -5628,9 +5628,9 @@ declare namespace WebAssembly {
56285628
var Module: {
56295629
prototype: Module;
56305630
new(bytes: BufferSource): Module;
5631-
customSections(module: Module, sectionName: string): ArrayBuffer[];
5632-
exports(module: Module): ModuleExportDescriptor[];
5633-
imports(module: Module): ModuleImportDescriptor[];
5631+
customSections(moduleObject: Module, sectionName: string): ArrayBuffer[];
5632+
exports(moduleObject: Module): ModuleExportDescriptor[];
5633+
imports(moduleObject: Module): ModuleImportDescriptor[];
56345634
};
56355635

56365636
interface Table {
@@ -5647,7 +5647,7 @@ declare namespace WebAssembly {
56475647

56485648
interface GlobalDescriptor {
56495649
mutable?: boolean;
5650-
value: string;
5650+
value: ValueType;
56515651
}
56525652

56535653
interface MemoryDescriptor {
@@ -5680,8 +5680,10 @@ declare namespace WebAssembly {
56805680
type ImportExportKind = "function" | "table" | "memory" | "global";
56815681
type TableKind = "anyfunc";
56825682
function compile(bytes: BufferSource): Promise<Module>;
5683+
function compileStreaming(source: Response | Promise<Response>): Promise<Module>;
56835684
function instantiate(bytes: BufferSource, importObject?: any): Promise<WebAssemblyInstantiatedSource>;
56845685
function instantiate(moduleObject: Module, importObject?: any): Promise<Instance>;
5686+
function instantiateStreaming(source: Response | Promise<Response>, importObject?: any): Promise<WebAssemblyInstantiatedSource>;
56855687
function validate(bytes: BufferSource): boolean;
56865688
}
56875689

@@ -5855,6 +5857,7 @@ type RequestRedirect = "follow" | "error" | "manual";
58555857
type ResponseType = "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect";
58565858
type ServiceWorkerState = "installing" | "installed" | "activating" | "activated" | "redundant";
58575859
type ServiceWorkerUpdateViaCache = "imports" | "all" | "none";
5860+
type ValueType = "i32" | "i64" | "f32" | "f64";
58585861
type VisibilityState = "hidden" | "visible" | "prerender";
58595862
type WebGLPowerPreference = "default" | "low-power" | "high-performance";
58605863
type WorkerType = "classic" | "module";

inputfiles/idl/WebAssembly JavaScript Interface.widl

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ dictionary ModuleImportDescriptor {
3636

3737
[LegacyNamespace=WebAssembly, Constructor(BufferSource bytes), Exposed=(Window,Worker,Worklet)]
3838
interface Module {
39-
static sequence<ModuleExportDescriptor> exports(Module module);
40-
static sequence<ModuleImportDescriptor> imports(Module module);
41-
static sequence<ArrayBuffer> customSections(Module module, USVString sectionName);
39+
static sequence<ModuleExportDescriptor> exports(Module moduleObject);
40+
static sequence<ModuleImportDescriptor> imports(Module moduleObject);
41+
static sequence<ArrayBuffer> customSections(Module moduleObject, DOMString sectionName);
4242
};
4343

4444
[LegacyNamespace=WebAssembly, Constructor(Module module, optional object importObject), Exposed=(Window,Worker,Worklet)]
@@ -77,12 +77,19 @@ interface Table {
7777
readonly attribute unsigned long length;
7878
};
7979

80+
enum ValueType {
81+
"i32",
82+
"i64",
83+
"f32",
84+
"f64"
85+
};
86+
8087
dictionary GlobalDescriptor {
81-
required USVString value;
88+
required ValueType value;
8289
boolean mutable = false;
8390
};
8491

85-
[LegacyNamespace=WebAssembly, Constructor(GlobalDescriptor descriptor, optional any value), Exposed=(Window,Worker,Worklet)]
92+
[LegacyNamespace=WebAssembly, Constructor(GlobalDescriptor descriptor, optional any v), Exposed=(Window,Worker,Worklet)]
8693
interface Global {
8794
any valueOf();
8895
attribute any value;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
partial namespace WebAssembly {
2+
Promise<Module> compileStreaming(Promise<Response> source);
3+
Promise<WebAssemblyInstantiatedSource> instantiateStreaming(
4+
Promise<Response> source, optional object importObject);
5+
};

inputfiles/idlSources.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,10 @@
375375
"url": "https://www.w3.org/TR/wasm-js-api-1/",
376376
"title": "WebAssembly JavaScript Interface"
377377
},
378+
{
379+
"url": "https://www.w3.org/TR/wasm-web-api-1/",
380+
"title": "WebAssembly Web API"
381+
},
378382
{
379383
"url": "https://webaudio.github.io/web-audio-api/",
380384
"title": "Web Audio"

0 commit comments

Comments
 (0)