-
Notifications
You must be signed in to change notification settings - Fork 164
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
Named properties visibility algorithm leads to ES invariant violation #152
Comments
Also @ajklein. |
Blink gets the document case right for a much simpler reason: it doesn't actually implement a named getter for Document (see https://bugs.chromium.org/p/chromium/issues/detail?id=594008 for some discussion). @bzbarsky I'm curious to hear more of your intuition about why (1) doesn't have compat issues, as It seems like it defeats much of the point of |
My inituition for why (1) doesn't have compat issues is that Firefox has been shipping it for years with no known compat issues, and Edge is shipping it for document objects as well, with no compat issues. The main point of [OverrideBuiltins] is to allow shadowing stuff on the proto chain. It's not actually that common for people to define expandos on form elements (though probably a bit more common on documents)... |
Well, more precisely as far as I can tell Edge implements (1) and I have not heard them raise any issues about any of this. This does not mean they have not encountered compat issues, obviously. I stand by the Firefox part of what I said, though. ;) |
Given there is no compat issue, I'd support Option 1: Switch the order of steps 4 and 5 in the named property visibility algorithm, making all own properties have priority over named properties. I'm happy to make the change in Blink bindings once it gets spec'ed. |
…rops always make corresponding named props invisible. Fixes <whatwg#152>.
…rops always make corresponding named props invisible. Fixes <whatwg#152>.
…rops always make corresponding named props invisible. Fixes <whatwg#152> by picking option (1).
…rops always make corresponding named props invisible. Fixes <whatwg#152> by picking option (1).
This ensures existing own props always make corresponding named props invisible. Fixes #152 by picking option (1).
OK, we've landed the "option 1" solution. Please do let me know if there are objections... |
It would be good to have this covered in a web platform test. |
I'm adding some tests in https://bugzilla.mozilla.org/show_bug.cgi?id=1297304 that will get upstreamed to wpt. They test this and related bits for the return value of |
OK, checked in that Gecko patch with the wpt tests; they should get upstreamed sometime in the next week or three. |
Consider the testcase at https://bug1297411.bmoattachments.org/attachment.cgi?id=8784910. This does the following:
Per the letter of the IDL spec right now, this leads to an ES invariant violation: getOwnPropertyDescriptor after step 2 lands at http://heycam.github.io/webidl/#named-properties-object-getownproperty and then ends up in http://heycam.github.io/webidl/#dfn-named-property-visibility which returns true in step 4, so the returned descriptor ends up claiming a configurable property whose value is the input element.
Current browser behavior is as follows:
I see two conceivable ways of preserving the invariant here:
The two options lead to quite different behavior on the testcase at https://bugzilla.mozilla.org/attachment.cgi?id=8784908 -- option 1 has the expando shadow the named prop, and option 2 has the named prop shadow the expando.
In practice, I expect both options are web compatible enough and I think option 1 is simpler to both specify and implement. But I would be interested in hearing what other people think.
@cdumez, @domenic, @travisleithead, thoughts?
The text was updated successfully, but these errors were encountered: