Closed Bug 379528 Opened 17 years ago Closed 13 years ago

Changing __proto__ causes uneval to throw with e.g. "RegExp.prototype.toSource called on incompatible global"

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: jruderman, Unassigned)

Details

(Keywords: testcase)

js> this.__proto__ = /r/
/r/
js> uneval(this)
typein:2: TypeError: RegExp.prototype.toSource called on incompatible global
js> this.__proto__ = <x/>

js> uneval(this)
typein:2: TypeError: XML.prototype.toString called on incompatible global
(In reply to comment #0)
> js> this.__proto__ = /r/
> /r/
> js> uneval(this)
> typein:2: TypeError: RegExp.prototype.toSource called on incompatible global

This is not a bug since RegExp.prototype.toSource is not generic and requires this to be regex.

(In reply to comment #1)
> js> this.__proto__ = <x/>
> 
> js> uneval(this)
> typein:2: TypeError: XML.prototype.toString called on incompatible global

The bug here is why XML.prototype.toString and not XML.prototype.toSource is reported. 
js> this.__proto__ = <x/>
typein:3: TypeError: can't set prototype of an object to an XML value

WFM?
OS: Mac OS X → All
Hardware: x86 → All
Sure, I think we can say that.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → WORKSFORME
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.