Bug 893222 - Part 0: Make JSRope::getCharsNonDestructiveInternal work with a null tcx. r=bhackett
☠☠ backed out by e9806317bc14 ☠ ☠
authorJustin Lebar <justin.lebar@gmail.com>
Fri, 02 Aug 2013 10:02:40 -0700
changeset 153445 4bdf8611ec571174e377ab1143851f76e6d89a39
parent 153444 93f36094bf6f86a6bc7198b359ffdec542b88bcb
child 153446 3baebe7cc6554db020223ad205b4a2ca5ced2bd9
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhackett
bugs893222
milestone25.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 893222 - Part 0: Make JSRope::getCharsNonDestructiveInternal work with a null tcx. r=bhackett
js/src/vm/String.cpp
--- a/js/src/vm/String.cpp
+++ b/js/src/vm/String.cpp
@@ -180,17 +180,22 @@ JSRope::getCharsNonDestructiveInternal(T
                                        bool nullTerminate) const
 {
     /*
      * Perform non-destructive post-order traversal of the rope, splatting
      * each node's characters into a contiguous buffer.
      */
 
     size_t n = length();
-    jschar *s = cx->pod_malloc<jschar>(n + 1);
+    jschar *s;
+    if (cx)
+        s = cx->pod_malloc<jschar>(n + 1);
+    else
+        s = js_pod_malloc<jschar>(n + 1);
+
     if (!s)
         return false;
     jschar *pos = s;
 
     Vector<const JSString *, 8, SystemAllocPolicy> nodeStack;
     if (!nodeStack.append(this))
         return false;