Root strings in native iterators when converting from array of jsids, bug 719686. r=dvander
authorBrian Hackett <bhackett1024@gmail.com>
Fri, 20 Jan 2012 16:22:16 -0800
changeset 86278 0c8e2e79385131cebc9f72554dc41391813c2b62
parent 86277 7afd96e2977e7d67d7dec70ba2132f34f123cfd7
child 86279 374975f24277430b46c4dd87d93b5eeed80548a2
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs719686
milestone12.0a1
Root strings in native iterators when converting from array of jsids, bug 719686. r=dvander
js/src/jsiter.cpp
--- a/js/src/jsiter.cpp
+++ b/js/src/jsiter.cpp
@@ -508,22 +508,23 @@ NativeIterator::allocateIterator(JSConte
 {
     size_t plength = props.length();
     NativeIterator *ni = (NativeIterator *)
         cx->malloc_(sizeof(NativeIterator)
                     + plength * sizeof(JSString *)
                     + slength * sizeof(Shape *));
     if (!ni)
         return NULL;
+    AutoValueVector strings(cx);
     ni->props_array = ni->props_cursor = (HeapPtr<JSFlatString> *) (ni + 1);
     ni->props_end = ni->props_array + plength;
     if (plength) {
         for (size_t i = 0; i < plength; i++) {
             JSFlatString *str = IdToString(cx, props[i]);
-            if (!str)
+            if (!str || !strings.append(StringValue(str)))
                 return NULL;
             ni->props_array[i].init(str);
         }
     }
     return ni;
 }
 
 inline void