-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
tests(wpt/console): Enables web platform tests for console #9013
Conversation
// The console seems to be the only one that should be writable and non-enumerable | ||
// thus we don't have a unique helper for it. If other properties follow the same | ||
// structure, it might be worth it to define a helper in `util` | ||
windowOrWorkerGlobalScope.console.enumerable = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't sure if this is the best place to do this, it seemed to me that non of the existing "util" functions do the desired behavior and since this seemed like a one-off I put it here, open to moving this
d1b2624
to
d14d003
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thanks @tarikeshaq
A comment in `runtime.js` reads that `console` seems to be "the only one that should be writable and non-enumerable", which explains why it is declared with `util.writable` to then have the property descriptor's `enumerable` key changed to false. That is not in fact true, and it wasn't even in denoland#9013, when that behavior was introduced. In fact all WebIDL interfaces are writable and non-enumerable, declared with `util.nonEnumerable` – the difference here being that `console` is a namespace / object. WebIDL, however, treats namespaces and interfaces similarly, and defines them with the same descriptor keys, so this PR changes the definition of `console` to use `util.nonEnumerable`.
A comment in `runtime.js` reads that `console` seems to be "the only one that should be writable and non-enumerable", which explains why it is declared with `util.writable` but then has its property descriptor's `enumerable` key changed to false. But it is not in fact true that `console` is the only global property for which this holds, and it wasn't even when this behavior was introduced in denoland#9013. All WebIDL interfaces are also writable and non-enumerable – the only difference here being that `console` is a namespace rather than an interface. Since WebIDL interfaces are defined with `util.nonEnumerable`, and `console` uses the same descriptor keys, this PR changes the definition of `console` to use `util.nonEnumerable` as well.
A comment in `runtime.js` reads that `console` seems to be "the only one that should be writable and non-enumerable", which explains why it is declared with `util.writable` but then has its property descriptor's `enumerable` key changed to false. But it is not in fact true that `console` is the only global property for which this holds, and it wasn't even when this behavior was introduced in #9013. All WebIDL interfaces are also writable and non-enumerable – the only difference here being that `console` is a namespace rather than an interface. Since WebIDL interfaces are defined with `util.nonEnumerable`, and `console` uses the same descriptor keys, this PR changes the definition of `console` to use `util.nonEnumerable` as well.
A part of #9001
Notes:
.html
files in the wpt console directory, I ignored those. They seem to be manual tests, anywho just thought I'd note it down.I putTODO(???)
on the failing test suites, they seem to have trivial fixes (like theSymbol.toStringTag
) but I opted to first get this PR up to see if it's better to file another issue for those (maybe agood first issue
👀 ) or solve the trivial ones hereFixes were small enough so I'll add them in a commit here