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

WindowProxy [[Set]] doesn't quite make sense #4064

Closed
bzbarsky opened this Issue Oct 5, 2018 · 4 comments

Comments

2 participants
@bzbarsky
Collaborator

bzbarsky commented Oct 5, 2018

In the same-origin case, https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-set does:

OrdinarySet(W, this, Receiver)

but https://tc39.github.io/ecma262/#sec-ordinaryset takes 4 arguments: An object, a property name, a property value, and a receiver.

Presumably this should be:

OrdinarySet(this, P, V, W)

or

OrdinarySet(W, P, V, Receiver)

or something? What if Receiver == this? Should we unwrap it to the Window in that case?

@domenic @annevk

@annevk

This comment has been minimized.

Show comment
Hide comment
@annevk

annevk Oct 8, 2018

Member

I would expect OrdinarySet(this, P, V, Receiver) for consistency with [[Get]], but I have to admit I never quite understood what a Receiver is. I just passed it on, hoping someone else would catch it if that was wrong. I regret that error.

Member

annevk commented Oct 8, 2018

I would expect OrdinarySet(this, P, V, Receiver) for consistency with [[Get]], but I have to admit I never quite understood what a Receiver is. I just passed it on, hoping someone else would catch it if that was wrong. I regret that error.

@annevk

This comment has been minimized.

Show comment
Hide comment
@annevk

annevk Oct 8, 2018

Member

It seems with Reflect.get() you can basically specify an arbitrary Receiver.

Member

annevk commented Oct 8, 2018

It seems with Reflect.get() you can basically specify an arbitrary Receiver.

annevk added a commit that referenced this issue Oct 8, 2018

Correct WindowProxy's [[Set]]
Bad leftover copypasta nobody cared to eat.

Also remove a source reference to an addressed JavaScript issue.

Fixes #4064.
@bzbarsky

This comment has been minimized.

Show comment
Hide comment
@bzbarsky

bzbarsky Oct 8, 2018

Collaborator

The reason Receiver exists in general is to handle cases where the object involved is on the proto chain of some other object.

So in our case, if you do var obj = Object.create(ourWindow) and then do a set on obj, Receiver can be obj (depending on exactly how things are donw) while this is ourWindow.

And yes, with Reflect the receiver can be pretty arbitrary.

Collaborator

bzbarsky commented Oct 8, 2018

The reason Receiver exists in general is to handle cases where the object involved is on the proto chain of some other object.

So in our case, if you do var obj = Object.create(ourWindow) and then do a set on obj, Receiver can be obj (depending on exactly how things are donw) while this is ourWindow.

And yes, with Reflect the receiver can be pretty arbitrary.

domenic added a commit that referenced this issue Oct 11, 2018

Correct WindowProxy's [[Set]]
Also:

* Explain why [[Get]] and [[Set]] pass this instead of W.
* Remove a source reference to an addressed JavaScript issue.

Fixes #4064.
@annevk

This comment has been minimized.

Show comment
Hide comment
@annevk

annevk Oct 12, 2018

Member

For anyone looking at this in the future, we determined Receiver being allowed to be arbitrary as acceptable, given that IDL performs brand checks.

Member

annevk commented Oct 12, 2018

For anyone looking at this in the future, we determined Receiver being allowed to be arbitrary as acceptable, given that IDL performs brand checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment