Closed
Bug 38590
Opened 25 years ago
Closed 25 years ago
with objects improperly capture eval'd var declarations
Categories
(Rhino Graveyard :: Core, defect, P3)
Rhino Graveyard
Core
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: mike+mozilla, Assigned: norrisboyd)
Details
given
js> with(o) {
eval("var foo = 4");
}
by section 10.1.4, we shouldn't see foo defined on the with object o. But on
rhino, it seems to be-
js> foo
ReferenceError: "foo" is not defined.
js> o.foo
4
(thanks to Waldemar for clarifying the correct behavior in this case.)
Assignee | ||
Updated•25 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 1•25 years ago
|
||
So should the rule be: When executing an eval() inside a with statement, define
any variables resulting from var statements in the first non-with, non-catch
scope.
So another test for this is
try {
throw 3;
} catch (e) {
eval("var bar = 6");
}
print(bar);
which should print 6.
Assignee | ||
Comment 2•25 years ago
|
||
Fixed:
Checking in ScriptRuntime.java;
/cvsroot/mozilla/js/rhino/org/mozilla/javascript/ScriptRuntime.java,v <-- Scri
ptRuntime.java
new revision: 1.44; previous revision: 1.43
done
Checking in ScriptRuntime.java;
/cvsroot/mozilla/js/rhino/org/mozilla/javascript/ScriptRuntime.java,v <-- Scri
ptRuntime.java
new revision: 1.41.2.2; previous revision: 1.41.2.1
done
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•