Bug 1002737 - Fix PropDesc vector rooting in DebugObject_defineProperties. (r=jorendorff)
authorEric Faust <efaustbmo@gmail.com>
Tue, 03 Jun 2014 12:37:44 -0700
changeset 207304 4db799c3cee9b520d1b99d7175924ddfce9c3674
parent 207303 1374cc1b03c0c5efbffee8b8557af26597c9c30c
child 207305 e6905f611ad6bc6c08f8feaca144791ba3cb2afe
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1002737
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1002737 - Fix PropDesc vector rooting in DebugObject_defineProperties. (r=jorendorff)
js/src/vm/Debugger.cpp
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -5373,54 +5373,40 @@ DebuggerObject_defineProperties(JSContex
         return false;
 
     AutoIdVector ids(cx);
     AutoPropDescVector descs(cx);
     if (!ReadPropertyDescriptors(cx, props, false, &ids, &descs))
         return false;
     size_t n = ids.length();
 
-    AutoPropDescVector unwrappedDescs(cx);
     for (size_t i = 0; i < n; i++) {
-        if (!unwrappedDescs.append(PropDesc()))
+        if (!dbg->unwrapPropDescInto(cx, obj, descs[i], descs[i]))
             return false;
-        if (!dbg->unwrapPropDescInto(cx, obj, descs[i], unwrappedDescs[i]))
-            return false;
-        if (!unwrappedDescs[i].checkGetter(cx) || !unwrappedDescs[i].checkSetter(cx))
+        if (!descs[i].checkGetter(cx) || !descs[i].checkSetter(cx))
             return false;
     }
 
     {
-        AutoIdVector rewrappedIds(cx);
-        AutoPropDescVector rewrappedDescs(cx);
-
         Maybe<AutoCompartment> ac;
         ac.construct(cx, obj);
         for (size_t i = 0; i < n; i++) {
-            if (!rewrappedIds.append(ids[i]) || !rewrappedDescs.append(unwrappedDescs[i]))
-                return false;
-            if (!cx->compartment()->wrapId(cx, rewrappedIds[i].address()))
-                return false;
-            if (!cx->compartment()->wrap(cx, rewrappedDescs[i]))
+            if (!cx->compartment()->wrapId(cx, ids[i].address()))
                 return false;
-            if (rewrappedDescs[i].descriptorValue().isUndefined() &&
-                !rewrappedDescs[i].makeObject(cx))
-            {
+            if (!cx->compartment()->wrap(cx, descs[i]))
                 return false;
-            }
+            if (descs[i].descriptorValue().isUndefined() && !descs[i].makeObject(cx))
+                return false;
         }
 
         ErrorCopier ec(ac, dbg->toJSObject());
         for (size_t i = 0; i < n; i++) {
             bool dummy;
-            if (!DefineProperty(cx, obj, rewrappedIds[i],
-                                rewrappedDescs[i], true, &dummy))
-            {
+            if (!DefineProperty(cx, obj, ids[i], descs[i], true, &dummy))
                 return false;
-            }
         }
     }
 
     args.rval().setUndefined();
     return true;
 }
 
 /*