Skip to content
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

Integer indexed exotic object [[Set]] can not ignore receiver #1339

Closed
evilpie opened this issue Oct 29, 2018 · 4 comments · Fixed by #1556
Closed

Integer indexed exotic object [[Set]] can not ignore receiver #1339

evilpie opened this issue Oct 29, 2018 · 4 comments · Fixed by #1556

Comments

@evilpie
Copy link
Contributor

evilpie commented Oct 29, 2018

The change from #347 is not web compatible. I implemented the new behavior of ignoring the receiver in [[Set]] in Firefox and this turns out to be not web-compatible. No other browser seems to have implemented this behavior, probably because there is no test262 test for it.

A reduced example that fails with this change:

function Vec3(x, y, z) {
  this[0] = x;
  this[1] = y;
  this[2] = z;
}

Vec3.prototype = new Float32Array(3);

Vec3.prototype.set = function(x, y, z) {
  this[0] = x;
  this[1] = y;
  this[2] = z;
}

var vec = new Vec3(1, 2, 3);
var vec2 = new Vec3(4, 5, 6);
console.log(vec[0], vec[1], vec[2]) // 4, 5, 6 (shared prototype changed)
@littledan
Copy link
Member

cc @verwaest

@verwaest-zz
Copy link

verwaest-zz commented Oct 29, 2018 via email

@evilpie
Copy link
Contributor Author

evilpie commented Oct 30, 2018

@verwaest That behaviour you suggest seems to be web-compatible, or at leas it would not break my example that is based on real world breakage. However it's not super obvious to me why this is useful behaviour, is this just an incremental step because we can't totally restrict it like the spec suggest or is there some advantage to that approach that I am missing?

@littledan
Copy link
Member

Would anyone be interested in writing a PR which documents the web reality semantics? (Are they common between JS implementations? Mostly common?) Concreteness about what there is right now could help us understand what makes sense to adopt.

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

Successfully merging a pull request may close this issue.

4 participants