Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upWhich prototype to use when extending an object from another realm and my constructor prototype is not an object? #786
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
claudepache
Jan 25, 2017
Contributor
The base constructor is w.Set, which uses OrdinaryCreateFromConstructor(NewTarget, "%SetPrototype%", « [[SetData]] ») and not OrdinaryCreateFromConstructor(newTarget, "%ObjectPrototype%"), see https://tc39.github.io/ecma262/#sec-set-iterable. I think it should be Case 2.
Correction: It should be Case 1 according to https://tc39.github.io/ecma262/#sec-getprototypefromconstructor step 4: here constructor is MySet.
|
The base constructor is |
bterlson
added
the
question
label
Feb 7, 2017
bterlson
closed this
Feb 7, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
AnnotationMark
commented
Feb 7, 2017
|
Thanks for the clarification. |
AnnotationMark commentedJan 25, 2017
•
edited
Let's say we have a script that looks like this:
According to http://w3c-test.org/custom-elements/htmlconstructor/newtarget.html, Case 1 should be true and the others false.
Based on my reading of the ES spec (9.2.2 ECMAScript Function Objects [[Construct]] - https://tc39.github.io/ecma262/#sec-ecmascript-function-objects-construct-argumentslist-newtarget, 9.1.13 OrdinaryCreateFromConstructor - https://tc39.github.io/ecma262/#sec-ordinarycreatefromconstructor, and 9.1.14 GetPrototypeFromConstructor - https://tc39.github.io/ecma262/#sec-getprototypefromconstructor), it appears that Case 3 should be true, and the others false.
Currently, Chrome implements Case 1, while Safari and Firefox implements Case 2.
Which one of these is actually the correct behavior? Thanks.