Skip to content

[js-api] Test descriptor-of-descriptor prototypes - #141

Merged
tlively merged 2 commits into
mainfrom
js-api-descriptor-of-descriptor
Dec 4, 2026
Merged

tlively merged 2 commits into
mainfrom
js-api-descriptor-of-descriptor

Conversation

@tlively

@tlively tlively commented Nov 20, 2026

Copy link
Copy Markdown
Member

Parameterize test/js-api/custom-descriptors/prototype.any.js over a 3-type struct-descriptor-metadescriptor chain so all prototype configuration and delegation tests run on both normal structs and descriptor structs.

Parameterize test/js-api/custom-descriptors/prototype.any.js over a 3-type struct-descriptor-metadescriptor chain so all prototype configuration and delegation tests run on both normal structs and descriptor structs.
@tlively
tlively requested a review from rmahdav November 20, 2026 23:20
@tlively

tlively commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

The diff is a lot smaller without including whitespace changes.

@rmahdav rmahdav left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % comments

if (proto == null) {
// Avoid TypeError when passing null as a non-nullable reference.
continue;
for (const [label, make] of [

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like every struct in this file now has a descriptor that also has a descriptor. The simple case is gone: where descriptor of the struct has no descriptor of its own. Could we keep it somehow?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Now we have two rec groups: one with a struct and descriptor, and another with a struct, descriptor, and meta-descriptor.

makeField(kWasmExternRef, false),
]});
builder.endRecGroup();
}, `allowed prototypes (${label})`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also add one test that gives both levels different prototypes? Something like: put protoA in the descriptor's field and protoB in the meta-descriptor's field, then check the struct gets protoA and the descriptor gets protoB. Also worth checking that a null in one level doesn't fall back to the other level's prototype.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, done.

@tlively
tlively merged commit abe1f90 into main Dec 4, 2026
@tlively
tlively deleted the js-api-descriptor-of-descriptor branch December 4, 2026 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants