Changeset 161472 in webkit
- Timestamp:
- Jan 7, 2014, 5:03:44 PM (12 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 added
- 2 edited
-
ChangeLog (modified) (1 diff)
-
Scripts/webkit2/MessageReceiver-expected.cpp (added)
-
Scripts/webkit2/Messages-expected.h (added)
-
Scripts/webkit2/messages_unittest.py (modified) (3 diffs)
-
Scripts/webkit2/test-messages.in (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r161452 r161472 1 2014-01-07 Simon Fraser <simon.fraser@apple.com> 2 3 Move expected results out of messages_unittest.py into separate files 4 https://bugs.webkit.org/show_bug.cgi?id=126602 5 6 Reviewed by Anders Carlsson. 7 8 Uninline the test input and output from messages_unittest.py to make 9 it easier to add more tests. 10 11 * Scripts/webkit2/MessageReceiver-expected.cpp: Added. 12 (WebKit::WebPage::didReceiveWebPageMessage): 13 (WebKit::WebPage::didReceiveSyncWebPageMessage): 14 * Scripts/webkit2/Messages-expected.h: Added. 15 * Scripts/webkit2/messages_unittest.py: 16 (ParsingTest.test_receiver): 17 * Scripts/webkit2/test-messages.in: Added. 18 1 19 2014-01-07 Commit Queue <commit-queue@webkit.org> 2 20 -
trunk/Source/WebKit2/Scripts/webkit2/messages_unittest.py
r161148 r161472 21 21 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 22 23 import os 23 24 import unittest 24 25 from StringIO import StringIO … … 27 28 import parser 28 29 29 _messages_file_contents = """# Copyright (C) 2010 Apple Inc. All rights reserved. 30 # 31 # Redistribution and use in source and binary forms, with or without 32 # modification, are permitted provided that the following conditions 33 # are met: 34 # 1. Redistributions of source code must retain the above copyright 35 # notice, this list of conditions and the following disclaimer. 36 # 2. Redistributions in binary form must reproduce the above copyright 37 # notice, this list of conditions and the following disclaimer in the 38 # documentation and/or other materials provided with the distribution. 39 # 40 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND 41 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 42 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 43 # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR 44 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 45 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 46 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 47 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 48 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 49 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 50 51 #if ENABLE(WEBKIT2) 52 #if NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND 53 54 messages -> WebPage LegacyReceiver { 55 LoadURL(String url) 56 #if ENABLE(TOUCH_EVENTS) 57 LoadSomething(String url) 58 #if NESTED_MESSAGE_CONDITION || SOME_OTHER_MESSAGE_CONDITION 59 TouchEvent(WebKit::WebTouchEvent event) 60 #endif 61 #if NESTED_MESSAGE_CONDITION && SOME_OTHER_MESSAGE_CONDITION 62 AddEvent(WebKit::WebTouchEvent event) 63 #endif 64 LoadSomethingElse(String url) 65 #endif 66 DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction) 67 Close() 68 69 PreferencesDidChange(WebKit::WebPreferencesStore store) 70 SendDoubleAndFloat(double d, float f) 71 SendInts(Vector<uint64_t> ints, Vector<Vector<uint64_t>> intVectors) 72 73 CreatePlugin(uint64_t pluginInstanceID, WebKit::Plugin::Parameters parameters) -> (bool result) 74 RunJavaScriptAlert(uint64_t frameID, String message) -> () 75 GetPlugins(bool refresh) -> (Vector<WebCore::PluginInfo> plugins) 76 GetPluginProcessConnection(String pluginPath) -> (IPC::Connection::Handle connectionHandle) Delayed 77 78 TestMultipleAttributes() -> () WantsConnection Delayed 79 80 TestParameterAttributes([AttributeOne AttributeTwo] uint64_t foo, double bar, [AttributeThree] double baz) 81 82 TemplateTest(HashMap<String, std::pair<String, uint64_t>> a) 83 84 #if PLATFORM(MAC) 85 DidCreateWebProcessConnection(IPC::MachPort connectionIdentifier) 86 #endif 87 88 #if PLATFORM(MAC) 89 # Keyboard support 90 InterpretKeyEvent(uint32_t type) -> (Vector<WebCore::KeypressCommand> commandName) 91 #endif 92 93 #if ENABLE(DEPRECATED_FEATURE) 94 DeprecatedOperation(IPC::DummyType dummy) 95 #endif 96 97 #if ENABLE(EXPERIMENTAL_FEATURE) 98 ExperimentalOperation(IPC::DummyType dummy) 99 #endif 100 } 101 102 #endif 103 #endif 104 """ 30 print os.getcwd() 31 32 script_directory = os.path.dirname(os.path.realpath(__file__)) 33 34 with open(os.path.join(script_directory, 'test-messages.in')) as file: 35 _messages_file_contents = file.read() 36 37 with open(os.path.join(script_directory, 'Messages-expected.h')) as file: 38 _expected_header = file.read() 39 40 with open(os.path.join(script_directory, 'MessageReceiver-expected.cpp')) as file: 41 _expected_receiver_implementation = file.read() 105 42 106 43 _expected_results = { … … 314 251 self.check_message(message, _expected_results['messages'][index]) 315 252 316 _expected_header = """/*317 * Copyright (C) 2010 Apple Inc. All rights reserved.318 *319 * Redistribution and use in source and binary forms, with or without320 * modification, are permitted provided that the following conditions321 * are met:322 * 1. Redistributions of source code must retain the above copyright323 * notice, this list of conditions and the following disclaimer.324 * 2. Redistributions in binary form must reproduce the above copyright325 * notice, this list of conditions and the following disclaimer in the326 * documentation and/or other materials provided with the distribution.327 *328 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND329 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED330 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE331 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR332 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL333 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR334 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER335 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,336 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE337 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.338 */339 340 #ifndef WebPageMessages_h341 #define WebPageMessages_h342 343 #if (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND))344 345 #include "Arguments.h"346 #include "Connection.h"347 #include "MessageEncoder.h"348 #include "Plugin.h"349 #include "StringReference.h"350 #include <WebCore/KeyboardEvent.h>351 #include <WebCore/PluginData.h>352 #include <utility>353 #include <wtf/HashMap.h>354 #include <wtf/ThreadSafeRefCounted.h>355 #include <wtf/Vector.h>356 #include <wtf/text/WTFString.h>357 358 namespace IPC {359 class Connection;360 class DummyType;361 class MachPort;362 }363 364 namespace WTF {365 class String;366 }367 368 namespace WebKit {369 struct WebPreferencesStore;370 class WebTouchEvent;371 }372 373 namespace Messages {374 namespace WebPage {375 376 static inline IPC::StringReference messageReceiverName()377 {378 return IPC::StringReference("WebPage");379 }380 381 class LoadURL {382 public:383 typedef std::tuple<String> DecodeType;384 385 static IPC::StringReference receiverName() { return messageReceiverName(); }386 static IPC::StringReference name() { return IPC::StringReference("LoadURL"); }387 static const bool isSync = false;388 389 explicit LoadURL(const String& url)390 : m_arguments(url)391 {392 }393 394 const std::tuple<const String&> arguments() const395 {396 return m_arguments;397 }398 399 private:400 std::tuple<const String&> m_arguments;401 };402 403 #if ENABLE(TOUCH_EVENTS)404 class LoadSomething {405 public:406 typedef std::tuple<String> DecodeType;407 408 static IPC::StringReference receiverName() { return messageReceiverName(); }409 static IPC::StringReference name() { return IPC::StringReference("LoadSomething"); }410 static const bool isSync = false;411 412 explicit LoadSomething(const String& url)413 : m_arguments(url)414 {415 }416 417 const std::tuple<const String&> arguments() const418 {419 return m_arguments;420 }421 422 private:423 std::tuple<const String&> m_arguments;424 };425 #endif426 427 #if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION || SOME_OTHER_MESSAGE_CONDITION))428 class TouchEvent {429 public:430 typedef std::tuple<WebKit::WebTouchEvent> DecodeType;431 432 static IPC::StringReference receiverName() { return messageReceiverName(); }433 static IPC::StringReference name() { return IPC::StringReference("TouchEvent"); }434 static const bool isSync = false;435 436 explicit TouchEvent(const WebKit::WebTouchEvent& event)437 : m_arguments(event)438 {439 }440 441 const std::tuple<const WebKit::WebTouchEvent&> arguments() const442 {443 return m_arguments;444 }445 446 private:447 std::tuple<const WebKit::WebTouchEvent&> m_arguments;448 };449 #endif450 451 #if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION && SOME_OTHER_MESSAGE_CONDITION))452 class AddEvent {453 public:454 typedef std::tuple<WebKit::WebTouchEvent> DecodeType;455 456 static IPC::StringReference receiverName() { return messageReceiverName(); }457 static IPC::StringReference name() { return IPC::StringReference("AddEvent"); }458 static const bool isSync = false;459 460 explicit AddEvent(const WebKit::WebTouchEvent& event)461 : m_arguments(event)462 {463 }464 465 const std::tuple<const WebKit::WebTouchEvent&> arguments() const466 {467 return m_arguments;468 }469 470 private:471 std::tuple<const WebKit::WebTouchEvent&> m_arguments;472 };473 #endif474 475 #if ENABLE(TOUCH_EVENTS)476 class LoadSomethingElse {477 public:478 typedef std::tuple<String> DecodeType;479 480 static IPC::StringReference receiverName() { return messageReceiverName(); }481 static IPC::StringReference name() { return IPC::StringReference("LoadSomethingElse"); }482 static const bool isSync = false;483 484 explicit LoadSomethingElse(const String& url)485 : m_arguments(url)486 {487 }488 489 const std::tuple<const String&> arguments() const490 {491 return m_arguments;492 }493 494 private:495 std::tuple<const String&> m_arguments;496 };497 #endif498 499 class DidReceivePolicyDecision {500 public:501 typedef std::tuple<uint64_t, uint64_t, uint32_t> DecodeType;502 503 static IPC::StringReference receiverName() { return messageReceiverName(); }504 static IPC::StringReference name() { return IPC::StringReference("DidReceivePolicyDecision"); }505 static const bool isSync = false;506 507 DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction)508 : m_arguments(frameID, listenerID, policyAction)509 {510 }511 512 const std::tuple<uint64_t, uint64_t, uint32_t> arguments() const513 {514 return m_arguments;515 }516 517 private:518 std::tuple<uint64_t, uint64_t, uint32_t> m_arguments;519 };520 521 class Close {522 public:523 typedef std::tuple<> DecodeType;524 525 static IPC::StringReference receiverName() { return messageReceiverName(); }526 static IPC::StringReference name() { return IPC::StringReference("Close"); }527 static const bool isSync = false;528 529 const std::tuple<> arguments() const530 {531 return m_arguments;532 }533 534 private:535 std::tuple<> m_arguments;536 };537 538 class PreferencesDidChange {539 public:540 typedef std::tuple<WebKit::WebPreferencesStore> DecodeType;541 542 static IPC::StringReference receiverName() { return messageReceiverName(); }543 static IPC::StringReference name() { return IPC::StringReference("PreferencesDidChange"); }544 static const bool isSync = false;545 546 explicit PreferencesDidChange(const WebKit::WebPreferencesStore& store)547 : m_arguments(store)548 {549 }550 551 const std::tuple<const WebKit::WebPreferencesStore&> arguments() const552 {553 return m_arguments;554 }555 556 private:557 std::tuple<const WebKit::WebPreferencesStore&> m_arguments;558 };559 560 class SendDoubleAndFloat {561 public:562 typedef std::tuple<double, float> DecodeType;563 564 static IPC::StringReference receiverName() { return messageReceiverName(); }565 static IPC::StringReference name() { return IPC::StringReference("SendDoubleAndFloat"); }566 static const bool isSync = false;567 568 SendDoubleAndFloat(double d, float f)569 : m_arguments(d, f)570 {571 }572 573 const std::tuple<double, float> arguments() const574 {575 return m_arguments;576 }577 578 private:579 std::tuple<double, float> m_arguments;580 };581 582 class SendInts {583 public:584 typedef std::tuple<Vector<uint64_t>, Vector<Vector<uint64_t>>> DecodeType;585 586 static IPC::StringReference receiverName() { return messageReceiverName(); }587 static IPC::StringReference name() { return IPC::StringReference("SendInts"); }588 static const bool isSync = false;589 590 SendInts(const Vector<uint64_t>& ints, const Vector<Vector<uint64_t>>& intVectors)591 : m_arguments(ints, intVectors)592 {593 }594 595 const std::tuple<const Vector<uint64_t>&, const Vector<Vector<uint64_t>>&> arguments() const596 {597 return m_arguments;598 }599 600 private:601 std::tuple<const Vector<uint64_t>&, const Vector<Vector<uint64_t>>&> m_arguments;602 };603 604 class CreatePlugin {605 public:606 typedef std::tuple<uint64_t, WebKit::Plugin::Parameters> DecodeType;607 608 static IPC::StringReference receiverName() { return messageReceiverName(); }609 static IPC::StringReference name() { return IPC::StringReference("CreatePlugin"); }610 static const bool isSync = true;611 612 typedef IPC::Arguments1<bool&> Reply;613 CreatePlugin(uint64_t pluginInstanceID, const WebKit::Plugin::Parameters& parameters)614 : m_arguments(pluginInstanceID, parameters)615 {616 }617 618 const std::tuple<uint64_t, const WebKit::Plugin::Parameters&> arguments() const619 {620 return m_arguments;621 }622 623 private:624 std::tuple<uint64_t, const WebKit::Plugin::Parameters&> m_arguments;625 };626 627 class RunJavaScriptAlert {628 public:629 typedef std::tuple<uint64_t, String> DecodeType;630 631 static IPC::StringReference receiverName() { return messageReceiverName(); }632 static IPC::StringReference name() { return IPC::StringReference("RunJavaScriptAlert"); }633 static const bool isSync = true;634 635 typedef IPC::Arguments0 Reply;636 RunJavaScriptAlert(uint64_t frameID, const String& message)637 : m_arguments(frameID, message)638 {639 }640 641 const std::tuple<uint64_t, const String&> arguments() const642 {643 return m_arguments;644 }645 646 private:647 std::tuple<uint64_t, const String&> m_arguments;648 };649 650 class GetPlugins {651 public:652 typedef std::tuple<bool> DecodeType;653 654 static IPC::StringReference receiverName() { return messageReceiverName(); }655 static IPC::StringReference name() { return IPC::StringReference("GetPlugins"); }656 static const bool isSync = true;657 658 typedef IPC::Arguments1<Vector<WebCore::PluginInfo>&> Reply;659 explicit GetPlugins(bool refresh)660 : m_arguments(refresh)661 {662 }663 664 const std::tuple<bool> arguments() const665 {666 return m_arguments;667 }668 669 private:670 std::tuple<bool> m_arguments;671 };672 673 class GetPluginProcessConnection {674 public:675 typedef std::tuple<String> DecodeType;676 677 static IPC::StringReference receiverName() { return messageReceiverName(); }678 static IPC::StringReference name() { return IPC::StringReference("GetPluginProcessConnection"); }679 static const bool isSync = true;680 681 struct DelayedReply : public ThreadSafeRefCounted<DelayedReply> {682 DelayedReply(PassRefPtr<IPC::Connection>, std::unique_ptr<IPC::MessageEncoder>);683 ~DelayedReply();684 685 bool send(const IPC::Connection::Handle& connectionHandle);686 687 private:688 RefPtr<IPC::Connection> m_connection;689 std::unique_ptr<IPC::MessageEncoder> m_encoder;690 };691 692 typedef IPC::Arguments1<IPC::Connection::Handle&> Reply;693 explicit GetPluginProcessConnection(const String& pluginPath)694 : m_arguments(pluginPath)695 {696 }697 698 const std::tuple<const String&> arguments() const699 {700 return m_arguments;701 }702 703 private:704 std::tuple<const String&> m_arguments;705 };706 707 class TestMultipleAttributes {708 public:709 typedef std::tuple<> DecodeType;710 711 static IPC::StringReference receiverName() { return messageReceiverName(); }712 static IPC::StringReference name() { return IPC::StringReference("TestMultipleAttributes"); }713 static const bool isSync = true;714 715 struct DelayedReply : public ThreadSafeRefCounted<DelayedReply> {716 DelayedReply(PassRefPtr<IPC::Connection>, std::unique_ptr<IPC::MessageEncoder>);717 ~DelayedReply();718 719 bool send();720 721 private:722 RefPtr<IPC::Connection> m_connection;723 std::unique_ptr<IPC::MessageEncoder> m_encoder;724 };725 726 typedef IPC::Arguments0 Reply;727 const std::tuple<> arguments() const728 {729 return m_arguments;730 }731 732 private:733 std::tuple<> m_arguments;734 };735 736 class TestParameterAttributes {737 public:738 typedef std::tuple<uint64_t, double, double> DecodeType;739 740 static IPC::StringReference receiverName() { return messageReceiverName(); }741 static IPC::StringReference name() { return IPC::StringReference("TestParameterAttributes"); }742 static const bool isSync = false;743 744 TestParameterAttributes(uint64_t foo, double bar, double baz)745 : m_arguments(foo, bar, baz)746 {747 }748 749 const std::tuple<uint64_t, double, double> arguments() const750 {751 return m_arguments;752 }753 754 private:755 std::tuple<uint64_t, double, double> m_arguments;756 };757 758 class TemplateTest {759 public:760 typedef std::tuple<HashMap<String, std::pair<String, uint64_t>>> DecodeType;761 762 static IPC::StringReference receiverName() { return messageReceiverName(); }763 static IPC::StringReference name() { return IPC::StringReference("TemplateTest"); }764 static const bool isSync = false;765 766 explicit TemplateTest(const HashMap<String, std::pair<String, uint64_t>>& a)767 : m_arguments(a)768 {769 }770 771 const std::tuple<const HashMap<String, std::pair<String, uint64_t>>&> arguments() const772 {773 return m_arguments;774 }775 776 private:777 std::tuple<const HashMap<String, std::pair<String, uint64_t>>&> m_arguments;778 };779 780 #if PLATFORM(MAC)781 class DidCreateWebProcessConnection {782 public:783 typedef std::tuple<IPC::MachPort> DecodeType;784 785 static IPC::StringReference receiverName() { return messageReceiverName(); }786 static IPC::StringReference name() { return IPC::StringReference("DidCreateWebProcessConnection"); }787 static const bool isSync = false;788 789 explicit DidCreateWebProcessConnection(const IPC::MachPort& connectionIdentifier)790 : m_arguments(connectionIdentifier)791 {792 }793 794 const std::tuple<const IPC::MachPort&> arguments() const795 {796 return m_arguments;797 }798 799 private:800 std::tuple<const IPC::MachPort&> m_arguments;801 };802 #endif803 804 #if PLATFORM(MAC)805 class InterpretKeyEvent {806 public:807 typedef std::tuple<uint32_t> DecodeType;808 809 static IPC::StringReference receiverName() { return messageReceiverName(); }810 static IPC::StringReference name() { return IPC::StringReference("InterpretKeyEvent"); }811 static const bool isSync = true;812 813 typedef IPC::Arguments1<Vector<WebCore::KeypressCommand>&> Reply;814 explicit InterpretKeyEvent(uint32_t type)815 : m_arguments(type)816 {817 }818 819 const std::tuple<uint32_t> arguments() const820 {821 return m_arguments;822 }823 824 private:825 std::tuple<uint32_t> m_arguments;826 };827 #endif828 829 #if ENABLE(DEPRECATED_FEATURE)830 class DeprecatedOperation {831 public:832 typedef std::tuple<IPC::DummyType> DecodeType;833 834 static IPC::StringReference receiverName() { return messageReceiverName(); }835 static IPC::StringReference name() { return IPC::StringReference("DeprecatedOperation"); }836 static const bool isSync = false;837 838 explicit DeprecatedOperation(const IPC::DummyType& dummy)839 : m_arguments(dummy)840 {841 }842 843 const std::tuple<const IPC::DummyType&> arguments() const844 {845 return m_arguments;846 }847 848 private:849 std::tuple<const IPC::DummyType&> m_arguments;850 };851 #endif852 853 #if ENABLE(EXPERIMENTAL_FEATURE)854 class ExperimentalOperation {855 public:856 typedef std::tuple<IPC::DummyType> DecodeType;857 858 static IPC::StringReference receiverName() { return messageReceiverName(); }859 static IPC::StringReference name() { return IPC::StringReference("ExperimentalOperation"); }860 static const bool isSync = false;861 862 explicit ExperimentalOperation(const IPC::DummyType& dummy)863 : m_arguments(dummy)864 {865 }866 867 const std::tuple<const IPC::DummyType&> arguments() const868 {869 return m_arguments;870 }871 872 private:873 std::tuple<const IPC::DummyType&> m_arguments;874 };875 #endif876 877 } // namespace WebPage878 } // namespace Messages879 880 #endif // (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND))881 882 #endif // WebPageMessages_h883 """884 885 _expected_receiver_implementation = """/*886 * Copyright (C) 2010 Apple Inc. All rights reserved.887 *888 * Redistribution and use in source and binary forms, with or without889 * modification, are permitted provided that the following conditions890 * are met:891 * 1. Redistributions of source code must retain the above copyright892 * notice, this list of conditions and the following disclaimer.893 * 2. Redistributions in binary form must reproduce the above copyright894 * notice, this list of conditions and the following disclaimer in the895 * documentation and/or other materials provided with the distribution.896 *897 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND898 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED899 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE900 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR901 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL902 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR903 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER904 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,905 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE906 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.907 */908 909 #include "config.h"910 911 #if (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND))912 913 #include "WebPage.h"914 915 #include "ArgumentCoders.h"916 #include "Connection.h"917 #if ENABLE(DEPRECATED_FEATURE) || ENABLE(EXPERIMENTAL_FEATURE)918 #include "DummyType.h"919 #endif920 #include "HandleMessage.h"921 #if PLATFORM(MAC)922 #include "MachPort.h"923 #endif924 #include "MessageDecoder.h"925 #include "Plugin.h"926 #include "WebCoreArgumentCoders.h"927 #if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION && SOME_OTHER_MESSAGE_CONDITION)) || (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION || SOME_OTHER_MESSAGE_CONDITION))928 #include "WebEvent.h"929 #endif930 #include "WebPageMessages.h"931 #include "WebPreferencesStore.h"932 #if PLATFORM(MAC)933 #include <WebCore/KeyboardEvent.h>934 #endif935 #include <WebCore/PluginData.h>936 #include <utility>937 #include <wtf/HashMap.h>938 #include <wtf/Vector.h>939 #include <wtf/text/WTFString.h>940 941 namespace Messages {942 943 namespace WebPage {944 945 GetPluginProcessConnection::DelayedReply::DelayedReply(PassRefPtr<IPC::Connection> connection, std::unique_ptr<IPC::MessageEncoder> encoder)946 : m_connection(connection)947 , m_encoder(std::move(encoder))948 {949 }950 951 GetPluginProcessConnection::DelayedReply::~DelayedReply()952 {953 ASSERT(!m_connection);954 }955 956 bool GetPluginProcessConnection::DelayedReply::send(const IPC::Connection::Handle& connectionHandle)957 {958 ASSERT(m_encoder);959 *m_encoder << connectionHandle;960 bool result = m_connection->sendSyncReply(std::move(m_encoder));961 m_connection = nullptr;962 return result;963 }964 965 TestMultipleAttributes::DelayedReply::DelayedReply(PassRefPtr<IPC::Connection> connection, std::unique_ptr<IPC::MessageEncoder> encoder)966 : m_connection(connection)967 , m_encoder(std::move(encoder))968 {969 }970 971 TestMultipleAttributes::DelayedReply::~DelayedReply()972 {973 ASSERT(!m_connection);974 }975 976 bool TestMultipleAttributes::DelayedReply::send()977 {978 ASSERT(m_encoder);979 bool result = m_connection->sendSyncReply(std::move(m_encoder));980 m_connection = nullptr;981 return result;982 }983 984 } // namespace WebPage985 986 } // namespace Messages987 988 namespace WebKit {989 990 void WebPage::didReceiveWebPageMessage(IPC::Connection*, IPC::MessageDecoder& decoder)991 {992 if (decoder.messageName() == Messages::WebPage::LoadURL::name()) {993 IPC::handleMessage<Messages::WebPage::LoadURL>(decoder, this, &WebPage::loadURL);994 return;995 }996 #if ENABLE(TOUCH_EVENTS)997 if (decoder.messageName() == Messages::WebPage::LoadSomething::name()) {998 IPC::handleMessage<Messages::WebPage::LoadSomething>(decoder, this, &WebPage::loadSomething);999 return;1000 }1001 #endif1002 #if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION || SOME_OTHER_MESSAGE_CONDITION))1003 if (decoder.messageName() == Messages::WebPage::TouchEvent::name()) {1004 IPC::handleMessage<Messages::WebPage::TouchEvent>(decoder, this, &WebPage::touchEvent);1005 return;1006 }1007 #endif1008 #if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION && SOME_OTHER_MESSAGE_CONDITION))1009 if (decoder.messageName() == Messages::WebPage::AddEvent::name()) {1010 IPC::handleMessage<Messages::WebPage::AddEvent>(decoder, this, &WebPage::addEvent);1011 return;1012 }1013 #endif1014 #if ENABLE(TOUCH_EVENTS)1015 if (decoder.messageName() == Messages::WebPage::LoadSomethingElse::name()) {1016 IPC::handleMessage<Messages::WebPage::LoadSomethingElse>(decoder, this, &WebPage::loadSomethingElse);1017 return;1018 }1019 #endif1020 if (decoder.messageName() == Messages::WebPage::DidReceivePolicyDecision::name()) {1021 IPC::handleMessage<Messages::WebPage::DidReceivePolicyDecision>(decoder, this, &WebPage::didReceivePolicyDecision);1022 return;1023 }1024 if (decoder.messageName() == Messages::WebPage::Close::name()) {1025 IPC::handleMessage<Messages::WebPage::Close>(decoder, this, &WebPage::close);1026 return;1027 }1028 if (decoder.messageName() == Messages::WebPage::PreferencesDidChange::name()) {1029 IPC::handleMessage<Messages::WebPage::PreferencesDidChange>(decoder, this, &WebPage::preferencesDidChange);1030 return;1031 }1032 if (decoder.messageName() == Messages::WebPage::SendDoubleAndFloat::name()) {1033 IPC::handleMessage<Messages::WebPage::SendDoubleAndFloat>(decoder, this, &WebPage::sendDoubleAndFloat);1034 return;1035 }1036 if (decoder.messageName() == Messages::WebPage::SendInts::name()) {1037 IPC::handleMessage<Messages::WebPage::SendInts>(decoder, this, &WebPage::sendInts);1038 return;1039 }1040 if (decoder.messageName() == Messages::WebPage::TestParameterAttributes::name()) {1041 IPC::handleMessage<Messages::WebPage::TestParameterAttributes>(decoder, this, &WebPage::testParameterAttributes);1042 return;1043 }1044 if (decoder.messageName() == Messages::WebPage::TemplateTest::name()) {1045 IPC::handleMessage<Messages::WebPage::TemplateTest>(decoder, this, &WebPage::templateTest);1046 return;1047 }1048 #if PLATFORM(MAC)1049 if (decoder.messageName() == Messages::WebPage::DidCreateWebProcessConnection::name()) {1050 IPC::handleMessage<Messages::WebPage::DidCreateWebProcessConnection>(decoder, this, &WebPage::didCreateWebProcessConnection);1051 return;1052 }1053 #endif1054 #if ENABLE(DEPRECATED_FEATURE)1055 if (decoder.messageName() == Messages::WebPage::DeprecatedOperation::name()) {1056 IPC::handleMessage<Messages::WebPage::DeprecatedOperation>(decoder, this, &WebPage::deprecatedOperation);1057 return;1058 }1059 #endif1060 #if ENABLE(EXPERIMENTAL_FEATURE)1061 if (decoder.messageName() == Messages::WebPage::ExperimentalOperation::name()) {1062 IPC::handleMessage<Messages::WebPage::ExperimentalOperation>(decoder, this, &WebPage::experimentalOperation);1063 return;1064 }1065 #endif1066 ASSERT_NOT_REACHED();1067 }1068 1069 void WebPage::didReceiveSyncWebPageMessage(IPC::Connection* connection, IPC::MessageDecoder& decoder, std::unique_ptr<IPC::MessageEncoder>& replyEncoder)1070 {1071 if (decoder.messageName() == Messages::WebPage::CreatePlugin::name()) {1072 IPC::handleMessage<Messages::WebPage::CreatePlugin>(decoder, *replyEncoder, this, &WebPage::createPlugin);1073 return;1074 }1075 if (decoder.messageName() == Messages::WebPage::RunJavaScriptAlert::name()) {1076 IPC::handleMessage<Messages::WebPage::RunJavaScriptAlert>(decoder, *replyEncoder, this, &WebPage::runJavaScriptAlert);1077 return;1078 }1079 if (decoder.messageName() == Messages::WebPage::GetPlugins::name()) {1080 IPC::handleMessage<Messages::WebPage::GetPlugins>(decoder, *replyEncoder, this, &WebPage::getPlugins);1081 return;1082 }1083 if (decoder.messageName() == Messages::WebPage::GetPluginProcessConnection::name()) {1084 IPC::handleMessageDelayed<Messages::WebPage::GetPluginProcessConnection>(connection, decoder, replyEncoder, this, &WebPage::getPluginProcessConnection);1085 return;1086 }1087 if (decoder.messageName() == Messages::WebPage::TestMultipleAttributes::name()) {1088 IPC::handleMessageDelayed<Messages::WebPage::TestMultipleAttributes>(connection, decoder, replyEncoder, this, &WebPage::testMultipleAttributes);1089 return;1090 }1091 #if PLATFORM(MAC)1092 if (decoder.messageName() == Messages::WebPage::InterpretKeyEvent::name()) {1093 IPC::handleMessage<Messages::WebPage::InterpretKeyEvent>(decoder, *replyEncoder, this, &WebPage::interpretKeyEvent);1094 return;1095 }1096 #endif1097 ASSERT_NOT_REACHED();1098 }1099 1100 } // namespace WebKit1101 1102 #endif // (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND))1103 """1104 253 1105 254
Note:
See TracChangeset
for help on using the changeset viewer.