Closed Bug 6313 Opened 25 years ago Closed 25 years ago

Rhino: "new Function" doesn't work properly with superglobal

Categories

(Core :: JavaScript Engine, defect, P3)

x86
Windows NT
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: norrisboyd, Assigned: norrisboyd)

Details

(Whiteboard: pushing off a week for verification)

E:\src\mozilla\js\rhino>cat test.js var x = 12; var f = new Function("return x;"); print(f()); E:\src\mozilla\js\rhino>rhino test.js js: "test.js", line 3: "x" is not defined. The problem is the line of code in NativeGlobal.java: Scriptable global = ScriptableObject.getTopLevelScope(ctorObj); This doesn't work when storing all standard objects in a prototype of the top-level object because "global" will be the prototype instead of the top-level object and so top-level variables won't be accessible.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Whiteboard: pushing off a week for verification
Status: RESOLVED → VERIFIED
pulled and built rhino on 02.july.1999, 11am. marking verified: [phillip@wetnap /build/mozilla/js/rhino] 134 % cat test.js var x = 12; var f = new Function("return x;"); print(f()); [phillip@wetnap /build/mozilla/js/rhino] 135 % java org.mozilla.javascript.tools.shell.Main test.js 12
You need to log in before you can comment on or make changes to this bug.