Changeset 66799 in webkit
- Timestamp:
- Sep 4, 2010 5:19:55 PM (14 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r66794 r66799 1 2010-09-04 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Anders Carlsson. 4 5 Allow passing null to postMessage API functions 6 https://bugs.webkit.org/show_bug.cgi?id=45234 7 8 * Shared/APIObject.h: Add TypeNull to enum. This is only used 9 for serialization purposes, and does not represent a concrete subclass 10 of APIObject. 11 12 * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: Remove WillSubmitFormWithUserData 13 now that it is not needed. 14 15 * Shared/UserMessageCoders.h: 16 (WebKit::UserMessageEncoder::baseEncode): 17 (WebKit::UserMessageDecoder::baseDecode): 18 Add explicit encoding/decoding of null for user messages. 19 20 * UIProcess/WebContextUserMessageCoders.h: 21 (WebKit::WebContextUserMessageEncoder::encode): 22 (WebKit::WebContextUserMessageDecoder::decode): 23 * WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h: 24 (WebKit::InjectedBundleUserMessageEncoder::encode): 25 (WebKit::InjectedBundleUserMessageDecoder::decode): 26 Update UserMessageCoders subclasses to call the base class in the correct 27 way to work with null messages. This means moving the encoding/decoding 28 of the type down to the base class, which is a nice cleanup. 29 30 * UIProcess/WebPageProxy.cpp: 31 (WebKit::WebPageProxy::didReceiveMessage): 32 Remove now redundant WillSubmitFormWithUserData implementation. 33 34 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 35 (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm): 36 Ditto. 37 1 38 2010-09-03 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> 2 39 -
trunk/WebKit2/Shared/APIObject.h
r66619 r66799 35 35 enum Type { 36 36 // Base types 37 TypeNull, 37 38 TypeArray, 38 39 TypeData, -
trunk/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h
r66789 r66799 68 68 TakeFocus, 69 69 WillSubmitForm, 70 WillSubmitFormWithUserData,71 70 72 71 BackForwardAddItem, -
trunk/WebKit2/Shared/UserMessageCoders.h
r66693 r66799 33 33 namespace WebKit { 34 34 35 // - Null -> Null 35 36 // - Array -> Array 36 37 // - Dictionary -> Dictionary … … 40 41 class UserMessageEncoder { 41 42 public: 42 bool baseEncode(CoreIPC::ArgumentEncoder* encoder, APIObject::Type type) const43 bool baseEncode(CoreIPC::ArgumentEncoder* encoder, APIObject::Type& type) const 43 44 { 45 if (!m_root) { 46 encoder->encodeUInt32(APIObject::TypeNull); 47 return true; 48 } 49 50 type = m_root->type(); 51 encoder->encodeUInt32(type); 52 44 53 switch (type) { 45 54 case APIObject::TypeArray: { … … 86 95 87 96 // Handles 97 // - Null -> Null 88 98 // - Array -> Array 89 99 // - Dictionary -> Dictionary … … 93 103 class UserMessageDecoder { 94 104 public: 95 static bool baseDecode(CoreIPC::ArgumentDecoder* decoder, Owner& coder, APIObject::Type type)105 static bool baseDecode(CoreIPC::ArgumentDecoder* decoder, Owner& coder, APIObject::Type& type) 96 106 { 107 uint32_t typeAsUInt32; 108 if (!decoder->decode(typeAsUInt32)) 109 return false; 110 111 type = static_cast<APIObject::Type>(typeAsUInt32); 112 97 113 switch (type) { 98 114 case APIObject::TypeArray: { -
trunk/WebKit2/UIProcess/WebContextUserMessageCoders.h
r66688 r66799 44 44 void encode(CoreIPC::ArgumentEncoder* encoder) const 45 45 { 46 APIObject::Type type = m_root->type(); 47 encoder->encode(static_cast<uint32_t>(type)); 48 46 APIObject::Type type = APIObject::TypeNull; 49 47 if (baseEncode(encoder, type)) 50 48 return; … … 84 82 static bool decode(CoreIPC::ArgumentDecoder* decoder, WebContextUserMessageDecoder& coder) 85 83 { 86 uint32_t type;87 if (! decoder->decode(type))84 APIObject::Type type = APIObject::TypeNull; 85 if (!Base::baseDecode(decoder, coder, type)) 88 86 return false; 89 87 90 if (!Base::baseDecode(decoder, coder, static_cast<APIObject::Type>(type))) 91 return false; 92 93 // If the base decoded something into root, we are done. 94 if (coder.m_root) 88 if (coder.m_root || type == APIObject::TypeNull) 95 89 return true; 96 90 -
trunk/WebKit2/UIProcess/WebPageProxy.cpp
r66789 r66799 577 577 Vector<std::pair<String, String> > textFieldValues; 578 578 uint64_t listenerID; 579 if (!arguments->decode(CoreIPC::Out(frameID, sourceFrameID, textFieldValues, listenerID))) 580 return; 581 582 APIObject* noUserData = 0; 583 willSubmitForm(process()->webFrame(frameID), process()->webFrame(sourceFrameID), textFieldValues, noUserData, listenerID); 584 break; 585 } 586 case WebPageProxyMessage::WillSubmitFormWithUserData: { 587 uint64_t frameID; 588 uint64_t sourceFrameID; 589 Vector<std::pair<String, String> > textFieldValues; 590 uint64_t listenerID; 591 579 592 580 RefPtr<APIObject> userData; 593 581 WebContextUserMessageDecoder messageDecoder(userData, pageNamespace()->context()); … … 599 587 break; 600 588 } 601 602 589 case WebPageProxyMessage::DidRunJavaScriptInMainFrame: { 603 590 String resultString; -
trunk/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h
r66688 r66799 44 44 void encode(CoreIPC::ArgumentEncoder* encoder) const 45 45 { 46 APIObject::Type type = m_root->type(); 47 encoder->encode(static_cast<uint32_t>(type)); 48 46 APIObject::Type type = APIObject::TypeNull; 49 47 if (baseEncode(encoder, type)) 50 48 return; … … 82 80 static bool decode(CoreIPC::ArgumentDecoder* decoder, InjectedBundleUserMessageDecoder& coder) 83 81 { 84 uint32_t type;85 if (! decoder->decode(type))82 APIObject::Type type = APIObject::TypeNull; 83 if (!Base::baseDecode(decoder, coder, type)) 86 84 return false; 87 85 88 if (!Base::baseDecode(decoder, coder, static_cast<APIObject::Type>(type))) 89 return false; 90 91 // If the base created something in root, we are done. 92 if (coder.m_root) 86 if (coder.m_root || type == APIObject::TypeNull) 93 87 return true; 94 88 -
trunk/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r66794 r66799 524 524 uint64_t listenerID = m_frame->setUpPolicyListener(function); 525 525 526 if (userData) { 527 WebProcess::shared().connection()->send(WebPageProxyMessage::WillSubmitFormWithUserData, webPage->pageID(), 528 CoreIPC::In(m_frame->frameID(), sourceFrame->frameID(), values, listenerID, InjectedBundleUserMessageEncoder(userData.get()))); 529 } else { 530 WebProcess::shared().connection()->send(WebPageProxyMessage::WillSubmitForm, webPage->pageID(), 531 CoreIPC::In(m_frame->frameID(), sourceFrame->frameID(), values, listenerID)); 532 } 526 WebProcess::shared().connection()->send(WebPageProxyMessage::WillSubmitForm, webPage->pageID(), 527 CoreIPC::In(m_frame->frameID(), sourceFrame->frameID(), values, listenerID, InjectedBundleUserMessageEncoder(userData.get()))); 533 528 } 534 529
Note: See TracChangeset
for help on using the changeset viewer.