Title: [290505] trunk
Revision
290505
Author
[email protected]
Date
2022-02-25 05:26:25 -0800 (Fri, 25 Feb 2022)

Log Message

REGRESSION(r289580): [ iOS macOS ] TestWebKitAPI.IPCTestingAPI.CanReceiveSharedMemory is a constant timeout
https://bugs.webkit.org/show_bug.cgi?id=236744

Patch by Kimmo Kinnunen <[email protected]> on 2022-02-25
Reviewed by Antti Koivisto.

Source/WebKit:

Add new tester interface for testing IPC stream features.

Before, TestWebKitAPI.IPCTestingAPI.CanReceiveSharedMemory would test the feature of
"can reply stream sync message with shared memory" by using a RemoteRenderingBackend
message that did so. However, when the RemoteRenderingBackend was changed to use a
different stategy, this test stopped working without compile failure. The IPC testing
is currently done at JS level.

After, the new dedicated testing interface IPCStreamTester has dedicated message for
testing this feature. The test is moved to LayoutTests/ipc and made so that
it tests the feature in all currently testable processes WP uses (GPU, Networking, UI).

IPCTestingAPI is amended to return the all possible testable process names, so
the .html test can work even when ENABLE(GPU_PROCESS) is toggled.

The .html test also passes when !ENABLE(IPC_TESTING_API). Currently
ENABLE_IPC_TESTING_API == (ASAN_ENABLED || !defined(NDEBUG)) && PLATFORM(COCOA)
E.g. test tests something on Release+ASAN or Debug.

Having the test in .html also makes it possible to run the test on iOS devices.

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
* Shared/IPCStreamTester.cpp: Added.
(WebKit::IPCStreamTester::create):
(WebKit::IPCStreamTester::IPCStreamTester):
(WebKit::IPCStreamTester::initialize):
(WebKit::IPCStreamTester::stopListeningForIPC):
(WebKit::IPCStreamTester::syncMessageReturningSharedMemory1):
* Shared/IPCStreamTester.h: Copied from Source/WebKit/Shared/IPCTester.h.
* Shared/IPCStreamTester.messages.in: Copied from Source/WebKit/Shared/IPCTester.messages.in.
* Shared/IPCStreamTesterIdentifier.h: Copied from Source/WebKit/Shared/IPCTester.h.
* Shared/IPCStreamTesterProxy.messages.in: Copied from Source/WebKit/Shared/IPCTester.messages.in.
* Shared/IPCTester.cpp:
(WebKit::IPCTester::createStreamTester):
(WebKit::IPCTester::releaseStreamTester):
* Shared/IPCTester.h:
* Shared/IPCTester.messages.in:
* Shared/mac/MediaFormatReader/MediaFormatReader.cpp:
* Sources.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/IPCTestingAPI.cpp:
(WebKit::IPCTestingAPI::JSIPC::staticValues):
(WebKit::IPCTestingAPI::processTargetFromArgument):
(WebKit::IPCTestingAPI::JSIPC::processTargets):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/IPCTestingAPI.mm:

LayoutTests:

* ipc/stream-sync-reply-shared-memory-expected.txt: Added.
* ipc/stream-sync-reply-shared-memory.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (290504 => 290505)


--- trunk/LayoutTests/ChangeLog	2022-02-25 09:50:48 UTC (rev 290504)
+++ trunk/LayoutTests/ChangeLog	2022-02-25 13:26:25 UTC (rev 290505)
@@ -1,3 +1,13 @@
+2022-02-25  Kimmo Kinnunen  <[email protected]>
+
+        REGRESSION(r289580): [ iOS macOS ] TestWebKitAPI.IPCTestingAPI.CanReceiveSharedMemory is a constant timeout
+        https://bugs.webkit.org/show_bug.cgi?id=236744
+
+        Reviewed by Antti Koivisto.
+
+        * ipc/stream-sync-reply-shared-memory-expected.txt: Added.
+        * ipc/stream-sync-reply-shared-memory.html: Added.
+
 2022-02-25  Carlos Garcia Campos  <[email protected]>
 
         AX: List item marker not exposed when not a direct child of a list item

Added: trunk/LayoutTests/ipc/stream-sync-reply-shared-memory-expected.txt (0 => 290505)


--- trunk/LayoutTests/ipc/stream-sync-reply-shared-memory-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/ipc/stream-sync-reply-shared-memory-expected.txt	2022-02-25 13:26:25 UTC (rev 290505)
@@ -0,0 +1,3 @@
+
+PASS Test that stream sync message can reply with shared memory
+

Added: trunk/LayoutTests/ipc/stream-sync-reply-shared-memory.html (0 => 290505)


--- trunk/LayoutTests/ipc/stream-sync-reply-shared-memory.html	                        (rev 0)
+++ trunk/LayoutTests/ipc/stream-sync-reply-shared-memory.html	2022-02-25 13:26:25 UTC (rev 290505)
@@ -0,0 +1,35 @@
+<!doctype html><!-- webkit-test-runner [ IPCTestingAPIEnabled=true ] -->
+<title>Test that stream sync message can reply with shared memory</title>
+<script src=""
+<script src=""
+<body>
+<script>
+setup({ single_test: true });
+if (window.IPC) { // For compiles with !ENABLE(IPC_TESTING_API)
+    const defaultTimeout = 1000;
+    const bufferSize = 100;
+    const streamTesterID = 447;
+    for (const processTarget of IPC.processTargets) {
+        const streamConnection = IPC.createStreamClientConnection(processTarget, bufferSize);
+        IPC.sendMessage(processTarget, 0, IPC.messages.IPCTester_CreateStreamTester.name, [
+            { type: 'uint64_t', value: streamTesterID },
+            { type: 'StreamConnectionBuffer', value: streamConnection.streamBuffer() },
+        ]);
+        const arguments = IPC.waitForMessage(processTarget, streamTesterID, IPC.messages.IPCStreamTesterProxy_WasCreated.name, defaultTimeout);
+        streamConnection.setWakeUpSemaphore(arguments[0].value);
+
+        // Test starts here.
+        try {
+            const result = streamConnection.sendSyncMessage(streamTesterID, IPC.messages.IPCStreamTester_SyncMessageReturningSharedMemory1.name, defaultTimeout, [{ type: 'uint32_t', value: 8 }]);
+            const firstReply = result.arguments[0];
+            assert_equals(firstReply.type, "SharedMemory", `for ${ processTarget }`);
+            assert_equals(firstReply.protection, "ReadOnly", `for ${ processTarget }`);
+            assert_equals(Array.from(new Uint8Array(firstReply.value.readBytes(0, 8))).toString(), "0,1,2,3,4,5,6,7", `for ${ processTarget }`);
+        } finally {
+            IPC.sendSyncMessage(processTarget, 0, IPC.messages.IPCTester_ReleaseStreamTester.name, defaultTimeout, [{ type: 'uint64_t', value: streamTesterID }]);
+        }
+    }
+}
+done();
+</script>
+</body>
\ No newline at end of file

Modified: trunk/Source/WebKit/CMakeLists.txt (290504 => 290505)


--- trunk/Source/WebKit/CMakeLists.txt	2022-02-25 09:50:48 UTC (rev 290504)
+++ trunk/Source/WebKit/CMakeLists.txt	2022-02-25 13:26:25 UTC (rev 290505)
@@ -219,6 +219,7 @@
     NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy
 
     Shared/AuxiliaryProcess
+    Shared/IPCStreamTester
     Shared/IPCTester
     Shared/WebConnection
 

Modified: trunk/Source/WebKit/ChangeLog (290504 => 290505)


--- trunk/Source/WebKit/ChangeLog	2022-02-25 09:50:48 UTC (rev 290504)
+++ trunk/Source/WebKit/ChangeLog	2022-02-25 13:26:25 UTC (rev 290505)
@@ -1,3 +1,60 @@
+2022-02-25  Kimmo Kinnunen  <[email protected]>
+
+        REGRESSION(r289580): [ iOS macOS ] TestWebKitAPI.IPCTestingAPI.CanReceiveSharedMemory is a constant timeout
+        https://bugs.webkit.org/show_bug.cgi?id=236744
+
+        Reviewed by Antti Koivisto.
+
+        Add new tester interface for testing IPC stream features.
+
+        Before, TestWebKitAPI.IPCTestingAPI.CanReceiveSharedMemory would test the feature of
+        "can reply stream sync message with shared memory" by using a RemoteRenderingBackend
+        message that did so. However, when the RemoteRenderingBackend was changed to use a
+        different stategy, this test stopped working without compile failure. The IPC testing
+        is currently done at JS level.
+
+        After, the new dedicated testing interface IPCStreamTester has dedicated message for
+        testing this feature. The test is moved to LayoutTests/ipc and made so that
+        it tests the feature in all currently testable processes WP uses (GPU, Networking, UI).
+
+        IPCTestingAPI is amended to return the all possible testable process names, so
+        the .html test can work even when ENABLE(GPU_PROCESS) is toggled.
+
+        The .html test also passes when !ENABLE(IPC_TESTING_API). Currently
+        ENABLE_IPC_TESTING_API == (ASAN_ENABLED || !defined(NDEBUG)) && PLATFORM(COCOA)
+        E.g. test tests something on Release+ASAN or Debug.
+
+        Having the test in .html also makes it possible to run the test on iOS devices.
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Scripts/webkit/messages.py:
+        (types_that_cannot_be_forward_declared):
+        * Shared/IPCStreamTester.cpp: Added.
+        (WebKit::IPCStreamTester::create):
+        (WebKit::IPCStreamTester::IPCStreamTester):
+        (WebKit::IPCStreamTester::initialize):
+        (WebKit::IPCStreamTester::stopListeningForIPC):
+        (WebKit::IPCStreamTester::syncMessageReturningSharedMemory1):
+        * Shared/IPCStreamTester.h: Copied from Source/WebKit/Shared/IPCTester.h.
+        * Shared/IPCStreamTester.messages.in: Copied from Source/WebKit/Shared/IPCTester.messages.in.
+        * Shared/IPCStreamTesterIdentifier.h: Copied from Source/WebKit/Shared/IPCTester.h.
+        * Shared/IPCStreamTesterProxy.messages.in: Copied from Source/WebKit/Shared/IPCTester.messages.in.
+        * Shared/IPCTester.cpp:
+        (WebKit::IPCTester::createStreamTester):
+        (WebKit::IPCTester::releaseStreamTester):
+        * Shared/IPCTester.h:
+        * Shared/IPCTester.messages.in:
+        * Shared/mac/MediaFormatReader/MediaFormatReader.cpp:
+        * Sources.txt:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/WebPage/IPCTestingAPI.cpp:
+        (WebKit::IPCTestingAPI::JSIPC::staticValues):
+        (WebKit::IPCTestingAPI::processTargetFromArgument):
+        (WebKit::IPCTestingAPI::JSIPC::processTargets):
+
 2022-02-25  Youenn Fablet  <[email protected]>
 
         Optimize black frame sending in MediaRecorderPrivate

Modified: trunk/Source/WebKit/DerivedSources-input.xcfilelist (290504 => 290505)


--- trunk/Source/WebKit/DerivedSources-input.xcfilelist	2022-02-25 09:50:48 UTC (rev 290504)
+++ trunk/Source/WebKit/DerivedSources-input.xcfilelist	2022-02-25 13:26:25 UTC (rev 290505)
@@ -126,6 +126,8 @@
 $(PROJECT_DIR)/Shared/Authentication/AuthenticationManager.messages.in
 $(PROJECT_DIR)/Shared/AuxiliaryProcess.messages.in
 $(PROJECT_DIR)/Shared/HTTPSUpgrade/HTTPSUpgradeList.txt
+$(PROJECT_DIR)/Shared/IPCStreamTester.messages.in
+$(PROJECT_DIR)/Shared/IPCStreamTesterProxy.messages.in
 $(PROJECT_DIR)/Shared/IPCTester.messages.in
 $(PROJECT_DIR)/Shared/Notifications/NotificationManagerMessageHandler.messages.in
 $(PROJECT_DIR)/Shared/Notifications/NotificationManagerProxy.messages.in

Modified: trunk/Source/WebKit/DerivedSources-output.xcfilelist (290504 => 290505)


--- trunk/Source/WebKit/DerivedSources-output.xcfilelist	2022-02-25 09:50:48 UTC (rev 290504)
+++ trunk/Source/WebKit/DerivedSources-output.xcfilelist	2022-02-25 13:26:25 UTC (rev 290505)
@@ -46,6 +46,12 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/GPUProcessProxyMessageReceiver.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/GPUProcessProxyMessages.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/GPUProcessProxyMessagesReplies.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/IPCStreamTesterMessageReceiver.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/IPCStreamTesterMessages.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/IPCStreamTesterMessagesReplies.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/IPCStreamTesterProxyMessageReceiver.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/IPCStreamTesterProxyMessages.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/IPCStreamTesterProxyMessagesReplies.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/IPCTesterMessageReceiver.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/IPCTesterMessages.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/IPCTesterMessagesReplies.h

Modified: trunk/Source/WebKit/DerivedSources.make (290504 => 290505)


--- trunk/Source/WebKit/DerivedSources.make	2022-02-25 09:50:48 UTC (rev 290504)
+++ trunk/Source/WebKit/DerivedSources.make	2022-02-25 13:26:25 UTC (rev 290505)
@@ -151,6 +151,8 @@
 	Shared/Authentication/AuthenticationManager \
 	Shared/Notifications/NotificationManagerMessageHandler \
 	Shared/WebConnection \
+	Shared/IPCStreamTester \
+	Shared/IPCStreamTesterProxy \
 	Shared/IPCTester \
 	UIProcess/WebFullScreenManagerProxy \
 	UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy \

Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (290504 => 290505)


--- trunk/Source/WebKit/Scripts/webkit/messages.py	2022-02-25 09:50:48 UTC (rev 290504)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py	2022-02-25 13:26:25 UTC (rev 290505)
@@ -326,6 +326,7 @@
         'WebKit::GeolocationIdentifier',
         'WebKit::GraphicsContextGLIdentifier',
         'WebKit::ImageBufferBackendHandle',
+        'WebKit::IPCStreamTesterIdentifier',
         'WebKit::LayerHostingContextID',
         'WebKit::LegacyCustomProtocolID',
         'WebKit::LibWebRTCResolverIdentifier',

Added: trunk/Source/WebKit/Shared/IPCStreamTester.cpp (0 => 290505)


--- trunk/Source/WebKit/Shared/IPCStreamTester.cpp	                        (rev 0)
+++ trunk/Source/WebKit/Shared/IPCStreamTester.cpp	2022-02-25 13:26:25 UTC (rev 290505)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "IPCStreamTester.h"
+
+#if ENABLE(IPC_TESTING_API)
+#include "Decoder.h"
+#include "IPCStreamTesterMessages.h"
+#include "IPCStreamTesterProxyMessages.h"
+#include "IPCTester.h"
+#include "StreamConnectionWorkQueue.h"
+#include "StreamServerConnection.h"
+
+namespace WebKit {
+
+RefPtr<IPCStreamTester> IPCStreamTester::create(IPC::Connection& connection, IPCStreamTesterIdentifier identifier, IPC::StreamConnectionBuffer&& stream)
+{
+    auto tester = adoptRef(*new IPCStreamTester(connection, identifier, WTFMove(stream)));
+    tester->initialize();
+    return tester;
+}
+
+IPCStreamTester::IPCStreamTester(IPC::Connection& connection, IPCStreamTesterIdentifier identifier, IPC::StreamConnectionBuffer&& stream)
+    : m_workQueue(IPC::StreamConnectionWorkQueue::create("IPCStreamTester work queue"))
+    , m_streamConnection(IPC::StreamServerConnection::create(connection, WTFMove(stream), workQueue()))
+    , m_identifier(identifier)
+{
+}
+
+IPCStreamTester::~IPCStreamTester() = default;
+
+void IPCStreamTester::initialize()
+{
+    m_streamConnection->startReceivingMessages(*this, Messages::IPCStreamTester::messageReceiverName(), m_identifier.toUInt64());
+    workQueue().dispatch([this] {
+        m_streamConnection->connection().send(Messages::IPCStreamTesterProxy::WasCreated(workQueue().wakeUpSemaphore()), m_identifier);
+    });
+}
+
+void IPCStreamTester::stopListeningForIPC(Ref<IPCStreamTester>&& refFromConnection)
+{
+    m_streamConnection->stopReceivingMessages(Messages::IPCStreamTester::messageReceiverName(), m_identifier.toUInt64());
+    workQueue().stopAndWaitForCompletion();
+}
+
+void IPCStreamTester::syncMessageReturningSharedMemory1(uint32_t byteCount, CompletionHandler<void(SharedMemory::IPCHandle)>&& completionHandler)
+{
+    auto result = [&]() -> SharedMemory::IPCHandle {
+        auto sharedMemory = WebKit::SharedMemory::allocate(byteCount);
+        if (!sharedMemory)
+            return { };
+        SharedMemory::Handle handle;
+        if (!sharedMemory->createHandle(handle, SharedMemory::Protection::ReadOnly))
+            return { };
+        if (handle.isNull())
+            return { };
+        uint8_t* data = ""
+        for (size_t i = 0; i < sharedMemory->size(); ++i)
+            data[i] = i;
+        return { WTFMove(handle), sharedMemory->size() };
+    }();
+    completionHandler(WTFMove(result));
+}
+
+}
+
+#endif

Copied: trunk/Source/WebKit/Shared/IPCStreamTester.h (from rev 290502, trunk/Source/WebKit/Shared/IPCTester.h) (0 => 290505)


--- trunk/Source/WebKit/Shared/IPCStreamTester.h	                        (rev 0)
+++ trunk/Source/WebKit/Shared/IPCStreamTester.h	2022-02-25 13:26:25 UTC (rev 290505)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(IPC_TESTING_API)
+
+#include "IPCStreamTesterIdentifier.h"
+#include "ScopedActiveMessageReceiveQueue.h"
+#include "SharedMemory.h"
+#include "StreamMessageReceiver.h"
+#include <wtf/HashMap.h>
+
+namespace IPC {
+class Connection;
+class StreamServerConnection;
+class StreamConnectionBuffer;
+class StreamConnectionWorkQueue;
+}
+
+namespace WebKit {
+
+// Interface to test various IPC stream related activities.
+class IPCStreamTester final : public IPC::StreamMessageReceiver {
+public:
+    static RefPtr<IPCStreamTester> create(IPC::Connection&, IPCStreamTesterIdentifier, IPC::StreamConnectionBuffer&&);
+    void stopListeningForIPC(Ref<IPCStreamTester>&& refFromConnection);
+
+    // IPC::StreamMessageReceiver overrides.
+    void didReceiveStreamMessage(IPC::StreamServerConnectionBase&, IPC::Decoder&) final;
+private:
+    IPCStreamTester(IPC::Connection&, IPCStreamTesterIdentifier, IPC::StreamConnectionBuffer&&);
+    ~IPCStreamTester();
+    void initialize();
+    IPC::StreamConnectionWorkQueue& workQueue() const { return m_workQueue; }
+
+    // Messages.
+    void syncMessageReturningSharedMemory1(uint32_t byteCount, CompletionHandler<void(SharedMemory::IPCHandle)>&&);
+
+    const Ref<IPC::StreamConnectionWorkQueue> m_workQueue;
+    const Ref<IPC::StreamServerConnection> m_streamConnection;
+    const IPCStreamTesterIdentifier m_identifier;
+};
+
+}
+
+#endif

Copied: trunk/Source/WebKit/Shared/IPCStreamTester.messages.in (from rev 290502, trunk/Source/WebKit/Shared/IPCTester.messages.in) (0 => 290505)


--- trunk/Source/WebKit/Shared/IPCStreamTester.messages.in	                        (rev 0)
+++ trunk/Source/WebKit/Shared/IPCStreamTester.messages.in	2022-02-25 13:26:25 UTC (rev 290505)
@@ -0,0 +1,29 @@
+# Copyright (C) 2022 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#if ENABLE(IPC_TESTING_API)
+
+messages -> IPCStreamTester NotRefCounted Stream {
+    SyncMessageReturningSharedMemory1(uint32_t byteCount) -> (WebKit::SharedMemory::IPCHandle handle) Synchronous NotStreamEncodableReply
+}
+
+#endif

Copied: trunk/Source/WebKit/Shared/IPCStreamTesterIdentifier.h (from rev 290502, trunk/Source/WebKit/Shared/IPCTester.h) (0 => 290505)


