remove Object.prototype.eval

RESOLVED DUPLICATE of bug 382509

Status

()

Core
JavaScript Engine
--
minor
RESOLVED DUPLICATE of bug 382509
11 years ago
4 years ago

People

(Reporter: Hallvord R. M. Steen, Unassigned)

Tracking

Trunk
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

11 years ago
User-Agent:       Opera/9.01 (Windows NT 5.0; U; en)
Build Identifier:  Minefield 3.0a1/20060908

Having eval() in scope of every object is officially deprecated. It should be removed.

Documentation:
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object:eval

Discussion regarding Opera bug report:
http://my.opera.com/hallvors/blog/show.dml/449976

Reproducible: Always
(Reporter)

Updated

11 years ago
(Reporter)

Updated

11 years ago

Updated

11 years ago
Status: UNCONFIRMED → NEW
Ever confirmed: true
We've talked about this in ECMA TG1.  My colleague from Opera reports that it is necessary to support indirect eval of the form w.eval for any window object w. But cross-browser JS does not require o.eval for any object o.  However, at least Venkman and probably many other XUL apps and extensions depend on this old SpiderMonkey feature (it goes back to the dawn of JS, 1995).

Object.prototype.eval is something we definitely want to remove, so this bug is good to have on file (is there an older one it dups, though? I have memories of another bug like this).  The Mozilla milestone in which to do this is Mozilla 2, when we can make big API compatibility breaks (not break all API compatibility promises, just big/old/deep ones like this particular one).  Mozilla 2 work should start soon; I'll have more to say about this within the next few weeks.

For ES4/JS2 we are considering support for eval(s, o) -- an optional second argument giving the scope chain (not an object to extend the scope chain, as SpiderMonkey does now via an internal translation to with(o)eval(s)) for the evaluation of s.

/be

Comment 2

11 years ago
(In reply to comment #1)
> Object.prototype.eval is something we definitely want to remove

The docs say it actually *was* removed in JS1.4. Was it removed and reinstated, or never removed?

(In reply to comment #2)
> (In reply to comment #1)
> > Object.prototype.eval is something we definitely want to remove
> 
> The docs say it actually *was* removed in JS1.4. Was it removed and reinstated,
> or never removed?

The docs lie.  There's no trace in jsobj.c's CVS history (cvs annotate -rN jsobj.c | grep obj_eval and back N up to one before each change) that did not define eval as an Object.prototype method.  The incompatibility would have been as painful, or moreso, then than now.

/be

Comment 4

11 years ago
(In reply to comment #3)
> (In reply to comment #2)
> > (In reply to comment #1)
> > > Object.prototype.eval is something we definitely want to remove
> > 
> > The docs say it actually *was* removed in JS1.4. Was it removed and reinstated,
> > or never removed?
> 
> The docs lie.  There's no trace in jsobj.c's CVS history (cvs annotate -rN
> jsobj.c | grep obj_eval and back N up to one before each change) that did not
> define eval as an Object.prototype method.  The incompatibility would have been
> as painful, or moreso, then than now.
> 
> /be
> 

I've fixed the docs.

Comment 5

9 years ago
Isn't this a duplicate of bug 382509?
Yeah, duping forward.
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 382509
You need to log in before you can comment on or make changes to this bug.