Closed
Bug 34187
Opened 26 years ago
Closed 26 years ago
eval is not a property of the Global Object
Categories
(Core :: JavaScript Engine, defect, P3)
Tracking
()
RESOLVED
FIXED
People
(Reporter: yugo, Assigned: rogerl)
Details
eval is defined as a property of Object Object in jsobj.c.
But eval is a property of the Global Object. (15.1.2.1 eval (x))
Though
alert(hasOwnProperty("parseInt"));
shows "true",
alert(hasOwnProperty("eval"));
shows "false".
| Assignee | ||
Comment 1•26 years ago
|
||
and Rhino doesn't even seem to support hasOwnProperty. Yikes.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
| Assignee | ||
Comment 2•26 years ago
|
||
Added missing functions to Rhino - all is well there now. Here's a patch for
Monkey, jsobj.c:
@@ -1238,6 +1238,7 @@
js_InitObjectClass(JSContext *cx, JSObject *obj)
{
JSObject *proto;
+ jsval fval;
#if JS_HAS_SHARP_VARS
JS_ASSERT(sizeof(jsatomid) * JS_BITS_PER_BYTE >= ATOM_INDEX_LIMIT_LOG2 +
1);
@@ -1251,6 +1252,17 @@
return NULL;
}
#endif
+
+ /* ECMA (15.1.2.1) says 'eval' is also a property of the global object. */
+ if (!OBJ_GET_PROPERTY(cx, proto, (jsid)cx->runtime->atomState.evalAtom,
+ &fval)) {
+ return NULL;
+ }
+ if (!OBJ_DEFINE_PROPERTY(cx, obj, (jsid)cx->runtime->atomState.evalAtom,
+ fval, NULL, NULL, 0, NULL)) {
+ return NULL;
+ }
+
return proto;
}
| Assignee | ||
Comment 3•26 years ago
|
||
Fix checed in.
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•