--- trunk/Source/WebKit/Shared/IPCStreamTesterIdentifier.h	                        (rev 0)
+++ trunk/Source/WebKit/Shared/IPCStreamTesterIdentifier.h	2022-02-25 13:26:25 UTC (rev 290505)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(IPC_TESTING_API)
+
+#include <wtf/ObjectIdentifier.h>
+
+namespace WebKit {
+
+enum IPCStreamTesterIdentifierType { };
+using IPCStreamTesterIdentifier = ObjectIdentifier<IPCStreamTesterIdentifierType>;
+
+}
+
+#endif

Copied: trunk/Source/WebKit/Shared/IPCStreamTesterProxy.messages.in (from rev 290502, trunk/Source/WebKit/Shared/IPCTester.messages.in) (0 => 290505)


--- trunk/Source/WebKit/Shared/IPCStreamTesterProxy.messages.in	                        (rev 0)
+++ trunk/Source/WebKit/Shared/IPCStreamTesterProxy.messages.in	2022-02-25 13:26:25 UTC (rev 290505)
@@ -0,0 +1,29 @@
+# Copyright (C) 2022 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#if ENABLE(IPC_TESTING_API)
+
+messages -> IPCStreamTesterProxy NotRefCounted {
+    void WasCreated(IPC::Semaphore streamWakeUpSemaphore)
+}
+
+#endif

Modified: trunk/Source/WebKit/Shared/IPCTester.cpp (290504 => 290505)


--- trunk/Source/WebKit/Shared/IPCTester.cpp	2022-02-25 09:50:48 UTC (rev 290504)
+++ trunk/Source/WebKit/Shared/IPCTester.cpp	2022-02-25 13:26:25 UTC (rev 290505)
@@ -29,6 +29,7 @@
 #if ENABLE(IPC_TESTING_API)
 #include "Connection.h"
 #include "Decoder.h"
+#include "IPCStreamTester.h"
 
 #include <atomic>
 #include <dlfcn.h>
@@ -130,6 +131,20 @@
     completionHandler();
 }
 
+void IPCTester::createStreamTester(IPC::Connection& connection, IPCStreamTesterIdentifier identifier, IPC::StreamConnectionBuffer&& stream)
+{
+    auto addResult = m_streamTesters.ensure(identifier, [&] {
+        return IPC::ScopedActiveMessageReceiveQueue<IPCStreamTester> { IPCStreamTester::create(connection, identifier, WTFMove(stream)) };
+    });
+    ASSERT_UNUSED(addResult, addResult.isNewEntry || isTestingIPC());
+}
+
+void IPCTester::releaseStreamTester(IPCStreamTesterIdentifier identifier, CompletionHandler<void()>&& completionHandler)
+{
+    m_streamTesters.remove(identifier);
+    completionHandler();
+}
+
 void IPCTester::stopIfNeeded()
 {
     if (m_testQueue) {

Modified: trunk/Source/WebKit/Shared/IPCTester.h (290504 => 290505)


--- trunk/Source/WebKit/Shared/IPCTester.h	2022-02-25 09:50:48 UTC (rev 290504)
+++ trunk/Source/WebKit/Shared/IPCTester.h	2022-02-25 13:26:25 UTC (rev 290505)
@@ -26,10 +26,22 @@
 #pragma once
 
 
+#if ENABLE(IPC_TESTING_API)
+
+#include "IPCStreamTesterIdentifier.h"
 #include "MessageReceiver.h"
+#include "ScopedActiveMessageReceiveQueue.h"
+#include "SharedMemory.h"
+#include "StreamConnectionBuffer.h"
+#include "StreamConnectionWorkQueue.h"
+#include "StreamMessageReceiver.h"
+#include "StreamServerConnection.h"
 #include <atomic>
+#include <wtf/HashMap.h>
 #include <wtf/WorkQueue.h>
 
+#endif
+
 namespace WebKit {
 
 #define ASSERT_IS_TESTING_IPC() ASSERT(isTestingIPC(), "Untrusted connection sent invalid data. Should only happen when testing IPC.")
@@ -40,6 +52,9 @@
 // and exposes bugs underneath.
 bool isTestingIPC();
 
+class IPCStreamTester;
+
+// Main test interface for initiating various IPC test activities.
 class IPCTester final : public IPC::MessageReceiver {
 public:
     IPCTester();
@@ -52,11 +67,16 @@
     // Messages.
     void startMessageTesting(IPC::Connection&, String&& driverName);
     void stopMessageTesting(CompletionHandler<void()>);
+    void createStreamTester(IPC::Connection&, IPCStreamTesterIdentifier, IPC::StreamConnectionBuffer&&);
+    void releaseStreamTester(IPCStreamTesterIdentifier, CompletionHandler<void()>&&);
 
     void stopIfNeeded();
 
     RefPtr<WorkQueue> m_testQueue;
     std::atomic<bool> m_shouldStop { false };
+
+    using StreamTesterMap = HashMap<IPCStreamTesterIdentifier, IPC::ScopedActiveMessageReceiveQueue<IPCStreamTester>>;
+    StreamTesterMap m_streamTesters;
 };
 
 #else

Modified: trunk/Source/WebKit/Shared/IPCTester.messages.in (290504 => 290505)


--- trunk/Source/WebKit/Shared/IPCTester.messages.in	2022-02-25 09:50:48 UTC (rev 290504)
+++ trunk/Source/WebKit/Shared/IPCTester.messages.in	2022-02-25 13:26:25 UTC (rev 290505)
@@ -25,6 +25,8 @@
 messages -> IPCTester NotRefCounted {
     StartMessageTesting(String driverName) WantsConnection
     StopMessageTesting() -> () Synchronous
+    CreateStreamTester(WebKit::IPCStreamTesterIdentifier identifier, IPC::StreamConnectionBuffer stream) WantsConnection
+    ReleaseStreamTester(WebKit::IPCStreamTesterIdentifier identifier) -> () Synchronous
 }
 
 #endif

Modified: trunk/Source/WebKit/Shared/mac/MediaFormatReader/MediaFormatReader.cpp (290504 => 290505)


--- trunk/Source/WebKit/Shared/mac/MediaFormatReader/MediaFormatReader.cpp	2022-02-25 09:50:48 UTC (rev 290504)
+++ trunk/Source/WebKit/Shared/mac/MediaFormatReader/MediaFormatReader.cpp	2022-02-25 13:26:25 UTC (rev 290505)
@@ -35,6 +35,7 @@
 #include <WebCore/Document.h>
 #include <WebCore/InbandTextTrackPrivate.h>
 #include <WebCore/MediaSample.h>
+#include <WebCore/MediaSampleAVFObjC.h>
 #include <WebCore/SourceBufferParserWebM.h>
 #include <WebCore/VideoTrackPrivate.h>
 #include <pal/avfoundation/MediaTimeAVFoundation.h>

Modified: trunk/Source/WebKit/Sources.txt (290504 => 290505)


--- trunk/Source/WebKit/Sources.txt	2022-02-25 09:50:48 UTC (rev 290504)
+++ trunk/Source/WebKit/Sources.txt	2022-02-25 13:26:25 UTC (rev 290505)
@@ -231,6 +231,7 @@
 Shared/FontInfo.cpp
 Shared/FrameInfoData.cpp
 Shared/InspectorExtensionTypes.cpp
+Shared/IPCStreamTester.cpp
 Shared/IPCTester.cpp
 Shared/LayerTreeContext.cpp
 Shared/LoadParameters.cpp
@@ -868,6 +869,7 @@
 
 WebProcess/XR/PlatformXRSystemProxy.cpp
 
+IPCStreamTesterMessageReceiver.cpp
 IPCTesterMessageReceiver.cpp
 NetworkBroadcastChannelRegistryMessageReceiver.cpp
 RTCDataChannelRemoteManagerMessageReceiver.cpp

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (290504 => 290505)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2022-02-25 09:50:48 UTC (rev 290504)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2022-02-25 13:26:25 UTC (rev 290505)
@@ -1338,6 +1338,7 @@
 		7BAB111025DD02B3008FC479 /* ScopedActiveMessageReceiveQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BAB110F25DD02B2008FC479 /* ScopedActiveMessageReceiveQueue.h */; };
 		7BCF70DE2615D06E00E4FB70 /* ScopedRenderingResourcesRequestCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7BCF70CB2614935E00E4FB70 /* ScopedRenderingResourcesRequestCocoa.mm */; };
 		7BDDA3192747C0400038659E /* (null) in Headers */ = {isa = PBXBuildFile; };
+		7BE37F9327C7CA51007A6CD3 /* IPCStreamTesterIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BE37F9227C7C518007A6CD3 /* IPCStreamTesterIdentifier.h */; };
 		7C065F2C1C8CD95F00C2D950 /* WebUserContentControllerDataTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C065F2A1C8CD95F00C2D950 /* WebUserContentControllerDataTypes.h */; };
 		7C135AA9173B0BCA00586AE2 /* WKPluginInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C135AA7173B0BCA00586AE2 /* WKPluginInformation.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		7C1BA33E1A4A0E600043E249 /* APIDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C1BA33C1A4A0E600043E249 /* APIDictionary.h */; };
@@ -5177,6 +5178,9 @@
 		7BDDA33F275652EA0038659E /* AuxiliaryProcessCreationParameters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AuxiliaryProcessCreationParameters.h; sourceTree = "<group>"; };
 		7BDDA340275652EA0038659E /* AuxiliaryProcessCreationParameters.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AuxiliaryProcessCreationParameters.cpp; sourceTree = "<group>"; };
 		7BE37F6F27B1475F007A6CD3 /* ThreadSafeObjectHeap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ThreadSafeObjectHeap.h; sourceTree = "<group>"; };
+		7BE37F9227C7C518007A6CD3 /* IPCStreamTesterIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IPCStreamTesterIdentifier.h; sourceTree = "<group>"; };
+		7BE37F9427C7CD51007A6CD3 /* IPCStreamTester.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IPCStreamTester.h; sourceTree = "<group>"; };
+		7BE37F9527C7CD90007A6CD3 /* IPCStreamTester.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = IPCStreamTester.cpp; sourceTree = "<group>"; };
 		7BE726572574F67200E85D98 /* RemoteGraphicsContextGLProxyFunctionsGenerated.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteGraphicsContextGLProxyFunctionsGenerated.cpp; sourceTree = "<group>"; };
 		7BE72668257680EF00E85D98 /* RemoteGraphicsContextGLCocoa.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteGraphicsContextGLCocoa.cpp; sourceTree = "<group>"; };
 		7C065F291C8CD95F00C2D950 /* WebUserContentControllerDataTypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebUserContentControllerDataTypes.cpp; sourceTree = "<group>"; };
@@ -7302,6 +7306,9 @@
 				BCCF6B2312C93E7A008F9C35 /* ImageOptions.h */,
 				999B7ED82550E4A800F450A4 /* InspectorExtensionTypes.cpp */,
 				99BE3B1625433B9400C6551C /* InspectorExtensionTypes.h */,
+				7BE37F9527C7CD90007A6CD3 /* IPCStreamTester.cpp */,
+				7BE37F9427C7CD51007A6CD3 /* IPCStreamTester.h */,
+				7BE37F9227C7C518007A6CD3 /* IPCStreamTesterIdentifier.h */,
 				7B50E97F2771F6CE003DAAC4 /* IPCTester.cpp */,
 				7B50E9802771F6CF003DAAC4 /* IPCTester.h */,
 				1A92DC1212F8BAB90017AF65 /* LayerTreeContext.cpp */,
@@ -13244,6 +13251,7 @@
 				C5BCE5DF1C50766A00CDE3FA /* InteractionInformationAtPosition.h in Headers */,
 				2D4D2C811DF60BF3002EB10C /* InteractionInformationRequest.h in Headers */,
 				A31F60A425CC7DB900AF14F4 /* IPCSemaphore.h in Headers */,
+				7BE37F9327C7CA51007A6CD3 /* IPCStreamTesterIdentifier.h in Headers */,
 				9B47908F253151CC00EC11AB /* JSIPCBinding.h in Headers */,
 				C1663E5B24AEAA2F00C6A3B2 /* LaunchServicesDatabaseXPCConstants.h in Headers */,
 				51E9049A27BCB9D400929E7E /* LaunchServicesSPI.h in Headers */,

Modified: trunk/Source/WebKit/WebProcess/WebPage/IPCTestingAPI.cpp (290504 => 290505)


