Open
Bug 605515
Opened 15 years ago
Updated 3 months 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, P3)
Tracking
()
NEW
People
(Reporter: jorendorff, Unassigned)
References
(Blocks 1 open bug, )
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•15 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•15 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•15 years ago
|
blocking2.0: ? → betaN+
Comment hidden (me-too) |
Updated•15 years ago
|
Updated•12 years ago
|
Comment hidden (me-too) |
Assignee | ||
Updated•11 years ago
|
Assignee: general → nobody
Comment 4•10 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•3 years ago
|
Severity: normal → S3
Updated•2 years ago
|
Priority: -- → P2
Updated•3 months ago
|
Priority: P2 → P3
You need to log in
before you can comment on or make changes to this bug.
Description
•