Title: [127753] trunk/Source/WebKit2
- Revision
- 127753
- Author
- msab...@apple.com
- Date
- 2012-09-06 10:14:32 -0700 (Thu, 06 Sep 2012)
Log Message
WebKit2 IPC always sends strings using 16 bit data format
https://bugs.webkit.org/show_bug.cgi?id=95811
Reviewed by Benjamin Poulain.
Changed string encoding to pass an 8bit flag and then send either 8 or 16 bit
character data.
* Platform/CoreIPC/ArgumentCoders.cpp:
(CoreIPC::::encode):
(CoreIPC::decodeStringText): New templatized string creation and decoder method.
(CoreIPC::::decode):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (127752 => 127753)
--- trunk/Source/WebKit2/ChangeLog 2012-09-06 17:13:48 UTC (rev 127752)
+++ trunk/Source/WebKit2/ChangeLog 2012-09-06 17:14:32 UTC (rev 127753)
@@ -1,3 +1,18 @@
+2012-09-06 Michael Saboff <msab...@apple.com>
+
+ WebKit2 IPC always sends strings using 16 bit data format
+ https://bugs.webkit.org/show_bug.cgi?id=95811
+
+ Reviewed by Benjamin Poulain.
+
+ Changed string encoding to pass an 8bit flag and then send either 8 or 16 bit
+ character data.
+
+ * Platform/CoreIPC/ArgumentCoders.cpp:
+ (CoreIPC::::encode):
+ (CoreIPC::decodeStringText): New templatized string creation and decoder method.
+ (CoreIPC::::decode):
+
2012-09-06 Carlos Garcia Campos <cgar...@igalia.com>
[GTK] [WK2] Crash when navigating between pages
Modified: trunk/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.cpp (127752 => 127753)
--- trunk/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.cpp 2012-09-06 17:13:48 UTC (rev 127752)
+++ trunk/Source/WebKit2/Platform/CoreIPC/ArgumentCoders.cpp 2012-09-06 17:14:32 UTC (rev 127753)
@@ -97,9 +97,32 @@
uint32_t length = string.length();
encoder->encode(length);
- encoder->encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.characters()), length * sizeof(UChar), __alignof(UChar));
+ bool is8Bit = string.is8Bit();
+ encoder->encodeBool(is8Bit);
+ if (is8Bit)
+ encoder->encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.characters8()), length * sizeof(LChar), __alignof(LChar));
+ else
+ encoder->encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.characters16()), length * sizeof(UChar), __alignof(UChar));
}
+template <typename CharacterType>
+static inline bool decodeStringText(ArgumentDecoder* decoder, uint32_t length, String& result)
+{
+ // Before allocating the string, make sure that the decoder buffer is big enough.
+ if (!decoder->bufferIsLargeEnoughToContain<CharacterType>(length)) {
+ decoder->markInvalid();
+ return false;
+ }
+
+ CharacterType* buffer;
+ String string = String::createUninitialized(length, buffer);
+ if (!decoder->decodeFixedLengthData(reinterpret_cast<uint8_t*>(buffer), length * sizeof(CharacterType), __alignof(CharacterType)))
+ return false;
+
+ result = string;
+ return true;
+}
+
bool ArgumentCoder<String>::decode(ArgumentDecoder* decoder, String& result)
{
uint32_t length;
@@ -112,19 +135,14 @@
return true;
}
- // Before allocating the string, make sure that the decoder buffer is big enough.
- if (!decoder->bufferIsLargeEnoughToContain<UChar>(length)) {
- decoder->markInvalid();
+ bool is8Bit;
+
+ if (!decoder->decodeBool(is8Bit))
return false;
- }
-
- UChar* buffer;
- String string = String::createUninitialized(length, buffer);
- if (!decoder->decodeFixedLengthData(reinterpret_cast<uint8_t*>(buffer), length * sizeof(UChar), __alignof(UChar)))
- return false;
-
- result = string;
- return true;
+
+ if (is8Bit)
+ return decodeStringText<LChar>(decoder, length, result);
+ return decodeStringText<UChar>(decoder, length, result);
}
} // namespace CoreIPC
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes