void WebContext::didReceiveSyncMessage(IPC::Connection* connection, IPC::MessageDecoder& decoder, std::unique_ptr<IPC::MessageEncoder>& replyEncoder) { if (decoder.messageReceiverName() == Messages::WebContext::messageReceiverName()) { didReceiveSyncWebContextMessage(connection, decoder, replyEncoder); return; } if (decoder.messageReceiverName() == WebContextLegacyMessages::messageReceiverName() && decoder.messageName() == WebContextLegacyMessages::postSynchronousMessageMessageName()) { // FIXME: We should probably encode something in the case that the arguments do not decode correctly. WebProcessProxy* process = WebProcessProxy::fromConnection(connection); String messageName; RefPtr<API::Object> messageBody; WebContextUserMessageDecoder messageBodyDecoder(messageBody, *process); if (!decoder.decode(messageName)) return; if (!decoder.decode(messageBodyDecoder)) return; RefPtr<API::Object> returnData; didReceiveSynchronousMessageFromInjectedBundle(messageName, messageBody.get(), returnData); replyEncoder->encode(WebContextUserMessageEncoder(returnData.get(), *process)); return; } ASSERT_NOT_REACHED(); }
void WebContext::didReceiveMessage(IPC::Connection* connection, IPC::MessageDecoder& decoder) { if (decoder.messageReceiverName() == Messages::WebContext::messageReceiverName()) { didReceiveWebContextMessage(connection, decoder); return; } if (decoder.messageReceiverName() == WebContextLegacyMessages::messageReceiverName() && decoder.messageName() == WebContextLegacyMessages::postMessageMessageName()) { String messageName; RefPtr<API::Object> messageBody; WebContextUserMessageDecoder messageBodyDecoder(messageBody, *WebProcessProxy::fromConnection(connection)); if (!decoder.decode(messageName)) return; if (!decoder.decode(messageBodyDecoder)) return; didReceiveMessageFromInjectedBundle(messageName, messageBody.get()); return; } ASSERT_NOT_REACHED(); }