Title: [171682] trunk/Source/_javascript_Core
- Revision
- 171682
- Author
- b...@cs.washington.edu
- Date
- 2014-07-28 12:21:15 -0700 (Mon, 28 Jul 2014)
Log Message
Web Replay: vectors of characters should be base64-encoded
https://bugs.webkit.org/show_bug.cgi?id=135341
Reviewed by Timothy Hatcher.
Without this specialization, encode/decode methods try to create an
array of single characters in JSON, rather than treating the
vector as a binary blob.
* replay/EncodedValue.cpp:
(JSC::EncodingTraits<Vector<char>>::encodeValue): Added.
(JSC::EncodingTraits<Vector<char>>::decodeValue): Added.
* replay/EncodedValue.h:
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (171681 => 171682)
--- trunk/Source/_javascript_Core/ChangeLog 2014-07-28 19:02:20 UTC (rev 171681)
+++ trunk/Source/_javascript_Core/ChangeLog 2014-07-28 19:21:15 UTC (rev 171682)
@@ -1,3 +1,19 @@
+2014-07-28 Brian J. Burg <b...@cs.washington.edu>
+
+ Web Replay: vectors of characters should be base64-encoded
+ https://bugs.webkit.org/show_bug.cgi?id=135341
+
+ Reviewed by Timothy Hatcher.
+
+ Without this specialization, encode/decode methods try to create an
+ array of single characters in JSON, rather than treating the
+ vector as a binary blob.
+
+ * replay/EncodedValue.cpp:
+ (JSC::EncodingTraits<Vector<char>>::encodeValue): Added.
+ (JSC::EncodingTraits<Vector<char>>::decodeValue): Added.
+ * replay/EncodedValue.h:
+
2014-07-28 Brent Fulgham <bfulg...@apple.com>
[Win] Unreviewed build fix.
Modified: trunk/Source/_javascript_Core/replay/EncodedValue.cpp (171681 => 171682)
--- trunk/Source/_javascript_Core/replay/EncodedValue.cpp 2014-07-28 19:02:20 UTC (rev 171681)
+++ trunk/Source/_javascript_Core/replay/EncodedValue.cpp 2014-07-28 19:21:15 UTC (rev 171682)
@@ -55,6 +55,16 @@
return result.release();
}
+EncodedValue EncodingTraits<Vector<char>>::encodeValue(const Vector<char>& buffer)
+{
+ return EncodedValue::createString(base64Encode(buffer));
+}
+
+bool EncodingTraits<Vector<char>>::decodeValue(EncodedValue& encodedBuffer, Vector<char>& decodedValue)
+{
+ return base64Decode(encodedBuffer.convertTo<String>(), decodedValue);
+}
+
template<> EncodedValue ScalarEncodingTraits<bool>::encodeValue(const bool& value)
{
return EncodedValue(InspectorBasicValue::create(value));
Modified: trunk/Source/_javascript_Core/replay/EncodedValue.h (171681 => 171682)
--- trunk/Source/_javascript_Core/replay/EncodedValue.h 2014-07-28 19:02:20 UTC (rev 171681)
+++ trunk/Source/_javascript_Core/replay/EncodedValue.h 2014-07-28 19:21:15 UTC (rev 171682)
@@ -136,6 +136,13 @@
// so encodeValue and decodeValue are intentionally omitted here.
};
+// Specialize byte vectors to use base64 encoding.
+template<> struct EncodingTraits<Vector<char>> {
+ typedef Vector<char> DecodedType;
+ static JS_EXPORT_PRIVATE EncodedValue encodeValue(const DecodedType&);
+ static JS_EXPORT_PRIVATE bool decodeValue(EncodedValue&, DecodedType&);
+};
+
template<typename T>
struct ScalarEncodingTraits {
typedef T DecodedType;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes