Closed
Bug 654370
Opened 14 years ago
Closed 14 years ago
instanceof operators doesn't work in a sandbox
Categories
(Core :: XPConnect, defect)
Core
XPConnect
Tracking
()
RESOLVED
FIXED
People
(Reporter: Honza, Assigned: mrbkap)
Details
(Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file)
3.87 KB,
patch
|
gal
:
review+
|
Details | Diff | Splinter Review |
I am facing a problem when using instanceof operator within a sandbox,
see the following example:
var Cu = Components.utils;
var sandbox = new Cu.Sandbox(window);
var script = "function (obj, type) { return obj instanceof type; }";
var instanceOf = Cu.evalInSandbox(script, sandbox, "1.8", "Test", 1);
instanceOf({}, Window);
I have evaluated this code in Error Console (Tools -> Error Console)
command line.
(just to note that changing wantXrays doesn't make any difference)
Firefox 3.6 returns false
Firefox 4.0 returns true
Firefox 5.0 (Aurora) returns true
So, only Firefox 3.6 works as expected.
Related thread:
http://groups.google.com/group/mozilla.dev.platform/browse_thread/thread/d082eaff53167a84/394e7b92d364e08f?hl=en#394e7b92d364e08f
Honza
Updated•14 years ago
|
OS: Windows Vista → All
Hardware: x86 → All
Version: 1.9.1 Branch → Trunk
Comment 1•14 years ago
|
||
Blake, Andreas, this sounds like proxy fail of some sort...
Component: DOM: Core & HTML → XPConnect
QA Contact: general → xpconnect
Assignee | ||
Comment 2•14 years ago
|
||
Everywhere except in jswrapper that we call into the JSClass's hasInstance hook, we initialize the out parameter to false. I don't know if that's an implicit part of the API, but it lead to us reading an uninitialized boolean because nsDOMClassInfo depended on this behavior.
It's a little weird to have a guaranteed-initialized out parameter coming from the JS engine, so I fixed nsDOMClassInfo to not depend on it, but also initialized the out param in the proxy code to be on the safe side.
Assignee | ||
Comment 3•14 years ago
|
||
http://hg.mozilla.org/tracemonkey/rev/57ef10a3d925 (gal sent me an r=him over e-mail as he's without a net connection at the moment).
Whiteboard: fixed-in-tracemonkey
Comment 4•14 years ago
|
||
was he in an airplane at the time?
Comment 5•14 years ago
|
||
cdleary-bot mozilla-central merge info:
http://hg.mozilla.org/mozilla-central/rev/57ef10a3d925
Updated•14 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Updated•13 years ago
|
Attachment #532885 -
Flags: review?(gal) → review+
You need to log in
before you can comment on or make changes to this bug.
Description
•