From 87aa0bc34df1aefbf4010bc370e9b382dce81fac Mon Sep 17 00:00:00 2001 From: Bashamega Date: Mon, 8 Dec 2025 11:21:43 +0200 Subject: [PATCH 1/8] 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/8] 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/8] 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) { From 956dcf9555f5fdd046a3d48a512b7d56b8a9827d Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sat, 13 Dec 2025 12:02:09 +0100 Subject: [PATCH 4/8] Update inputfiles/patches/webcrypto.kdl --- inputfiles/patches/webcrypto.kdl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inputfiles/patches/webcrypto.kdl b/inputfiles/patches/webcrypto.kdl index 008ee62f0..42ef5bc73 100644 --- a/inputfiles/patches/webcrypto.kdl +++ b/inputfiles/patches/webcrypto.kdl @@ -16,7 +16,7 @@ interface CryptoKey { interface SubtleCrypto { method decrypt signatureIndex=0 { param algorithm { - additionalTypes RsaOaepParams AesCtrParams AesCbcParams AesGcmParams + additionalTypes RsaOaepParams AesCtrParams AesCbcParams AesGcmParams } } } From 9213a4e21ca9f7128859166ac85b97d4bbae3027 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sat, 13 Dec 2025 12:05:01 +0100 Subject: [PATCH 5/8] Update src/build/patches.ts --- src/build/patches.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/build/patches.ts b/src/build/patches.ts index 3f14a8c3d..fb7345b61 100644 --- a/src/build/patches.ts +++ b/src/build/patches.ts @@ -66,7 +66,7 @@ function handleTyped(type: Node): Typed { function handleAdditionalTypes(node: Node) { for (const child of node.children) { if (child.name === "additionalTypes") { - const additionalTypes = child.values.map((v) => string(v)); + const additionalTypes = child.values.map(string); return { additionalTypes }; } } From 4a8bb76ddf33044d28fb9b2c95b9f62b61e52759 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sat, 13 Dec 2025 12:15:13 +0100 Subject: [PATCH 6/8] handleParam --- src/build/patches.ts | 50 +++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/src/build/patches.ts b/src/build/patches.ts index fb7345b61..cd1f8e18f 100644 --- a/src/build/patches.ts +++ b/src/build/patches.ts @@ -63,15 +63,6 @@ function handleTyped(type: Node): Typed { }; } -function handleAdditionalTypes(node: Node) { - for (const child of node.children) { - if (child.name === "additionalTypes") { - const additionalTypes = child.values.map(string); - return { additionalTypes }; - } - } -} - function handleTypeParameters(value: Value | Node) { if (!value) { return {}; @@ -271,6 +262,36 @@ function handleProperty(child: Node): Partial { }; } +function handleParam(node: Node) { + const name = string(child.values[0]); + let additionalTypes: string[] | undefined; + + for (const child of node.children) { + switch (child.name) { + case: "additionalTypes") { + if (additionalTypes) { + throw new Error("Unexpected multiple additionalTypes node"); + } + additionalTypes = child.values.map(string); + break; + } + default: + throw new Error(`Unexpected child "${c.name}" in param "${name}"`); + } + } + + return { + name, + ...optionalMember("type", "string", c.properties?.type), + ...optionalMember( + "overrideType", + "string", + c.properties?.overrideType, + ), + additionalTypes, + } +} + /** * Handles a child node of type "method" and adds it to the method object. * @param child The child node to handle. @@ -291,16 +312,7 @@ function handleMethod(child: Node): DeepPartial { break; case "param": - params.push({ - name: string(c.values[0]), - ...optionalMember("type", "string", c.properties?.type), - ...optionalMember( - "overrideType", - "string", - c.properties?.overrideType, - ), - ...handleAdditionalTypes(c), - }); + params.push(handleParam(c)); break; default: From dfa78fb4a9f143a4ccd04af02d7641c7d9671b4b Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sat, 13 Dec 2025 12:18:49 +0100 Subject: [PATCH 7/8] Fix syntax error in additionalTypes case statement --- src/build/patches.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/build/patches.ts b/src/build/patches.ts index cd1f8e18f..802f70ca5 100644 --- a/src/build/patches.ts +++ b/src/build/patches.ts @@ -268,7 +268,7 @@ function handleParam(node: Node) { for (const child of node.children) { switch (child.name) { - case: "additionalTypes") { + case "additionalTypes": { if (additionalTypes) { throw new Error("Unexpected multiple additionalTypes node"); } @@ -289,7 +289,7 @@ function handleParam(node: Node) { c.properties?.overrideType, ), additionalTypes, - } + }; } /** From e9b7d40cb8efc63ffc04c101f783a516bb1800d2 Mon Sep 17 00:00:00 2001 From: Bashamega Date: Sat, 13 Dec 2025 13:50:06 +0200 Subject: [PATCH 8/8] fix code --- src/build/patches.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/build/patches.ts b/src/build/patches.ts index 802f70ca5..f14fa625d 100644 --- a/src/build/patches.ts +++ b/src/build/patches.ts @@ -263,9 +263,9 @@ function handleProperty(child: Node): Partial { } function handleParam(node: Node) { - const name = string(child.values[0]); + const name = string(node.values[0]); let additionalTypes: string[] | undefined; - + for (const child of node.children) { switch (child.name) { case "additionalTypes": { @@ -276,18 +276,14 @@ function handleParam(node: Node) { break; } default: - throw new Error(`Unexpected child "${c.name}" in param "${name}"`); + throw new Error(`Unexpected child "${child.name}" in param "${name}"`); } } - + return { name, - ...optionalMember("type", "string", c.properties?.type), - ...optionalMember( - "overrideType", - "string", - c.properties?.overrideType, - ), + ...optionalMember("type", "string", node.properties?.type), + ...optionalMember("overrideType", "string", node.properties?.overrideType), additionalTypes, }; }