rust-js / rjs

Rust JavaScript interpreter
98 stars 6 forks source link

Fix problem with [[Put]] for array elements #18

Closed pvginkel closed 9 years ago

pvginkel commented 9 years ago

It looks like [[Put]] is implemented wrong. It seems that the following should allow the array item to be changed:

Object.defineProperty(Array.prototype, "0", {
    value: 100,
    writable: false,
    configurable: true
});

oldArr = [];
oldArr[0] = 102;

At least this works in Chrome and Internet Explorer (i.e. oldArr[0] returns 102). However I cannot find where in the specs this is allowed.

put currently has a special case that checks for putting an index into an array and skips the can_put check if this is the case.

pvginkel commented 9 years ago

I can't reproduce this issue. The special case has been removed and all tests pass.