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

Add presence check for property cause on Error.prototype #3054

Closed
wants to merge 1 commit into from

Conversation

legendecas
Copy link
Member

Property cause should not present on Error.prototype.

Copy link
Contributor

@rwaldron rwaldron left a comment

Choose a reason for hiding this comment

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

  • Some of this duplicates existing tests.
  • Please put these in separate files, in the appropriate directories (where you will find that some of this is already covered)

@jugglinmike
Copy link
Contributor

Thanks for the patch! Hosts are permitted to define an Error.prototype.cause property, so we should remove the assertion for its absence.

@legendecas
Copy link
Member Author

Thanks for the suggestions! Well, I didn't notice that there are statements about host extensions on built-in objects. I was noticing v8 is putting a cause with undefined value on Error.prototype which is not expected. If spec allows such extension, I'd close this PR and just file a bug to v8.

@legendecas legendecas closed this Jul 20, 2021
@ljharb
Copy link
Member

ljharb commented Jul 20, 2021

I added tc39/agendas@964d2d3 to the next meeting to discuss tightening restrictions on hosts, so that helpful tests like this can be permitted.

@leobalter
Copy link
Member

@ljharb can you share what do you suggest/recommend as the next steps for the restrictions?

The issue on this one is that ECMAScript allows extensions. This is imperative as globals add names for the platform it is contained, and other names are not exactly defined by ECMAScript. Otherwise, it would be easy to enumerate the names expected in Error.prototype, but if the host adds anything (not limited to cause), how is that an error?

@ljharb
Copy link
Member

ljharb commented Aug 20, 2021

Allowing new globals, as well as property names on any object that are not specified in 262 or 402, is fine.

My hope is that we can forbid extensions on any specified objects whose names are specified elsewhere in 262 or 402, which would include “cause” on any language builtins other than the specified ones.

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.

5 participants