-
Notifications
You must be signed in to change notification settings - Fork 163
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
Inconsistent enumerability on keys/values/entries and friends #738
Comments
It's a bit exciting to test given lack of use for maplike/setlike in the wild... Gecko implements nothing that's setlike, for example, and I think the only default-exposed maplike is Within that constraint, this testcase:
shows that Gecko does in fact make the iterable case enumerable and the maplike case non-enumerable like the spec says. In Safari the behavior is like Gecko (including having FontFaceSet stuff enumerable, but maybe it doesn't use setlike there either?). Chrome has I don't have strong opinions about the desired behavior here. |
I've added tests for the currently-specced behavior (Firefox passes, Chrome fails, unsure yet on Safari) to web-platform-tests/wpt#33951. |
@EdgarChen @saschanaz @yuki3 @shvaikalesh let's settle this once and for all. This is trivial but is an interop issue and consistency issue and now I started testing it in web-platform-tests/wpt@31f5f5e and that caused a bunch of WPT idlharness failures :). Here is my proposal:
(*) = change from current Web IDL spec. Does this sound good? Explicit thumbs-up votes appreciated, especially from implementers. |
This makes the properties generated by the maplike/setlike declarations consistent with properties generated by other IDL constructs such as operation and attribute declarations. (That includes, e.g., explicitly-specified has/get/set/delete operations!) This is also consistent with the generated properties for iterable declarations. The @@iterator symbol property remains non-enumerable, like it is for iterable declarations, and like all other symbol-named properties are. Closes #738.
IIUC, the proposal is what Blink currently implements. +1. |
|
Oops, so that's just testing the current specced behavior and this wants to change that to match Blink. In that case I want our IDL people to take a look. (@EdgarChen and @petervanderbeken) Is there some discussion log about why maplike/setlike things are non-enumerable? |
I think we copied what the ES spec does, which is generally to make everything non-enumerable (including normal methods). |
Since nobody responded... If we are okay with such deviation (I definitely see some people hate that, #1179 😅), then I'm okay with this. |
OK, I am going to count that as Gecko support :). In that case #1166 is ready for review, and I will work on a test-update PR as well. |
In particular, check the enumerable/configurable/writable-ness of all the methods. Related to whatwg/webidl#738.
In particular, check the enumerable/configurable/writable-ness of all the methods. Related to whatwg/webidl#738.
In particular, check the enumerable/configurable/writable-ness of all the methods. Related to whatwg/webidl#738.
In particular, check the enumerable/configurable/writable-ness of all the methods. Related to whatwg/webidl#738.
Sorry, missed this thread. I don't think I have a strong opinion here. The difference with the ES spec is unfortunate, but WebIDL is already different for operations anyway. |
In particular, check the enumerable/configurable/writable-ness of all the methods. Related to whatwg/webidl#738.
This makes the properties generated by the maplike/setlike declarations consistent with properties generated by other IDL constructs such as operation and attribute declarations. (That includes, e.g., explicitly-specified has/get/set/delete operations!) This is also consistent with the generated properties for iterable declarations. The @@iterator symbol property remains non-enumerable, like it is for iterable declarations, and like all other symbol-named properties are. Closes #738.
In particular, check the enumerable/configurable/writable-ness of all the methods. Related to whatwg/webidl#738.
In particular, check the enumerable/configurable/writable-ness of all the methods. Related to whatwg/webidl#738.
…hecks, a=testonly Automatic update from web-platform-tests Expand iterable<> and async iterable<> checks (#36124) In particular, check the enumerable/configurable/writable-ness of all the methods. Related to whatwg/webidl#738. -- wpt-commits: 4e5209fdff87f351bfcbfe765ed669a6e9eeb996 wpt-pr: 36124
…hecks, a=testonly Automatic update from web-platform-tests Expand iterable<> and async iterable<> checks (#36124) In particular, check the enumerable/configurable/writable-ness of all the methods. Related to whatwg/webidl#738. -- wpt-commits: 4e5209fdff87f351bfcbfe765ed669a6e9eeb996 wpt-pr: 36124
Keys/values/entries in particular:
I'm not sure whether consistency with other methods on the interface prototype object should win (enumerable) or consistency with ES (non-enumerable). I guess I'd lean toward the former?
This gets worse actually for maplike and setlike, where all the "generated" methods seem to be non-enumerable. This includes ones with innocuous names like has, get, the size getter, ...
I wonder if browsers actually follow the spec here :-/.
The text was updated successfully, but these errors were encountered: