From 87aa0bc34df1aefbf4010bc370e9b382dce81fac Mon Sep 17 00:00:00 2001 From: Bashamega Date: Mon, 8 Dec 2025 11:21:43 +0200 Subject: [PATCH 1/3] Support additionalType --- inputfiles/overridingTypes.jsonc | 19 ------------------- inputfiles/patches/webgl.kdl | 6 ++++++ src/build/patches.ts | 21 +++++++++++++++++---- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/inputfiles/overridingTypes.jsonc b/inputfiles/overridingTypes.jsonc index 32683a28b..bf9c5ea22 100644 --- a/inputfiles/overridingTypes.jsonc +++ b/inputfiles/overridingTypes.jsonc @@ -30,25 +30,6 @@ } } }, - "WebGLRenderingContextBase": { - "methods": { - "method": { - "pixelStorei": { - "name": "pixelStorei", - "signature": { - "0": { - "param": [ - { - "name": "param", - "additionalTypes": ["GLboolean"] - } - ] - } - } - } - } - } - }, "Body": { "properties": { "property": { diff --git a/inputfiles/patches/webgl.kdl b/inputfiles/patches/webgl.kdl index 3d314d954..09b8ce95a 100644 --- a/inputfiles/patches/webgl.kdl +++ b/inputfiles/patches/webgl.kdl @@ -170,4 +170,10 @@ interface-mixin WebGLRenderingContextBase { param extensionName overrideType="\"WEBGL_multi_draw\"" type WEBGL_multi_draw nullable=#true } + + method pixelStorei signatureIndex=0 { + param param { + additionalType GLboolean + } + } } diff --git a/src/build/patches.ts b/src/build/patches.ts index 0bf053af7..a53d0cb7e 100644 --- a/src/build/patches.ts +++ b/src/build/patches.ts @@ -63,6 +63,21 @@ function handleTyped(type: Node): Typed { }; } +function handleAdditionalTypes(node:Node){ + const additionalTypes = [] + for (const child of node.children) { + if (child.name === "additionalType") { + additionalTypes.push(string(child.values[0])); + } + + } +// Check if additionalTypes has elements and return array if so, otherwise undefined/empty. +if (additionalTypes.length > 0) { + return {additionalTypes}; +} +return undefined; +} + function handleTypeParameters(value: Value | Node) { if (!value) { return {}; @@ -290,6 +305,7 @@ function handleMethod(child: Node): DeepPartial { "string", c.properties?.overrideType, ), + ...handleAdditionalTypes(c) }); break; @@ -308,12 +324,9 @@ function handleMethod(child: Node): DeepPartial { : null; const signatureIndex = child.properties?.signatureIndex; - if ((params.length || signatureIndex) && !type) { - throw new Error("A method signature requires a type"); - } let signature: OverridableMethod["signature"] = []; - if (type) { + if (type || params.length > 0) { // Determine the actual signature object const signatureObj: DeepPartial = { param: params, From 1ecba5d7c9bf99ebb7440ed1ed420112f659eb26 Mon Sep 17 00:00:00 2001 From: Bashamega Date: Mon, 8 Dec 2025 11:23:05 +0200 Subject: [PATCH 2/3] format --- src/build/patches.ts | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/build/patches.ts b/src/build/patches.ts index a53d0cb7e..4931a3664 100644 --- a/src/build/patches.ts +++ b/src/build/patches.ts @@ -63,19 +63,18 @@ function handleTyped(type: Node): Typed { }; } -function handleAdditionalTypes(node:Node){ - const additionalTypes = [] - for (const child of node.children) { - if (child.name === "additionalType") { - additionalTypes.push(string(child.values[0])); - } - +function handleAdditionalTypes(node: Node) { + const additionalTypes = []; + for (const child of node.children) { + if (child.name === "additionalType") { + additionalTypes.push(string(child.values[0])); + } } -// Check if additionalTypes has elements and return array if so, otherwise undefined/empty. -if (additionalTypes.length > 0) { - return {additionalTypes}; -} -return undefined; + // Check if additionalTypes has elements and return array if so, otherwise undefined/empty. + if (additionalTypes.length > 0) { + return { additionalTypes }; + } + return undefined; } function handleTypeParameters(value: Value | Node) { @@ -305,7 +304,7 @@ function handleMethod(child: Node): DeepPartial { "string", c.properties?.overrideType, ), - ...handleAdditionalTypes(c) + ...handleAdditionalTypes(c), }); break; From 964595a3a16e7405cbd1e8bfe3d9e99003b025cc Mon Sep 17 00:00:00 2001 From: Bashamega Date: Wed, 10 Dec 2025 07:11:21 +0200 Subject: [PATCH 3/3] Update --- inputfiles/overridingTypes.jsonc | 12 ------------ inputfiles/patches/webcrypto.kdl | 8 ++++++++ inputfiles/patches/webgl.kdl | 2 +- src/build/patches.ts | 11 +++-------- 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/inputfiles/overridingTypes.jsonc b/inputfiles/overridingTypes.jsonc index bf9c5ea22..60e7c5823 100644 --- a/inputfiles/overridingTypes.jsonc +++ b/inputfiles/overridingTypes.jsonc @@ -1400,18 +1400,6 @@ "SubtleCrypto": { "methods": { "method": { - "decrypt": { - "signature": { - "0": { - "param": [ - { - "name": "algorithm", - "additionalTypes": ["RsaOaepParams", "AesCtrParams", "AesCbcParams", "AesGcmParams"] - } - ] - } - } - }, "deriveBits": { "signature": { "0": { diff --git a/inputfiles/patches/webcrypto.kdl b/inputfiles/patches/webcrypto.kdl index db6844f2a..008ee62f0 100644 --- a/inputfiles/patches/webcrypto.kdl +++ b/inputfiles/patches/webcrypto.kdl @@ -13,6 +13,14 @@ interface CryptoKey { } } +interface SubtleCrypto { + method decrypt signatureIndex=0 { + param algorithm { + additionalTypes RsaOaepParams AesCtrParams AesCbcParams AesGcmParams + } + } +} + removals { enum KeyFormat { raw-private // No implementation as of 2025-09 diff --git a/inputfiles/patches/webgl.kdl b/inputfiles/patches/webgl.kdl index 09b8ce95a..645153230 100644 --- a/inputfiles/patches/webgl.kdl +++ b/inputfiles/patches/webgl.kdl @@ -173,7 +173,7 @@ interface-mixin WebGLRenderingContextBase { method pixelStorei signatureIndex=0 { param param { - additionalType GLboolean + additionalTypes GLboolean } } } diff --git a/src/build/patches.ts b/src/build/patches.ts index 4931a3664..3f14a8c3d 100644 --- a/src/build/patches.ts +++ b/src/build/patches.ts @@ -64,17 +64,12 @@ function handleTyped(type: Node): Typed { } function handleAdditionalTypes(node: Node) { - const additionalTypes = []; for (const child of node.children) { - if (child.name === "additionalType") { - additionalTypes.push(string(child.values[0])); + if (child.name === "additionalTypes") { + const additionalTypes = child.values.map((v) => string(v)); + return { additionalTypes }; } } - // Check if additionalTypes has elements and return array if so, otherwise undefined/empty. - if (additionalTypes.length > 0) { - return { additionalTypes }; - } - return undefined; } function handleTypeParameters(value: Value | Node) {