Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions inputfiles/overridingTypes.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,6 @@
}
}
},
"WebGLRenderingContextBase": {
"methods": {
"method": {
"pixelStorei": {
"name": "pixelStorei",
"signature": {
"0": {
"param": [
{
"name": "param",
"additionalTypes": ["GLboolean"]
}
]
}
}
}
}
}
},
"Body": {
"properties": {
"property": {
Expand Down Expand Up @@ -1419,18 +1400,6 @@
"SubtleCrypto": {
"methods": {
"method": {
"decrypt": {
"signature": {
"0": {
"param": [
{
"name": "algorithm",
"additionalTypes": ["RsaOaepParams", "AesCtrParams", "AesCbcParams", "AesGcmParams"]
}
]
}
}
},
"deriveBits": {
"signature": {
"0": {
Expand Down
8 changes: 8 additions & 0 deletions inputfiles/patches/webcrypto.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions inputfiles/patches/webgl.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
15 changes: 11 additions & 4 deletions src/build/patches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ 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));
return { additionalTypes };
}
}
}

function handleTypeParameters(value: Value | Node) {
if (!value) {
return {};
Expand Down Expand Up @@ -290,6 +299,7 @@ function handleMethod(child: Node): DeepPartial<OverridableMethod> {
"string",
c.properties?.overrideType,
),
...handleAdditionalTypes(c),
});
break;

Expand All @@ -308,12 +318,9 @@ function handleMethod(child: Node): DeepPartial<OverridableMethod> {
: 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<Signature> = {
param: params,
Expand Down