From 3bd49884583dd0ca70f36c095c43376c5c00a971 Mon Sep 17 00:00:00 2001 From: ExE Boss Date: Fri, 24 Sep 2021 19:30:00 +0200 Subject: [PATCH 1/3] =?UTF-8?q?feat(WebAssembly):=20Make=C2=A0`WebAssembly?= =?UTF-8?q?.Global`=C2=A0generic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- baselines/audioworklet.generated.d.ts | 23 ++++++++---- baselines/dom.generated.d.ts | 39 ++++++++++++++------ baselines/serviceworker.generated.d.ts | 23 ++++++++---- baselines/sharedworker.generated.d.ts | 23 ++++++++---- baselines/webworker.generated.d.ts | 23 ++++++++---- inputfiles/addedTypes.jsonc | 44 +++++++++++++++++++++++ inputfiles/knownTypes.json | 7 ++-- inputfiles/overridingTypes.jsonc | 50 +++++++++++++++++++++++--- inputfiles/removedTypes.jsonc | 3 +- 9 files changed, 189 insertions(+), 46 deletions(-) diff --git a/baselines/audioworklet.generated.d.ts b/baselines/audioworklet.generated.d.ts index 3e35cbdf6..c7575c2ac 100644 --- a/baselines/audioworklet.generated.d.ts +++ b/baselines/audioworklet.generated.d.ts @@ -439,14 +439,14 @@ declare namespace WebAssembly { (message?: string): CompileError; }; - interface Global { - value: any; - valueOf(): any; + interface Global { + value: ValueTypeMap[T]; + valueOf(): ValueTypeMap[T]; } var Global: { prototype: Global; - new(descriptor: GlobalDescriptor, v?: any): Global; + new(descriptor: GlobalDescriptor, v?: ValueTypeMap[T]): Global; }; interface Instance { @@ -509,9 +509,9 @@ declare namespace WebAssembly { new(descriptor: TableDescriptor, value?: any): Table; }; - interface GlobalDescriptor { + interface GlobalDescriptor { mutable?: boolean; - value: ValueType; + value: T; } interface MemoryDescriptor { @@ -537,6 +537,15 @@ declare namespace WebAssembly { maximum?: number; } + interface ValueTypeMap { + anyfunc: Function; + externref: any; + f32: number; + f64: number; + i32: number; + i64: bigint; + } + interface WebAssemblyInstantiatedSource { instance: Instance; module: Module; @@ -544,12 +553,12 @@ declare namespace WebAssembly { type ImportExportKind = "function" | "global" | "memory" | "table"; type TableKind = "anyfunc" | "externref"; - type ValueType = "anyfunc" | "externref" | "f32" | "f64" | "i32" | "i64"; type ExportValue = Function | Global | Memory | Table; type Exports = Record; type ImportValue = ExportValue | number; type Imports = Record; type ModuleImports = Record; + type ValueType = keyof ValueTypeMap; function compile(bytes: BufferSource): Promise; function instantiate(bytes: BufferSource, importObject?: Imports): Promise; function instantiate(moduleObject: Module, importObject?: Imports): Promise; diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index 1756cabaa..f8af1816f 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -1936,7 +1936,7 @@ interface AnimationEventMap { } interface Animation extends EventTarget { - currentTime: number | null; + currentTime: CSSNumberish | null; effect: AnimationEffect | null; readonly finished: Promise; id: string; @@ -1948,7 +1948,7 @@ interface Animation extends EventTarget { playbackRate: number; readonly ready: Promise; readonly replaceState: AnimationReplaceState; - startTime: number | null; + startTime: CSSNumberish | null; timeline: AnimationTimeline | null; cancel(): void; commitStyles(): void; @@ -5652,7 +5652,7 @@ interface GlobalEventHandlers { * @param ev The event. */ onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** @deprecated This is a legacy alias of `onanimationend`. */ + /** @deprecated This is a legacy alias of `onanimationstart`. */ onwebkitanimationend: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** @deprecated This is a legacy alias of `onanimationiteration`. */ onwebkitanimationiteration: ((this: GlobalEventHandlers, ev: Event) => any) | null; @@ -8622,6 +8622,14 @@ interface InnerHTML { innerHTML: string; } +interface InputDeviceInfo extends MediaDeviceInfo { +} + +declare var InputDeviceInfo: { + prototype: InputDeviceInfo; + new(): InputDeviceInfo; +}; + interface InputEvent extends UIEvent { readonly data: string | null; readonly dataTransfer: DataTransfer | null; @@ -16559,14 +16567,14 @@ declare namespace WebAssembly { (message?: string): CompileError; }; - interface Global { - value: any; - valueOf(): any; + interface Global { + value: ValueTypeMap[T]; + valueOf(): ValueTypeMap[T]; } var Global: { prototype: Global; - new(descriptor: GlobalDescriptor, v?: any): Global; + new(descriptor: GlobalDescriptor, v?: ValueTypeMap[T]): Global; }; interface Instance { @@ -16629,9 +16637,9 @@ declare namespace WebAssembly { new(descriptor: TableDescriptor, value?: any): Table; }; - interface GlobalDescriptor { + interface GlobalDescriptor { mutable?: boolean; - value: ValueType; + value: T; } interface MemoryDescriptor { @@ -16657,6 +16665,15 @@ declare namespace WebAssembly { maximum?: number; } + interface ValueTypeMap { + anyfunc: Function; + externref: any; + f32: number; + f64: number; + i32: number; + i64: bigint; + } + interface WebAssemblyInstantiatedSource { instance: Instance; module: Module; @@ -16664,12 +16681,12 @@ declare namespace WebAssembly { type ImportExportKind = "function" | "global" | "memory" | "table"; type TableKind = "anyfunc" | "externref"; - type ValueType = "anyfunc" | "externref" | "f32" | "f64" | "i32" | "i64"; type ExportValue = Function | Global | Memory | Table; type Exports = Record; type ImportValue = ExportValue | number; type Imports = Record; type ModuleImports = Record; + type ValueType = keyof ValueTypeMap; function compile(bytes: BufferSource): Promise; function compileStreaming(source: Response | PromiseLike): Promise; function instantiate(bytes: BufferSource, importObject?: Imports): Promise; @@ -17404,7 +17421,7 @@ declare var onvolumechange: ((this: Window, ev: Event) => any) | null; * @param ev The event. */ declare var onwaiting: ((this: Window, ev: Event) => any) | null; -/** @deprecated This is a legacy alias of `onanimationend`. */ +/** @deprecated This is a legacy alias of `onanimationstart`. */ declare var onwebkitanimationend: ((this: Window, ev: Event) => any) | null; /** @deprecated This is a legacy alias of `onanimationiteration`. */ declare var onwebkitanimationiteration: ((this: Window, ev: Event) => any) | null; diff --git a/baselines/serviceworker.generated.d.ts b/baselines/serviceworker.generated.d.ts index 633419af8..fb145bae5 100644 --- a/baselines/serviceworker.generated.d.ts +++ b/baselines/serviceworker.generated.d.ts @@ -5112,14 +5112,14 @@ declare namespace WebAssembly { (message?: string): CompileError; }; - interface Global { - value: any; - valueOf(): any; + interface Global { + value: ValueTypeMap[T]; + valueOf(): ValueTypeMap[T]; } var Global: { prototype: Global; - new(descriptor: GlobalDescriptor, v?: any): Global; + new(descriptor: GlobalDescriptor, v?: ValueTypeMap[T]): Global; }; interface Instance { @@ -5182,9 +5182,9 @@ declare namespace WebAssembly { new(descriptor: TableDescriptor, value?: any): Table; }; - interface GlobalDescriptor { + interface GlobalDescriptor { mutable?: boolean; - value: ValueType; + value: T; } interface MemoryDescriptor { @@ -5210,6 +5210,15 @@ declare namespace WebAssembly { maximum?: number; } + interface ValueTypeMap { + anyfunc: Function; + externref: any; + f32: number; + f64: number; + i32: number; + i64: bigint; + } + interface WebAssemblyInstantiatedSource { instance: Instance; module: Module; @@ -5217,12 +5226,12 @@ declare namespace WebAssembly { type ImportExportKind = "function" | "global" | "memory" | "table"; type TableKind = "anyfunc" | "externref"; - type ValueType = "anyfunc" | "externref" | "f32" | "f64" | "i32" | "i64"; type ExportValue = Function | Global | Memory | Table; type Exports = Record; type ImportValue = ExportValue | number; type Imports = Record; type ModuleImports = Record; + type ValueType = keyof ValueTypeMap; function compile(bytes: BufferSource): Promise; function compileStreaming(source: Response | PromiseLike): Promise; function instantiate(bytes: BufferSource, importObject?: Imports): Promise; diff --git a/baselines/sharedworker.generated.d.ts b/baselines/sharedworker.generated.d.ts index 0659591f8..2ed551765 100644 --- a/baselines/sharedworker.generated.d.ts +++ b/baselines/sharedworker.generated.d.ts @@ -5141,14 +5141,14 @@ declare namespace WebAssembly { (message?: string): CompileError; }; - interface Global { - value: any; - valueOf(): any; + interface Global { + value: ValueTypeMap[T]; + valueOf(): ValueTypeMap[T]; } var Global: { prototype: Global; - new(descriptor: GlobalDescriptor, v?: any): Global; + new(descriptor: GlobalDescriptor, v?: ValueTypeMap[T]): Global; }; interface Instance { @@ -5211,9 +5211,9 @@ declare namespace WebAssembly { new(descriptor: TableDescriptor, value?: any): Table; }; - interface GlobalDescriptor { + interface GlobalDescriptor { mutable?: boolean; - value: ValueType; + value: T; } interface MemoryDescriptor { @@ -5239,6 +5239,15 @@ declare namespace WebAssembly { maximum?: number; } + interface ValueTypeMap { + anyfunc: Function; + externref: any; + f32: number; + f64: number; + i32: number; + i64: bigint; + } + interface WebAssemblyInstantiatedSource { instance: Instance; module: Module; @@ -5246,12 +5255,12 @@ declare namespace WebAssembly { type ImportExportKind = "function" | "global" | "memory" | "table"; type TableKind = "anyfunc" | "externref"; - type ValueType = "anyfunc" | "externref" | "f32" | "f64" | "i32" | "i64"; type ExportValue = Function | Global | Memory | Table; type Exports = Record; type ImportValue = ExportValue | number; type Imports = Record; type ModuleImports = Record; + type ValueType = keyof ValueTypeMap; function compile(bytes: BufferSource): Promise; function compileStreaming(source: Response | PromiseLike): Promise; function instantiate(bytes: BufferSource, importObject?: Imports): Promise; diff --git a/baselines/webworker.generated.d.ts b/baselines/webworker.generated.d.ts index d014dc30d..e4fcd0aa0 100644 --- a/baselines/webworker.generated.d.ts +++ b/baselines/webworker.generated.d.ts @@ -5355,14 +5355,14 @@ declare namespace WebAssembly { (message?: string): CompileError; }; - interface Global { - value: any; - valueOf(): any; + interface Global { + value: ValueTypeMap[T]; + valueOf(): ValueTypeMap[T]; } var Global: { prototype: Global; - new(descriptor: GlobalDescriptor, v?: any): Global; + new(descriptor: GlobalDescriptor, v?: ValueTypeMap[T]): Global; }; interface Instance { @@ -5425,9 +5425,9 @@ declare namespace WebAssembly { new(descriptor: TableDescriptor, value?: any): Table; }; - interface GlobalDescriptor { + interface GlobalDescriptor { mutable?: boolean; - value: ValueType; + value: T; } interface MemoryDescriptor { @@ -5453,6 +5453,15 @@ declare namespace WebAssembly { maximum?: number; } + interface ValueTypeMap { + anyfunc: Function; + externref: any; + f32: number; + f64: number; + i32: number; + i64: bigint; + } + interface WebAssemblyInstantiatedSource { instance: Instance; module: Module; @@ -5460,12 +5469,12 @@ declare namespace WebAssembly { type ImportExportKind = "function" | "global" | "memory" | "table"; type TableKind = "anyfunc" | "externref"; - type ValueType = "anyfunc" | "externref" | "f32" | "f64" | "i32" | "i64"; type ExportValue = Function | Global | Memory | Table; type Exports = Record; type ImportValue = ExportValue | number; type Imports = Record; type ModuleImports = Record; + type ValueType = keyof ValueTypeMap; function compile(bytes: BufferSource): Promise; function compileStreaming(source: Response | PromiseLike): Promise; function instantiate(bytes: BufferSource, importObject?: Imports): Promise; diff --git a/inputfiles/addedTypes.jsonc b/inputfiles/addedTypes.jsonc index d2482633c..ef7fa76c2 100644 --- a/inputfiles/addedTypes.jsonc +++ b/inputfiles/addedTypes.jsonc @@ -1102,6 +1102,45 @@ } } } + }, + "ValueTypeMap": { + "name": "ValueTypeMap", + "legacyNamespace": "WebAssembly", + "exposed":"Window Worker Worklet", + "members": { + "member": { + "anyfunc": { + "name": "anyfunc", + "overrideType": "Function", + "required": 1 + }, + "externref": { + "name": "externref", + "overrideType": "any", + "required": 1 + }, + "f32": { + "name": "f32", + "overrideType": "number", + "required": 1 + }, + "f64": { + "name": "f64", + "overrideType": "number", + "required": 1 + }, + "i32": { + "name": "i32", + "overrideType": "number", + "required": 1 + }, + "i64": { + "name": "i64", + "overrideType": "bigint", + "required": 1 + } + } + } } } }, @@ -1143,6 +1182,11 @@ "name": "WindowProxy", "type": "Window" }, + { + "name": "ValueType", + "legacyNamespace": "WebAssembly", + "overrideType": "keyof ValueTypeMap" + }, { "name": "ExportValue", "legacyNamespace": "WebAssembly", diff --git a/inputfiles/knownTypes.json b/inputfiles/knownTypes.json index c85fadef5..aba727e73 100644 --- a/inputfiles/knownTypes.json +++ b/inputfiles/knownTypes.json @@ -50,6 +50,7 @@ "RTCStatsType", "RTCTransportStats", "Transferable", + "ValueTypeMap", "VideoFacingModeEnum" ], "Worker": [ @@ -80,10 +81,12 @@ "RsaKeyGenParams", "RsaOaepParams", "RsaPssParams", - "Transferable" + "Transferable", + "ValueTypeMap" ], "Worklet": [ "EventListenerOrEventListenerObject", - "Transferable" + "Transferable", + "ValueTypeMap" ] } diff --git a/inputfiles/overridingTypes.jsonc b/inputfiles/overridingTypes.jsonc index 48086303d..892fe71ff 100644 --- a/inputfiles/overridingTypes.jsonc +++ b/inputfiles/overridingTypes.jsonc @@ -371,9 +371,6 @@ }, "TableKind": { "legacyNamespace": "WebAssembly" - }, - "ValueType": { - "legacyNamespace": "WebAssembly" } } }, @@ -2802,6 +2799,37 @@ } } }, + "Global": { + "name": "Global", + "typeParameters": [ + { + "name": "T", + "extends": "ValueType", + "default": "ValueType" + } + ], + "constructor": { + "overrideSignatures": [ + "new(descriptor: GlobalDescriptor, v?: ValueTypeMap[T]): Global" + ] + }, + "properties": { + "property": { + "value": { + "overrideType": "ValueTypeMap[T]" + } + } + }, + "methods": { + "method": { + "valueOf": { + "overrideSignatures": [ + "valueOf(): ValueTypeMap[T]" + ] + } + } + } + }, // https://github.com/w3c/media-source/pull/282, but not supported anywhere yet "MediaSource": { @@ -3096,7 +3124,21 @@ "legacyNamespace": "WebAssembly" }, "GlobalDescriptor": { - "legacyNamespace": "WebAssembly" + "legacyNamespace": "WebAssembly", + "typeParameters": [ + { + "name": "T", + "extends": "ValueType", + "default": "ValueType" + } + ], + "members": { + "member": { + "value": { + "overrideType": "T" + } + } + } }, "WebAssemblyInstantiatedSource": { "legacyNamespace": "WebAssembly" diff --git a/inputfiles/removedTypes.jsonc b/inputfiles/removedTypes.jsonc index c5066510a..a657d7c6b 100644 --- a/inputfiles/removedTypes.jsonc +++ b/inputfiles/removedTypes.jsonc @@ -47,7 +47,8 @@ "sctp-transport", "ice-server" ] - } + }, + "ValueType": null } }, "interfaces": { From 25b6bbb63af9cec1c18386167494644469c9747f Mon Sep 17 00:00:00 2001 From: ExE Boss Date: Mon, 24 Apr 2023 00:25:00 +0200 Subject: [PATCH 2/3] =?UTF-8?q?fixup!=20feat(WebAssembly):=20Make=C2=A0`We?= =?UTF-8?q?bAssembly.Global`=C2=A0generic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inputfiles/removedTypes.jsonc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inputfiles/removedTypes.jsonc b/inputfiles/removedTypes.jsonc index 601e6b1e3..f4e7170b0 100644 --- a/inputfiles/removedTypes.jsonc +++ b/inputfiles/removedTypes.jsonc @@ -39,6 +39,7 @@ "transceiver" // Blink only as of 2022-09 ] }, + "ValueType": null, "VideoColorPrimaries": { "value": [ "bt2020", // Blink only as of 2022-10 @@ -56,8 +57,7 @@ "linear", // Blink only as of 2022-10 "pq" // Blink only as of 2022-10 ] - }, - "ValueType": null + } } }, "interfaces": { From 52e8487f710b182c668f56b9fa1d28c045ad4ab3 Mon Sep 17 00:00:00 2001 From: ExE Boss Date: Mon, 24 Apr 2023 00:40:00 +0200 Subject: [PATCH 3/3] =?UTF-8?q?fixup!=20feat(WebAssembly):=20Make=C2=A0`We?= =?UTF-8?q?bAssembly.Global`=C2=A0generic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- baselines/audioworklet.generated.d.ts | 1 + baselines/dom.generated.d.ts | 1 + baselines/serviceworker.generated.d.ts | 1 + baselines/sharedworker.generated.d.ts | 1 + baselines/webworker.generated.d.ts | 1 + inputfiles/addedTypes.jsonc | 5 +++++ 6 files changed, 10 insertions(+) diff --git a/baselines/audioworklet.generated.d.ts b/baselines/audioworklet.generated.d.ts index 9fcf2f41e..c1cd4d8bc 100644 --- a/baselines/audioworklet.generated.d.ts +++ b/baselines/audioworklet.generated.d.ts @@ -1314,6 +1314,7 @@ declare namespace WebAssembly { f64: number; i32: number; i64: bigint; + v128: never; } interface WebAssemblyInstantiatedSource { diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index ff00821e2..66609fc8e 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -26503,6 +26503,7 @@ declare namespace WebAssembly { f64: number; i32: number; i64: bigint; + v128: never; } interface WebAssemblyInstantiatedSource { diff --git a/baselines/serviceworker.generated.d.ts b/baselines/serviceworker.generated.d.ts index 4db8c7ad9..9904ca798 100644 --- a/baselines/serviceworker.generated.d.ts +++ b/baselines/serviceworker.generated.d.ts @@ -8156,6 +8156,7 @@ declare namespace WebAssembly { f64: number; i32: number; i64: bigint; + v128: never; } interface WebAssemblyInstantiatedSource { diff --git a/baselines/sharedworker.generated.d.ts b/baselines/sharedworker.generated.d.ts index 617d4cf40..990fe55fe 100644 --- a/baselines/sharedworker.generated.d.ts +++ b/baselines/sharedworker.generated.d.ts @@ -8176,6 +8176,7 @@ declare namespace WebAssembly { f64: number; i32: number; i64: bigint; + v128: never; } interface WebAssemblyInstantiatedSource { diff --git a/baselines/webworker.generated.d.ts b/baselines/webworker.generated.d.ts index 6050658ed..866c24f16 100644 --- a/baselines/webworker.generated.d.ts +++ b/baselines/webworker.generated.d.ts @@ -8822,6 +8822,7 @@ declare namespace WebAssembly { f64: number; i32: number; i64: bigint; + v128: never; } interface WebAssemblyInstantiatedSource { diff --git a/inputfiles/addedTypes.jsonc b/inputfiles/addedTypes.jsonc index 2ef8dc03d..cb11cbb67 100644 --- a/inputfiles/addedTypes.jsonc +++ b/inputfiles/addedTypes.jsonc @@ -1305,6 +1305,11 @@ "name": "i64", "overrideType": "bigint", "required": 1 + }, + "v128": { + "name": "v128", + "overrideType": "never", + "required": 1 } } }