Bug 536512 - Ignore security wrappers when computing instanceof. r=brendan a1.9.2.6=LegNeato
authorBlake Kaplan <mrbkap@gmail.com>
Wed, 23 Dec 2009 14:09:08 -0800
changeset 34389 c57c70f01cc60354b81ae38b5e7d75c9f209bb69
parent 34388 a34de5780b91a941a6e41b163e070e17e0249bc9
child 34390 53de6bf65322bf77e325592d8efd4662aab01219
push id1432
push usereakhgari@mozilla.com
push dateFri, 25 Jun 2010 21:28:12 +0000
reviewersbrendan
bugs536512
milestone1.9.2.6pre
Bug 536512 - Ignore security wrappers when computing instanceof. r=brendan a1.9.2.6=LegNeato
js/src/jsobj.cpp
js/src/xpconnect/tests/mochitest/test_wrappers.html
--- 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",