Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

record<> converted to a JS value should use a null prototype #904

Open
domenic opened this issue Aug 3, 2020 · 0 comments
Open

record<> converted to a JS value should use a null prototype #904

domenic opened this issue Aug 3, 2020 · 0 comments

Comments

@domenic
Copy link
Member

domenic commented Aug 3, 2020

Currently records get converted to a JS value with %Object.prototype% as their [[Prototype]].

We should instead consider using a null prototype. This avoids false positives where it appears that properties like toString, valueOf, etc. are members of the record.

This also matches some Ecma-262 precedent a bit better: RegExp's exec() method returns a null-prototype "record" for its groups property (step 24.a). Indeed, the case that is prompting this issue is the desire to add a similar groups property for service worker scope pattern matching.

With regard to compatibility: most records in specs are used in input position (e.g. as parameters, or as parts of dictionaries that are themselves used as parameters). The following are the ones I found in output position:

I'm unsure whether this change is good for those cases. Traditionally, objects returned by toJSON() do not have null-prototype. Hmm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant