Changeset 171528 in webkit
- Timestamp:
- Jul 24, 2014 3:11:12 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r171527 r171528 1 2014-07-24 Brian J. Burg <burg@cs.washington.edu> 2 3 Web Replay: don't encode/decode primitive types that lack explicit sizes 4 https://bugs.webkit.org/show_bug.cgi?id=133430 5 6 Reviewed by Anders Carlsson. 7 8 Don't support encode/decode of unsigned long, since its size is compiler-dependent. 9 10 * replay/EncodedValue.cpp: 11 (JSC::EncodedValue::convertTo<unsigned long>): 12 (JSC::unsigned long>::encodeValue): Deleted. 13 * replay/EncodedValue.h: 14 1 15 2014-07-24 Mark Lam <mark.lam@apple.com> 2 16 -
trunk/Source/JavaScriptCore/replay/EncodedValue.cpp
r167085 r171528 91 91 } 92 92 93 template<> EncodedValue ScalarEncodingTraits<unsigned long>::encodeValue(const unsigned long& value)94 {95 return EncodedValue(InspectorBasicValue::create((double)value));96 }97 98 93 template<> bool EncodedValue::convertTo<bool>() 99 94 { … … 159 154 } 160 155 161 template<> unsigned long EncodedValue::convertTo<unsigned long>()162 {163 unsigned long result;164 bool castSucceeded = m_value->asNumber(&result);165 ASSERT_UNUSED(castSucceeded, castSucceeded);166 167 return result;168 }169 170 156 template<> String EncodedValue::convertTo<String>() 171 157 { -
trunk/Source/JavaScriptCore/replay/EncodedValue.h
r170774 r171528 93 93 template<> JS_EXPORT_PRIVATE uint32_t EncodedValue::convertTo<uint32_t>(); 94 94 template<> JS_EXPORT_PRIVATE uint64_t EncodedValue::convertTo<uint64_t>(); 95 template<> JS_EXPORT_PRIVATE unsigned long EncodedValue::convertTo<unsigned long>();96 95 template<> JS_EXPORT_PRIVATE String EncodedValue::convertTo<String>(); 97 96 … … 157 156 template<> struct EncodingTraits<uint32_t> : public ScalarEncodingTraits<uint32_t> { }; 158 157 template<> struct EncodingTraits<uint64_t> : public ScalarEncodingTraits<uint64_t> { }; 159 template<> struct EncodingTraits<unsigned long> : public ScalarEncodingTraits<unsigned long> { };160 158 161 159 template<> struct EncodingTraits<String> : public ScalarEncodingTraits<String> { -
trunk/Source/WebCore/ChangeLog
r171526 r171528 1 2014-07-24 Brian J. Burg <burg@cs.washington.edu> 2 3 Web Replay: don't encode/decode primitive types that lack explicit sizes 4 https://bugs.webkit.org/show_bug.cgi?id=133430 5 6 Reviewed by Anders Carlsson. 7 8 Remove uses of unsigned long in encode/decode methods because the type lacks an 9 explicit size. Move frame index serialization away from using unsigned long. 10 11 * replay/ReplayController.cpp: 12 (WebCore::logDispatchedDOMEvent): Fix the format string. 13 * replay/SerializationMethods.cpp: 14 (WebCore::frameIndexFromDocument): 15 (WebCore::frameIndexFromFrame): 16 (WebCore::documentFromFrameIndex): 17 (WebCore::frameFromFrameIndex): 18 (JSC::EncodingTraits<PluginData>::encodeValue): 19 (JSC::EncodingTraits<PluginData>::decodeValue): 20 * replay/SerializationMethods.h: 21 * replay/WebInputs.json: Remove primitive types without explicit sizes. 22 1 23 2014-07-24 Pratik Solanki <psolanki@apple.com> 2 24 -
trunk/Source/WebCore/replay/ReplayController.cpp
r170774 r171528 68 68 // A DOM event is unrelated if it is being dispatched to a document that is neither capturing nor replaying. 69 69 if (Node* node = target->toNode()) { 70 LOG(WebReplay, "%-20s --->%s DOM event: type=%s, target=% lu/node[%p] %s\n", "ReplayEvents",70 LOG(WebReplay, "%-20s --->%s DOM event: type=%s, target=%u/node[%p] %s\n", "ReplayEvents", 71 71 (eventIsUnrelated) ? "Unrelated" : "Dispatching", 72 72 event.type().string().utf8().data(), … … 75 75 node->nodeName().utf8().data()); 76 76 } else if (DOMWindow* window = target->toDOMWindow()) { 77 LOG(WebReplay, "%-20s --->%s DOM event: type=%s, target=% lu/window[%p] %s\n", "ReplayEvents",77 LOG(WebReplay, "%-20s --->%s DOM event: type=%s, target=%u/window[%p] %s\n", "ReplayEvents", 78 78 (eventIsUnrelated) ? "Unrelated" : "Dispatching", 79 79 event.type().string().utf8().data(), -
trunk/Source/WebCore/replay/SerializationMethods.cpp
r170774 r171528 73 73 namespace WebCore { 74 74 75 u nsigned longframeIndexFromDocument(const Document* document)75 uint32_t frameIndexFromDocument(const Document* document) 76 76 { 77 77 ASSERT(document); … … 80 80 } 81 81 82 u nsigned longframeIndexFromFrame(const Frame* targetFrame)82 uint32_t frameIndexFromFrame(const Frame* targetFrame) 83 83 { 84 84 ASSERT(targetFrame); 85 85 86 u nsigned longcurrentIndex = 0;86 uint32_t currentIndex = 0; 87 87 const Frame* mainFrame = &targetFrame->tree().top(); 88 88 for (const Frame* frame = mainFrame; frame; ++currentIndex, frame = frame->tree().traverseNext(mainFrame)) { … … 95 95 } 96 96 97 Document* documentFromFrameIndex(Page* page, u nsigned longframeIndex)97 Document* documentFromFrameIndex(Page* page, uint32_t frameIndex) 98 98 { 99 99 Frame* frame = frameFromFrameIndex(page, frameIndex); … … 101 101 } 102 102 103 Frame* frameFromFrameIndex(Page* page, u nsigned longframeIndex)103 Frame* frameFromFrameIndex(Page* page, uint32_t frameIndex) 104 104 { 105 105 ASSERT(page); … … 108 108 MainFrame* mainFrame = &page->mainFrame(); 109 109 Frame* frame = mainFrame; 110 u nsigned longcurrentIndex = 0;110 uint32_t currentIndex = 0; 111 111 for (; currentIndex < frameIndex && frame; ++currentIndex, frame = frame->tree().traverseNext(mainFrame)) { } 112 112 … … 295 295 #endif 296 296 297 PlatformKeyboardEvent platformEvent = PlatformKeyboardEvent(type, text, unmodifiedText, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, macCharCode, autoRepeat, keypad, systemKey, modifiers, timestamp);297 PlatformKeyboardEvent platformEvent = PlatformKeyboardEvent(type, text, unmodifiedText, keyIdentifier, WTF::safeCast<int>(windowsVirtualKeyCode), WTF::safeCast<int>(nativeVirtualKeyCode), WTF::safeCast<int>(macCharCode), autoRepeat, keypad, systemKey, modifiers, timestamp); 298 298 #if USE(APPKIT) 299 299 input = std::make_unique<PlatformKeyboardEventAppKit>(platformEvent, handledByInputMethod, commands); … … 446 446 EncodedValue encodedData = EncodedValue::createObject(); 447 447 448 Vector<uint32_t> castedMimePluginIndices(input->mimePluginIndices().size()); 449 for (uint32_t index : input->mimePluginIndices()) 450 castedMimePluginIndices.append(WTF::safeCast<uint32_t>(index)); 451 448 452 ENCODE_TYPE_WITH_KEY(encodedData, Vector<PluginInfo>, plugins, input->plugins()); 449 453 ENCODE_TYPE_WITH_KEY(encodedData, Vector<MimeClassInfo>, mimes, input->mimes()); 450 ENCODE_TYPE_WITH_KEY(encodedData, Vector< size_t>, mimePluginIndices, input->mimePluginIndices());454 ENCODE_TYPE_WITH_KEY(encodedData, Vector<uint32_t>, mimePluginIndices, castedMimePluginIndices); 451 455 452 456 return encodedData; … … 465 469 DECODE_TYPE_WITH_KEY(encodedData, Vector<PluginInfo>, plugins); 466 470 DECODE_TYPE_WITH_KEY(encodedData, Vector<MimeClassInfo>, mimes); 467 DECODE_TYPE_WITH_KEY(encodedData, Vector<size_t>, mimePluginIndices); 468 469 input = adoptRef(new DeserializedPluginData(plugins, mimes, mimePluginIndices)); 471 DECODE_TYPE_WITH_KEY(encodedData, Vector<uint32_t>, mimePluginIndices); 472 473 Vector<size_t> castedMimePluginIndices(mimePluginIndices.size()); 474 for (uint32_t index : mimePluginIndices) 475 castedMimePluginIndices.append(WTF::safeCast<size_t>(index)); 476 477 input = adoptRef(new DeserializedPluginData(plugins, mimes, castedMimePluginIndices)); 470 478 471 479 return true; -
trunk/Source/WebCore/replay/SerializationMethods.h
r167085 r171528 51 51 #endif 52 52 53 u nsigned longframeIndexFromDocument(const Document*);54 u nsigned longframeIndexFromFrame(const Frame*);55 Document* documentFromFrameIndex(Page*, u nsigned longframeIndex);56 Frame* frameFromFrameIndex(Page*, u nsigned longframeIndex);53 uint32_t frameIndexFromDocument(const Document*); 54 uint32_t frameIndexFromFrame(const Frame*); 55 Document* documentFromFrameIndex(Page*, uint32_t frameIndex); 56 Frame* frameFromFrameIndex(Page*, uint32_t frameIndex); 57 57 58 58 } // namespace WebCore -
trunk/Source/WebCore/replay/WebInputs.json
r167406 r171528 4 4 { "name": "bool", "mode": "SCALAR" }, 5 5 { "name": "double", "mode": "SCALAR" }, 6 { "name": " int", "mode": "SCALAR" },7 { "name": "u nsigned", "mode": "SCALAR" },8 { "name": " unsigned long", "mode": "SCALAR" },9 { "name": " unsigned long long", "mode": "SCALAR" }6 { "name": "uint32_t", "mode": "SCALAR", "description": "Unsigned 32-bit integer." }, 7 { "name": "uint64_t", "mode": "SCALAR", "description": "Unsigned 64-bit integer." }, 8 { "name": "int32_t", "mode": "SCALAR", "description": "Signed 32-bit integer." }, 9 { "name": "int64_t", "mode": "SCALAR", "description": "Signed 64-bit integer." } 10 10 ], 11 11
Note: See TracChangeset
for help on using the changeset viewer.