Closed Bug 647119 Opened 13 years ago Closed 13 years ago

eval('(this)') == true, while (this) without eval function is an object.

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: windspirit, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:2.0) Gecko/20110322 Firefox/4.0
Build Identifier: Mozilla/5.0 (X11; Linux x86_64; rv:2.0) Gecko/20110322 Firefox/4.0

it is pretty clear.
alert((this));
alert(eval('(this)'));
should give same result.
but second one will say "true". 

 

Reproducible: Always

Steps to Reproduce:
1. alert(eval('(this)'));
Confirming on Windows XP. Other browsers (at least IE8 and Chrome) works as expected.
Not limited to Developer Tools, x86_64, and Linux.
Assignee: nobody → general
Status: UNCONFIRMED → NEW
Component: Developer Tools → JavaScript Engine
Ever confirmed: true
OS: Linux → All
Product: Firefox → Core
QA Contact: developer.tools → general
Hardware: x86_64 → All
Regression window(TM nightly)
Works:
http://hg.mozilla.org/tracemonkey/rev/fa851447f195
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b5pre) Gecko/20100824 Minefield/4.0b5pre ID:20100824043743
Fails:
http://hg.mozilla.org/tracemonkey/rev/7680aecfb0c6
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b5pre) Gecko/20100826 Minefield/4.0b5pre ID:20100826044040
Pushlog:
http://hg.mozilla.org/tracemonkey/pushloghtml?fromchange=fa851447f195&tochange=7680aecfb0c6

In local build on ubuntu(tm repository)
build from 5685f8de41fa : fails
build from fa851447f195 : works
Treiggered by:
5685f8de41fa	Nicholas Nethercote — Bug 578216 - Make eval(json-like string) fast. r=sayrer
So the underlying problem here is that JSON.parse("this") returns true...
Not surprisingly, the JSON parser rewrite fixes this.
Depends on: 589664
Fixed by the parser rewrite in bug 589664.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.