Closed Bug 1197122 Opened 5 years ago Closed 4 years ago

Direct eval creates variables before checking for undefinable functions

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
Tracking Status
firefox43 --- affected

People

(Reporter: anba, Unassigned)

References

(Blocks 1 open bug)

Details

Test case:
---
try {
  eval("var vn = 0; function NaN(){}")
  print("no error");
} catch (e) {
  print("caught", e);
}

print(JSON.stringify(Object.getOwnPropertyDescriptor(this, "vn")));
---

Expected: Throws TypeError and property "vn" is not created on global
Actual: Throws TypeError and property "vn" is created on global


ES5: 10.5, steps 5 and 8
ES6: 18.2.1.2, steps 8 and 15


Note: ES6 changed the error from TypeError to SyntaxError, but I guess this is a spec bug (for example compare to 15.1.8, steps 10 & 12).
Blocks: es6
This has been fixed in the meantime. NIing to check in test.
Flags: needinfo?(shu)
Depends on: 1298640
Pending a stupid bug in bug 1300521, this has been fixed.
Status: NEW → RESOLVED
Closed: 4 years ago
Flags: needinfo?(shu)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.