--- trunk/Source/WebKit/WebProcess/WebPage/IPCTestingAPI.cpp	2022-02-25 09:50:48 UTC (rev 290504)
+++ trunk/Source/WebKit/WebProcess/WebPage/IPCTestingAPI.cpp	2022-02-25 13:26:25 UTC (rev 290505)
@@ -61,6 +61,12 @@
 
 namespace IPCTestingAPI {
 
+static constexpr auto processTargetNameUI = "UI"_s;
+#if ENABLE(GPU_PROCESS)
+static constexpr auto processTargetNameGPU = "GPU"_s;
+#endif
+static constexpr auto processTargetNameNetworking = "Networking"_s;
+
 static std::optional<uint64_t> destinationIDFromArgument(JSC::JSGlobalObject*, JSValueRef, JSValueRef*);
 static std::optional<uint64_t> messageIDFromArgument(JSC::JSGlobalObject*, JSValueRef, JSValueRef*);
 static JSC::JSObject* jsResultFromReplyDecoder(JSC::JSGlobalObject*, IPC::MessageName, IPC::Decoder&);
@@ -270,6 +276,7 @@
     static JSValueRef retrieveID(JSContextRef, JSObjectRef thisObject, JSValueRef* exception, const WTF::Function<uint64_t(JSIPC&)>&);
 
     static JSValueRef messages(JSContextRef, JSObjectRef, JSStringRef, JSValueRef* exception);
+    static JSValueRef processTargets(JSContextRef, JSObjectRef, JSStringRef, JSValueRef* exception);
 
     WeakPtr<WebPage> m_webPage;
     WeakPtr<WebFrame> m_webFrame;
@@ -941,6 +948,7 @@
         { "sessionID", sessionID, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
         { "webPageProxyID", webPageProxyID, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
         { "messages", messages, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+        { "processTargets", processTargets, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
         { 0, 0, 0, 0 }
     };
     return values;
@@ -953,13 +961,13 @@
     if (scope.exception())
         return nullptr;
 
-    if (name == "UI")
+    if (name == processTargetNameUI)
         return WebProcess::singleton().parentProcessConnection();
 #if ENABLE(GPU_PROCESS)
-    if (name == "GPU")
+    if (name == processTargetNameGPU)
         return &WebProcess::singleton().ensureGPUProcessConnection().connection();
 #endif
-    if (name == "Networking")
+    if (name == processTargetNameNetworking)
         return &WebProcess::singleton().ensureNetworkProcessConnection().connection();
 
     *exception = toRef(JSC::createTypeError(globalObject, "Target process must be UI, GPU, or Networking"_s));
@@ -1856,6 +1864,32 @@
     return toRef(vm, messagesObject);
 }
 
+JSValueRef JSIPC::processTargets(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef* exception)
+{
+    auto* globalObject = toJS(context);
+    auto& vm = globalObject->vm();
+    JSC::JSLockHolder lock(vm);
+
+    auto* impl = toWrapped(context, thisObject);
+    if (!impl) {
+        *exception = toRef(JSC::createTypeError(toJS(context), "Wrong type"_s));
+        return JSValueMakeUndefined(context);
+    }
+    auto scope = DECLARE_CATCH_SCOPE(vm);
+    JSC::JSObject* processTargetsObject = JSC::constructEmptyArray(globalObject, nullptr);
+    RETURN_IF_EXCEPTION(scope, JSValueMakeUndefined(context));
+    int index = 0;
+    processTargetsObject->putDirectIndex(globalObject, index++, JSC::jsString(vm, processTargetNameUI));
+    RETURN_IF_EXCEPTION(scope, JSValueMakeUndefined(context));
+#if ENABLE(GPU_PROCESS)
+    processTargetsObject->putDirectIndex(globalObject, index++, JSC::jsString(vm, processTargetNameGPU));
+    RETURN_IF_EXCEPTION(scope, JSValueMakeUndefined(context));
+#endif
+    processTargetsObject->putDirectIndex(globalObject, index++, JSC::jsString(vm, processTargetNameNetworking));
+    RETURN_IF_EXCEPTION(scope, JSValueMakeUndefined(context));
+    return toRef(vm, processTargetsObject);
+}
+
 JSMessageListener::JSMessageListener(JSIPC& jsIPC, Type type, JSContextRef context, JSObjectRef callback)
     : m_jsIPC(jsIPC)
     , m_type(type)

Modified: trunk/Tools/ChangeLog (290504 => 290505)


--- trunk/Tools/ChangeLog	2022-02-25 09:50:48 UTC (rev 290504)
+++ trunk/Tools/ChangeLog	2022-02-25 13:26:25 UTC (rev 290505)
@@ -1,3 +1,12 @@
+2022-02-25  Kimmo Kinnunen  <[email protected]>
+
+        REGRESSION(r289580): [ iOS macOS ] TestWebKitAPI.IPCTestingAPI.CanReceiveSharedMemory is a constant timeout
+        https://bugs.webkit.org/show_bug.cgi?id=236744
+
+        Reviewed by Antti Koivisto.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/IPCTestingAPI.mm:
+
 2022-02-25  Carlos Garcia Campos  <[email protected]>
 
         AX: List item marker not exposed when not a direct child of a list item

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/IPCTestingAPI.mm (290504 => 290505)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/IPCTestingAPI.mm	2022-02-25 09:50:48 UTC (rev 290504)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/IPCTestingAPI.mm	2022-02-25 13:26:25 UTC (rev 290505)
@@ -96,6 +96,8 @@
     EXPECT_STREQ([alertMessage UTF8String], "undefined");
 }
 
+// Note: There are more IPC tests using IPC testing API in `LayoutTests/ipc`.
+
 #if ENABLE(IPC_TESTING_API)
 
 static RetainPtr<TestWKWebView> createWebViewWithIPCTestingAPI()
@@ -309,38 +311,6 @@
     EXPECT_STREQ([alertMessage UTF8String], "1:Semaphore:false");
 }
 
-// FIXME: Re-enable this test once webkit.org/b/236744 is resolved.
-TEST(IPCTestingAPI, DISABLED_CanReceiveSharedMemory)
-{
-    auto webView = createWebViewWithIPCTestingAPI();
-
-    auto delegate = adoptNS([[IPCTestingAPIDelegate alloc] init]);
-    [webView setUIDelegate:delegate.get()];
-
-    auto html = @"<!DOCTYPE html>"
-        "<script>"
-        "const bufferSize = 1 << 16;"
-        "const streamConnection = IPC.createStreamClientConnection('GPU', bufferSize);"
-        "IPC.sendMessage('GPU', 0, IPC.messages.GPUConnectionToWebProcess_CreateRenderingBackend.name, ["
-        "    { type: 'RemoteRenderingBackendCreationParameters', 'identifier': 123, 'pageProxyID': IPC.webPageProxyID, 'pageID': IPC.pageID },"
-        "    { type: 'StreamConnectionBuffer', value: streamConnection.streamBuffer() },"
-        "]);"
-        "const arguments = IPC.waitForMessage('GPU', 123, IPC.messages.RemoteRenderingBackendProxy_DidCreateWakeUpSemaphoreForDisplayListStream.name, 100);"
-        "streamConnection.setWakeUpSemaphore(arguments[0].value);"
-        "const result = streamConnection.sendSyncMessage(123, IPC.messages.RemoteRenderingBackend_UpdateSharedMemoryForGetPixelBuffer.name, 100, [{type: 'uint32_t', value: 8}]);"
-        "alert(result.arguments.length);"
-        "</script>";
-
-    done = false;
-    [webView synchronouslyLoadHTMLString:html];
-    TestWebKitAPI::Util::run(&done);
-
-    EXPECT_EQ([alertMessage intValue], 1);
-    EXPECT_STREQ([webView stringByEvaluatingJavaScript:@"firstReply = result.arguments[0]; firstReply.type"].UTF8String, "SharedMemory");
-    EXPECT_STREQ([webView stringByEvaluatingJavaScript:@"firstReply.protection"].UTF8String, "ReadOnly");
-    EXPECT_STREQ([webView stringByEvaluatingJavaScript:@"Array.from(new Uint8Array(firstReply.value.readBytes(0, 8))).toString()"].UTF8String, "0,0,0,0,0,0,0,0");
-}
-
 #endif // ENABLE(GPU_PROCESS)
 
 TEST(IPCTestingAPI, CanCreateIPCSemaphore)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to