Bug 564954 - Call the class hook even if not NEW_ENUMERATE. r=gal
authorBlake Kaplan <mrbkap@gmail.com>
Wed, 12 May 2010 16:00:23 -0700
changeset 42687 1b90a71c6791212921ff041baff0858903b79220
parent 42686 6396e8549fd6b8e2940cb2cdcbaa5ebb3bfcd752
child 42690 af83299dcd3a259f53a32d3764a59af613d10916
push idunknown
push userunknown
push dateunknown
reviewersgal
bugs564954
milestone1.9.3a5pre
Bug 564954 - Call the class hook even if not NEW_ENUMERATE. r=gal
js/src/jsobj.cpp
js/src/jstracer.cpp
js/src/xpconnect/tests/mochitest/test_wrappers.html
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -5294,16 +5294,20 @@ js_Enumerate(JSContext *cx, JSObject *ob
 {
     /* If the class has a custom JSCLASS_NEW_ENUMERATE hook, call it. */
     JSClass *clasp = obj->getClass();
     JSEnumerateOp enumerate = clasp->enumerate;
     if (clasp->flags & JSCLASS_NEW_ENUMERATE) {
         JS_ASSERT(enumerate != JS_EnumerateStub);
         return ((JSNewEnumerateOp) enumerate)(cx, obj, enum_op, statep, idp);
     }
+
+    if (!enumerate(cx, obj))
+        return false;
+
     /* Tell InitNativeIterator to treat us like a native object. */
     JS_ASSERT(enum_op == JSENUMERATE_INIT);
     *statep = JSVAL_NATIVE_ENUMERATE_COOKIE;
     return true;
 }
 
 JSBool
 js_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -13577,17 +13577,16 @@ TraceRecorder::record_JSOP_MOREITER()
 {
     jsval& iterobj_val = stackval(-1);
     if (JSVAL_IS_PRIMITIVE(iterobj_val))
         RETURN_STOP_A("for-in on a primitive value");
 
     RETURN_IF_XML_A(iterobj_val);
 
     JSObject* iterobj = JSVAL_TO_OBJECT(iterobj_val);
-    JSClass* clasp = iterobj->getClass();
     LIns* iterobj_ins = get(&iterobj_val);
     bool cond;
     LIns* cond_ins;
 
     /* JSOP_FOR* already guards on this, but in certain rare cases we might record misformed loop traces. */
     if (guardClass(iterobj, iterobj_ins, &js_IteratorClass.base, snapshot(BRANCH_EXIT), ACC_OTHER)) {
         NativeIterator *ni = (NativeIterator *) iterobj->getPrivate();
         jsval *cursor = ni->props_cursor;
--- a/js/src/xpconnect/tests/mochitest/test_wrappers.html
+++ b/js/src/xpconnect/tests/mochitest/test_wrappers.html
@@ -3,17 +3,17 @@
     <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");
-/*
+
     location.foopy = 3;
 
     var xow_answer = [];
     for (let i in location)
         xow_answer.push(i);
 
     var xpcnw_answer = [];
     var xpcnw = new XPCNativeWrapper(location);
@@ -167,12 +167,12 @@
 
     try {
         window.__proto__ = null;
         is(window.__proto__, null,
            "allowed to update window.__proto__ to null");
     } catch (e) {
         ok(false, "some crazy exception was thrown");
     }
-*/
+
     </script>
 </body>
 </html>