diff --git a/inputfiles/overridingTypes.jsonc b/inputfiles/overridingTypes.jsonc index 32683a28b..60e7c5823 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": { @@ -1419,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..42ef5bc73 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 3d314d954..645153230 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 { + additionalTypes GLboolean + } + } } diff --git a/src/build/patches.ts b/src/build/patches.ts index 0bf053af7..f14fa625d 100644 --- a/src/build/patches.ts +++ b/src/build/patches.ts @@ -262,6 +262,32 @@ function handleProperty(child: Node): Partial { }; } +function handleParam(node: Node) { + const name = string(node.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 "${child.name}" in param "${name}"`); + } + } + + return { + name, + ...optionalMember("type", "string", node.properties?.type), + ...optionalMember("overrideType", "string", node.properties?.overrideType), + additionalTypes, + }; +} + /** * Handles a child node of type "method" and adds it to the method object. * @param child The child node to handle. @@ -282,15 +308,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, - ), - }); + params.push(handleParam(c)); break; default: @@ -308,12 +326,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,