Skip to content

Commit 6e76de9

Browse files
committed
-
1 parent 6b779dd commit 6e76de9

File tree

3 files changed

+34
-39
lines changed

3 files changed

+34
-39
lines changed

inputfiles/patches/authenticator.kdl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,23 @@ removals {
22
enum AuthenticatorTransport {
33
smart-card // WebKit only as of 2023-05
44
}
5+
dictionary AuthenticationExtensionsClientInputs {
6+
// https://searchfox.org/mozilla-central/source/dom/webidl/WebAuthentication.webidl
7+
// https://searchfox.org/wubkat/source/Source/WebCore/Modules/webauthn/AuthenticationExtensionsClientInputs.idl
8+
// https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/credentialmanagement/authentication_extensions_client_inputs.idl
9+
member appidExclude
10+
member credBlob
11+
member getCredBlob
12+
member hmacGetSecret // No implementation as of 2025-05
13+
member payment
14+
}
15+
dictionary AuthenticationExtensionsClientInputsJSON {
16+
member appidExclude
17+
}
18+
dictionary AuthenticationExtensionsClientOutputs {
19+
// (same as *Inputs)
20+
member appidExclude // No implementation as of 2025-05
21+
member hmacGetSecret // No implementation as of 2025-05
22+
member payment // Blink only as of 2025-06
23+
}
524
}

inputfiles/removedTypes.jsonc

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -261,37 +261,6 @@
261261
}
262262
}
263263
},
264-
"AuthenticationExtensionsClientInputs": {
265-
"members": {
266-
"member": {
267-
// https://searchfox.org/mozilla-central/source/dom/webidl/WebAuthentication.webidl
268-
// https://searchfox.org/wubkat/source/Source/WebCore/Modules/webauthn/AuthenticationExtensionsClientInputs.idl
269-
// https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/credentialmanagement/authentication_extensions_client_inputs.idl
270-
"appidExclude": null,
271-
"credBlob": null,
272-
"getCredBlob": null,
273-
"hmacGetSecret": null, // No implementation as of 2025-05
274-
"payment": null
275-
}
276-
}
277-
},
278-
"AuthenticationExtensionsClientInputsJSON": {
279-
"members": {
280-
"member": {
281-
"appidExclude": null
282-
}
283-
}
284-
},
285-
"AuthenticationExtensionsClientOutputs": {
286-
"members": {
287-
"member": {
288-
// (same as *Inputs)
289-
"appidExclude": null, // No implementation as of 2025-05
290-
"hmacGetSecret": null, // No implementation as of 2025-05
291-
"payment": null // Blink only as of 2025-06
292-
}
293-
}
294-
},
295264
"CanvasRenderingContext2DSettings": {
296265
"members": {
297266
"member": {

src/build/patches.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ function convertKDLNodes(nodes: Node[]): DeepPartial<WebIdl> {
131131
...optionalMember("enums.enum", "object", enums),
132132
...optionalMember("mixins.mixin", "object", mixin),
133133
...optionalMember("interfaces.interface", "object", interfaces),
134-
...optionalMember("dictionaries.dictionary", "object", dictionary),
134+
dictionaries: {
135+
dictionary
136+
}
135137
};
136138
}
137139

@@ -396,21 +398,26 @@ async function readPatchDocument(fileUrl: URL): Promise<Node[]> {
396398
return output!;
397399
}
398400
/**
399-
* Remove all name fields from the object and its children as we don't want
400-
* the names to be part of the removal.
401+
* Recursively remove all 'name' fields from the object and its children, and
402+
* replace any empty objects ({} or []) with null.
401403
*/
402-
function removeNamesDeep(obj: unknown): unknown {
404+
function sanitizeRemovals(obj: unknown): unknown {
403405
if (Array.isArray(obj)) {
404-
return obj.map(removeNamesDeep);
406+
const result = obj.map(sanitizeRemovals).filter((v) => v !== undefined);
407+
return result.length === 0 ? null : result;
405408
}
406409
if (obj && typeof obj === "object") {
407410
const newObj: { [key: string]: unknown } = {};
408411
for (const [key, value] of Object.entries(obj as Record<string, unknown>)) {
409412
if (key !== "name") {
410-
newObj[key] = removeNamesDeep(value);
413+
const cleaned = sanitizeRemovals(value);
414+
if (cleaned !== undefined) {
415+
newObj[key] = cleaned;
416+
}
411417
}
412418
}
413-
return newObj;
419+
// Replace empty objects with null
420+
return Object.keys(newObj).length === 0 ? null : newObj;
414421
}
415422
return obj;
416423
}
@@ -461,7 +468,7 @@ export default async function readPatches(): Promise<{
461468
const removalObjs = removalsNodeGroups.map((nodes) => convertKDLNodes(nodes));
462469

463470
const patches = patchObjs.reduce((acc, cur) => merge(acc, cur), {});
464-
const removalPatches = removeNamesDeep(
471+
const removalPatches = sanitizeRemovals(
465472
removalObjs.reduce((acc, cur) => merge(acc, cur), {}),
466473
);
467474

0 commit comments

Comments
 (0)