Bug 536512 - Ignore security wrappers when computing instanceof. r=brendan a1.9.2.6=LegNeato
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -5257,17 +5257,17 @@ js_HasInstance(JSContext *cx, JSObject *
JSBool
js_IsDelegate(JSContext *cx, JSObject *obj, jsval v, JSBool *bp)
{
JSObject *obj2;
*bp = JS_FALSE;
if (JSVAL_IS_PRIMITIVE(v))
return JS_TRUE;
- obj2 = JSVAL_TO_OBJECT(v);
+ obj2 = js_GetWrappedObject(cx, JSVAL_TO_OBJECT(v));
while ((obj2 = OBJ_GET_PROTO(cx, obj2)) != NULL) {
if (obj2 == obj) {
*bp = JS_TRUE;
break;
}
}
return JS_TRUE;
}
--- a/js/src/xpconnect/tests/mochitest/test_wrappers.html
+++ b/js/src/xpconnect/tests/mochitest/test_wrappers.html
@@ -2,16 +2,18 @@
<head>
<title>Tests XPConnect Wrappers</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<script class="testbody" type="text/javascript;version=1.7">
+ ok(window instanceof Object, "window is instanceof Object");
+
var answer = [];
for (let i in location)
answer.push(i);
var expected = [
"hash",
"host",
"hostname",
"href",