Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (171527 => 171528)
--- trunk/Source/_javascript_Core/ChangeLog 2014-07-24 22:01:40 UTC (rev 171527)
+++ trunk/Source/_javascript_Core/ChangeLog 2014-07-24 22:11:12 UTC (rev 171528)
@@ -1,3 +1,17 @@
+2014-07-24 Brian J. Burg <b...@cs.washington.edu>
+
+ Web Replay: don't encode/decode primitive types that lack explicit sizes
+ https://bugs.webkit.org/show_bug.cgi?id=133430
+
+ Reviewed by Anders Carlsson.
+
+ Don't support encode/decode of unsigned long, since its size is compiler-dependent.
+
+ * replay/EncodedValue.cpp:
+ (JSC::EncodedValue::convertTo<unsigned long>):
+ (JSC::unsigned long>::encodeValue): Deleted.
+ * replay/EncodedValue.h:
+
2014-07-24 Mark Lam <mark....@apple.com>
JSWrapperMap's jsWrapperForObject() needs to defer GC.
Modified: trunk/Source/_javascript_Core/replay/EncodedValue.cpp (171527 => 171528)
--- trunk/Source/_javascript_Core/replay/EncodedValue.cpp 2014-07-24 22:01:40 UTC (rev 171527)
+++ trunk/Source/_javascript_Core/replay/EncodedValue.cpp 2014-07-24 22:11:12 UTC (rev 171528)
@@ -90,11 +90,6 @@
return EncodedValue(InspectorBasicValue::create((double)value));
}
-template<> EncodedValue ScalarEncodingTraits<unsigned long>::encodeValue(const unsigned long& value)
-{
- return EncodedValue(InspectorBasicValue::create((double)value));
-}
-
template<> bool EncodedValue::convertTo<bool>()
{
bool result;
@@ -158,15 +153,6 @@
return result;
}
-template<> unsigned long EncodedValue::convertTo<unsigned long>()
-{
- unsigned long result;
- bool castSucceeded = m_value->asNumber(&result);
- ASSERT_UNUSED(castSucceeded, castSucceeded);
-
- return result;
-}
-
template<> String EncodedValue::convertTo<String>()
{
String result;
Modified: trunk/Source/_javascript_Core/replay/EncodedValue.h (171527 => 171528)
--- trunk/Source/_javascript_Core/replay/EncodedValue.h 2014-07-24 22:01:40 UTC (rev 171527)
+++ trunk/Source/_javascript_Core/replay/EncodedValue.h 2014-07-24 22:11:12 UTC (rev 171528)
@@ -92,7 +92,6 @@
template<> JS_EXPORT_PRIVATE int64_t EncodedValue::convertTo<int64_t>();
template<> JS_EXPORT_PRIVATE uint32_t EncodedValue::convertTo<uint32_t>();
template<> JS_EXPORT_PRIVATE uint64_t EncodedValue::convertTo<uint64_t>();
-template<> JS_EXPORT_PRIVATE unsigned long EncodedValue::convertTo<unsigned long>();
template<> JS_EXPORT_PRIVATE String EncodedValue::convertTo<String>();
template<typename T>
@@ -156,7 +155,6 @@
template<> struct EncodingTraits<int64_t> : public ScalarEncodingTraits<int64_t> { };
template<> struct EncodingTraits<uint32_t> : public ScalarEncodingTraits<uint32_t> { };
template<> struct EncodingTraits<uint64_t> : public ScalarEncodingTraits<uint64_t> { };
-template<> struct EncodingTraits<unsigned long> : public ScalarEncodingTraits<unsigned long> { };
template<> struct EncodingTraits<String> : public ScalarEncodingTraits<String> {
static EncodedValue encodeValue(const String& value)
Modified: trunk/Source/WebCore/ChangeLog (171527 => 171528)
--- trunk/Source/WebCore/ChangeLog 2014-07-24 22:01:40 UTC (rev 171527)
+++ trunk/Source/WebCore/ChangeLog 2014-07-24 22:11:12 UTC (rev 171528)
@@ -1,3 +1,25 @@
+2014-07-24 Brian J. Burg <b...@cs.washington.edu>
+
+ Web Replay: don't encode/decode primitive types that lack explicit sizes
+ https://bugs.webkit.org/show_bug.cgi?id=133430
+
+ Reviewed by Anders Carlsson.
+
+ Remove uses of unsigned long in encode/decode methods because the type lacks an
+ explicit size. Move frame index serialization away from using unsigned long.
+
+ * replay/ReplayController.cpp:
+ (WebCore::logDispatchedDOMEvent): Fix the format string.
+ * replay/SerializationMethods.cpp:
+ (WebCore::frameIndexFromDocument):
+ (WebCore::frameIndexFromFrame):
+ (WebCore::documentFromFrameIndex):
+ (WebCore::frameFromFrameIndex):
+ (JSC::EncodingTraits<PluginData>::encodeValue):
+ (JSC::EncodingTraits<PluginData>::decodeValue):
+ * replay/SerializationMethods.h:
+ * replay/WebInputs.json: Remove primitive types without explicit sizes.
+
2014-07-24 Pratik Solanki <psola...@apple.com>
Sharing SharedBuffer between WebCore and ImageIO is racy and crash prone
Modified: trunk/Source/WebCore/replay/ReplayController.cpp (171527 => 171528)
--- trunk/Source/WebCore/replay/ReplayController.cpp 2014-07-24 22:01:40 UTC (rev 171527)
+++ trunk/Source/WebCore/replay/ReplayController.cpp 2014-07-24 22:11:12 UTC (rev 171528)
@@ -67,14 +67,14 @@
// A DOM event is unrelated if it is being dispatched to a document that is neither capturing nor replaying.
if (Node* node = target->toNode()) {
- LOG(WebReplay, "%-20s --->%s DOM event: type=%s, target=%lu/node[%p] %s\n", "ReplayEvents",
+ LOG(WebReplay, "%-20s --->%s DOM event: type=%s, target=%u/node[%p] %s\n", "ReplayEvents",
(eventIsUnrelated) ? "Unrelated" : "Dispatching",
event.type().string().utf8().data(),
frameIndexFromDocument((node->inDocument()) ? &node->document() : node->ownerDocument()),
node,
node->nodeName().utf8().data());
} else if (DOMWindow* window = target->toDOMWindow()) {
- LOG(WebReplay, "%-20s --->%s DOM event: type=%s, target=%lu/window[%p] %s\n", "ReplayEvents",
+ LOG(WebReplay, "%-20s --->%s DOM event: type=%s, target=%u/window[%p] %s\n", "ReplayEvents",
(eventIsUnrelated) ? "Unrelated" : "Dispatching",
event.type().string().utf8().data(),
frameIndexFromDocument(window->document()),
Modified: trunk/Source/WebCore/replay/SerializationMethods.cpp (171527 => 171528)
--- trunk/Source/WebCore/replay/SerializationMethods.cpp 2014-07-24 22:01:40 UTC (rev 171527)
+++ trunk/Source/WebCore/replay/SerializationMethods.cpp 2014-07-24 22:11:12 UTC (rev 171528)
@@ -72,18 +72,18 @@
namespace WebCore {
-unsigned long frameIndexFromDocument(const Document* document)
+uint32_t frameIndexFromDocument(const Document* document)
{
ASSERT(document);
ASSERT(document->frame());
return frameIndexFromFrame(document->frame());
}
-unsigned long frameIndexFromFrame(const Frame* targetFrame)
+uint32_t frameIndexFromFrame(const Frame* targetFrame)
{
ASSERT(targetFrame);
- unsigned long currentIndex = 0;
+ uint32_t currentIndex = 0;
const Frame* mainFrame = &targetFrame->tree().top();
for (const Frame* frame = mainFrame; frame; ++currentIndex, frame = frame->tree().traverseNext(mainFrame)) {
if (frame == targetFrame)
@@ -94,20 +94,20 @@
return 0;
}
-Document* documentFromFrameIndex(Page* page, unsigned long frameIndex)
+Document* documentFromFrameIndex(Page* page, uint32_t frameIndex)
{
Frame* frame = frameFromFrameIndex(page, frameIndex);
return frame ? frame->document() : nullptr;
}
-Frame* frameFromFrameIndex(Page* page, unsigned long frameIndex)
+Frame* frameFromFrameIndex(Page* page, uint32_t frameIndex)
{
ASSERT(page);
ASSERT(frameIndex >= 0);
MainFrame* mainFrame = &page->mainFrame();
Frame* frame = mainFrame;
- unsigned long currentIndex = 0;
+ uint32_t currentIndex = 0;
for (; currentIndex < frameIndex && frame; ++currentIndex, frame = frame->tree().traverseNext(mainFrame)) { }
return frame;
@@ -294,7 +294,7 @@
DECODE_TYPE_WITH_KEY(encodedValue, Vector<KeypressCommand>, commands);
#endif
- PlatformKeyboardEvent platformEvent = PlatformKeyboardEvent(type, text, unmodifiedText, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, macCharCode, autoRepeat, keypad, systemKey, modifiers, timestamp);
+ PlatformKeyboardEvent platformEvent = PlatformKeyboardEvent(type, text, unmodifiedText, keyIdentifier, WTF::safeCast<int>(windowsVirtualKeyCode), WTF::safeCast<int>(nativeVirtualKeyCode), WTF::safeCast<int>(macCharCode), autoRepeat, keypad, systemKey, modifiers, timestamp);
#if USE(APPKIT)
input = std::make_unique<PlatformKeyboardEventAppKit>(platformEvent, handledByInputMethod, commands);
#else
@@ -445,9 +445,13 @@
{
EncodedValue encodedData = EncodedValue::createObject();
+ Vector<uint32_t> castedMimePluginIndices(input->mimePluginIndices().size());
+ for (uint32_t index : input->mimePluginIndices())
+ castedMimePluginIndices.append(WTF::safeCast<uint32_t>(index));
+
ENCODE_TYPE_WITH_KEY(encodedData, Vector<PluginInfo>, plugins, input->plugins());
ENCODE_TYPE_WITH_KEY(encodedData, Vector<MimeClassInfo>, mimes, input->mimes());
- ENCODE_TYPE_WITH_KEY(encodedData, Vector<size_t>, mimePluginIndices, input->mimePluginIndices());
+ ENCODE_TYPE_WITH_KEY(encodedData, Vector<uint32_t>, mimePluginIndices, castedMimePluginIndices);
return encodedData;
}
@@ -464,10 +468,14 @@
{
DECODE_TYPE_WITH_KEY(encodedData, Vector<PluginInfo>, plugins);
DECODE_TYPE_WITH_KEY(encodedData, Vector<MimeClassInfo>, mimes);
- DECODE_TYPE_WITH_KEY(encodedData, Vector<size_t>, mimePluginIndices);
+ DECODE_TYPE_WITH_KEY(encodedData, Vector<uint32_t>, mimePluginIndices);
- input = adoptRef(new DeserializedPluginData(plugins, mimes, mimePluginIndices));
+ Vector<size_t> castedMimePluginIndices(mimePluginIndices.size());
+ for (uint32_t index : mimePluginIndices)
+ castedMimePluginIndices.append(WTF::safeCast<size_t>(index));
+ input = adoptRef(new DeserializedPluginData(plugins, mimes, castedMimePluginIndices));
+
return true;
}
Modified: trunk/Source/WebCore/replay/SerializationMethods.h (171527 => 171528)
--- trunk/Source/WebCore/replay/SerializationMethods.h 2014-07-24 22:01:40 UTC (rev 171527)
+++ trunk/Source/WebCore/replay/SerializationMethods.h 2014-07-24 22:11:12 UTC (rev 171528)
@@ -50,10 +50,10 @@
struct KeypressCommand;
#endif
-unsigned long frameIndexFromDocument(const Document*);
-unsigned long frameIndexFromFrame(const Frame*);
-Document* documentFromFrameIndex(Page*, unsigned long frameIndex);
-Frame* frameFromFrameIndex(Page*, unsigned long frameIndex);
+uint32_t frameIndexFromDocument(const Document*);
+uint32_t frameIndexFromFrame(const Frame*);
+Document* documentFromFrameIndex(Page*, uint32_t frameIndex);
+Frame* frameFromFrameIndex(Page*, uint32_t frameIndex);
} // namespace WebCore
Modified: trunk/Source/WebCore/replay/WebInputs.json (171527 => 171528)
--- trunk/Source/WebCore/replay/WebInputs.json 2014-07-24 22:01:40 UTC (rev 171527)
+++ trunk/Source/WebCore/replay/WebInputs.json 2014-07-24 22:11:12 UTC (rev 171528)
@@ -3,10 +3,10 @@
"Global": [
{ "name": "bool", "mode": "SCALAR" },
{ "name": "double", "mode": "SCALAR" },
- { "name": "int", "mode": "SCALAR" },
- { "name": "unsigned", "mode": "SCALAR" },
- { "name": "unsigned long", "mode": "SCALAR" },
- { "name": "unsigned long long", "mode": "SCALAR" }
+ { "name": "uint32_t", "mode": "SCALAR", "description": "Unsigned 32-bit integer." },
+ { "name": "uint64_t", "mode": "SCALAR", "description": "Unsigned 64-bit integer." },
+ { "name": "int32_t", "mode": "SCALAR", "description": "Signed 32-bit integer." },
+ { "name": "int64_t", "mode": "SCALAR", "description": "Signed 64-bit integer." }
],
"WTF": [