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

Failed to conform to ES5.1, Section 8.7.2 PutValue (V, W), [[Put]], Step 7.a #57

Open
daejunpark opened this issue Apr 7, 2015 · 2 comments

Comments

@daejunpark
Copy link

It seems to me that S5 does not conform to ES5.1, Section 8.7.2 PutValue (V, W), [[Put]], Step 7.a.

For the following test program:

// 8.7.2 PutValue (V, W), [[Put]], Step 7.a

// 7. Else, this is a request to create an own property on the transient object O
//     a. If Throw is true, then throw a TypeError exception.

// For [[Put]] for a reference with a primitive base,
// if it does not have its own value, but a inherited data descriptor,
// then this assignment will create its own data descriptor which cannot be used later at all, because this object will immediately disappear after this assignment
// (at least there is no reference pointing to this object, so it's not accessible).
// Thus, if throw is true, then it throws TypeError.

"use strict";
try {
  1["x"] = 10; // TypeError
  throw "Not here!";
} catch (e) {
  if (!(e instanceof TypeError)) {
    $ERROR('"use strict"; Object.defineProperty(Number.prototype, "x", { "value" : 0, "writable" : false, "enumerable" : true, "configurable" : true }); 1["x"] = 10; throws TypeError. Actual: ' + e);
  }
}

S5 throws an exception, while it should have succeeded:

$ ./s5-test262 /tmp/07.js 
../envs/es5.env:6:0-5029:0
<unknown>:13:-1--4
<unknown>:13:-1--4
<unknown>:13:-1--4
<unknown>:17:-3-18:-200
<unknown>:18:-5--199
<unknown>:18:-5--11
../envs/es5.env:977:28-983:3
../envs/es5.env:980:11-982:5
../envs/es5.env:287:28-293:1
Uncaught exception: {[#proto: @9, #class: "Object", #extensible: true,]
 'message' : {#value "Unbound identifier: $ERROR" ,
              #writable true ,
              #configurable false}}

Fatal error: exception Failure("Runtime error")

Is there anything that I'm missing?

@daejunpark
Copy link
Author

The same bug was reported for Firefox SpiderMonkey:
https://bugzilla.mozilla.org/show_bug.cgi?id=779682

@jpolitz
Copy link
Member

jpolitz commented Apr 15, 2015

Again, the error reported by S5 in the output you gave is that $ERROR is undefined. The smaller test from the bug report:

"use strict";
"s".x = 3;

Does seem to succeed without an error, when strict mode says it shouldn't. I see that Chrome has the spec'ed behavior (throwing an error), while Firefox has the bug. Thanks!

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

No branches or pull requests

2 participants