Open
Bug 605515
Opened 14 years ago
Updated 2 years ago
Strict mode code should throw ReferenceError when assigning to a global if it doesn't exist at BINDNAME time
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
NEW
People
(Reporter: jorendorff, Unassigned)
References
(Blocks 2 open bugs, )
Details
"use strict";
var ok = false;
try {
undeclared = (this.undeclared = 5);
} catch (exc) {
ok = exc instanceof ReferenceError;
}
assertEq(ok, true);
Per ES5, this assignment to undeclared should throw a ReferenceError in strict mode. In detail,
undeclared = (this.undeclared = 5);
* The LHS evaluates to an unresolveable strict Reference (ES5 §10.2.2.1);
* the RHS evaluates to 5;
* assignment to the Reference throws, because it is still
unresolveable (see IsUnresolvableReference, §8.7), even though
undeclared now exists.
Reporter | ||
Updated•14 years ago
|
Summary: Assigning to globals in strict mode → Strict mode code should throw ReferenceError when assigning to a global if it doesn't exist at BINDNAME time
Comment 1•14 years ago
|
||
If Allen's fix makes it into an erratum, then there'll be a check before RHS evaluation. But we need a check somewhere.
/be
Updated•14 years ago
|
blocking2.0: ? → betaN+
Comment hidden (me-too) |
Updated•14 years ago
|
Updated•12 years ago
|
Comment hidden (me-too) |
Assignee | ||
Updated•10 years ago
|
Assignee: general → nobody
Comment 4•9 years ago
|
||
The semantics with checking RHS didn't change in ES6 spec, so this still should throw ReferenceError, because LHS is an unresolved reference.
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•