Title: [282459] trunk/Source/WebCore
Revision
282459
Author
[email protected]
Date
2021-09-15 10:07:59 -0700 (Wed, 15 Sep 2021)

Log Message

imported/w3c/web-platform-tests/webrtc-extensions/transfer-datachannel.html is failing after https://trac.webkit.org/changeset/282445/webkit
https://bugs.webkit.org/show_bug.cgi?id=230308

Reviewed by Eric Carlson.

Covered by no longer failing test.

* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::OnDataChannel):
We need to create the data channel object at the time we fire the event,
so that JS can transfer it synchronously in the same event loop.
This got regressed as we were creating the data channel, enqueuing a task to fire the data channel event.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (282458 => 282459)


--- trunk/Source/WebCore/ChangeLog	2021-09-15 16:55:07 UTC (rev 282458)
+++ trunk/Source/WebCore/ChangeLog	2021-09-15 17:07:59 UTC (rev 282459)
@@ -1,3 +1,18 @@
+2021-09-15  Youenn Fablet  <[email protected]>
+
+        imported/w3c/web-platform-tests/webrtc-extensions/transfer-datachannel.html is failing after https://trac.webkit.org/changeset/282445/webkit
+        https://bugs.webkit.org/show_bug.cgi?id=230308
+
+        Reviewed by Eric Carlson.
+
+        Covered by no longer failing test.
+
+        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
+        (WebCore::LibWebRTCMediaEndpoint::OnDataChannel):
+        We need to create the data channel object at the time we fire the event,
+        so that JS can transfer it synchronously in the same event loop.
+        This got regressed as we were creating the data channel, enqueuing a task to fire the data channel event.
+
 2021-09-15  Carlos Garcia Campos  <[email protected]>
 
         AX: Move platform specific code for isolated tree mode to the platform files

Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp (282458 => 282459)


--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp	2021-09-15 16:55:07 UTC (rev 282458)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp	2021-09-15 17:07:59 UTC (rev 282459)
@@ -457,10 +457,14 @@
 void LibWebRTCMediaEndpoint::OnDataChannel(rtc::scoped_refptr<webrtc::DataChannelInterface> dataChannel)
 {
     callOnMainThread([protectedThis = makeRef(*this), dataChannel = WTFMove(dataChannel)]() mutable {
-        if (protectedThis->isStopped())
-            return;
         auto& connection = protectedThis->m_peerConnectionBackend.connection();
-        connection.scheduleEvent(LibWebRTCDataChannelHandler::channelEvent(*connection.document(), WTFMove(dataChannel)));
+        connection.queueTaskKeepingObjectAlive(connection, TaskSource::Networking, [protectedThis = WTFMove(protectedThis), dataChannel = WTFMove(dataChannel)]() mutable {
+            if (protectedThis->isStopped())
+                return;
+
+            auto& connection = protectedThis->m_peerConnectionBackend.connection();
+            connection.dispatchEvent(LibWebRTCDataChannelHandler::channelEvent(*connection.document(), WTFMove(dataChannel)));
+        });
     });
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to