Bug 1021312 - Wrap strings in CloneNonReflectors. r=mccr8
authorBobby Holley <bobbyholley@gmail.com>
Thu, 05 Jun 2014 22:32:36 -0700
changeset 206236 1ab8174e097f25b69c81fd9d9113014e88a7cf56
parent 206235 5b92083bb0e80535af7b1b673d50cf5f3063fabe
child 206237 08045ba9192ff0c932fb0f7b07d937384e18036d
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1021312
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 1021312 - Wrap strings in CloneNonReflectors. r=mccr8
js/xpconnect/src/Sandbox.cpp
--- a/js/xpconnect/src/Sandbox.cpp
+++ b/js/xpconnect/src/Sandbox.cpp
@@ -446,16 +446,18 @@ CloneNonReflectors(JSContext *cx, Mutabl
     JSAutoStructuredCloneBuffer buffer;
     AutoObjectVector rootedReflectors(cx);
     {
         // For parsing val we have to enter its compartment.
         // (unless it's a primitive)
         Maybe<JSAutoCompartment> ac;
         if (val.isObject()) {
             ac.construct(cx, &val.toObject());
+        } else if (val.isString() && !JS_WrapValue(cx, val)) {
+            return false;
         }
 
         if (!buffer.write(cx, val,
             &gForwarderStructuredCloneCallbacks,
             &rootedReflectors))
         {
             return false;
         }