Created
February 5, 2015 18:04
-
-
Save evilpie/ebb50cde1e65b220a3dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/js/public/StructuredClone.h b/js/public/StructuredClone.h | |
--- a/js/public/StructuredClone.h | |
+++ b/js/public/StructuredClone.h | |
@@ -235,11 +235,14 @@ JS_ReadTypedArray(JSStructuredCloneReade | |
JS_PUBLIC_API(bool) | |
JS_WriteUint32Pair(JSStructuredCloneWriter *w, uint32_t tag, uint32_t data); | |
JS_PUBLIC_API(bool) | |
JS_WriteBytes(JSStructuredCloneWriter *w, const void *p, size_t len); | |
JS_PUBLIC_API(bool) | |
+JS_WriteString(JSStructuredCloneWriter *w, JS::HandleString str); | |
+ | |
+JS_PUBLIC_API(bool) | |
JS_WriteTypedArray(JSStructuredCloneWriter *w, JS::HandleValue v); | |
#endif /* js_StructuredClone_h */ | |
diff --git a/js/src/vm/StructuredClone.cpp b/js/src/vm/StructuredClone.cpp | |
--- a/js/src/vm/StructuredClone.cpp | |
+++ b/js/src/vm/StructuredClone.cpp | |
@@ -330,16 +330,17 @@ struct JSStructuredCloneWriter { | |
// Any value passed to JS_WriteStructuredClone. | |
void *closure; | |
// List of transferable objects | |
RootedValue transferable; | |
AutoObjectVector transferableObjects; | |
+ friend bool JS_WriteString(JSStructuredCloneWriter *w, HandleString str); | |
friend bool JS_WriteTypedArray(JSStructuredCloneWriter *w, HandleValue v); | |
}; | |
JS_FRIEND_API(uint64_t) | |
js_GetSCOffset(JSStructuredCloneWriter* writer) | |
{ | |
MOZ_ASSERT(writer); | |
return writer->output().count() * sizeof(uint64_t); | |
@@ -2126,15 +2127,21 @@ JS_WriteUint32Pair(JSStructuredCloneWrit | |
JS_PUBLIC_API(bool) | |
JS_WriteBytes(JSStructuredCloneWriter *w, const void *p, size_t len) | |
{ | |
return w->output().writeBytes(p, len); | |
} | |
JS_PUBLIC_API(bool) | |
+JS_WriteString(JSStructuredCloneWriter *w, HandleString str) | |
+{ | |
+ return w->writeString(SCTAG_STRING, str); | |
+} | |
+ | |
+JS_PUBLIC_API(bool) | |
JS_WriteTypedArray(JSStructuredCloneWriter *w, HandleValue v) | |
{ | |
MOZ_ASSERT(v.isObject()); | |
assertSameCompartment(w->context(), v); | |
RootedObject obj(w->context(), &v.toObject()); | |
return w->writeTypedArray(obj); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment