WebKit Bugzilla
Attachment 357004 Details for
Bug 192566
: DataChannels created asynchronously never open and are unusable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192566-20181210151241.patch (text/plain), 6.82 KB, created by
youenn fablet
on 2018-12-10 15:12:42 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2018-12-10 15:12:42 PST
Size:
6.82 KB
patch
obsolete
>Subversion Revision: 239028 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 3aa0e8cea035144cceafc95e81412646bf5b92e9..ff97fccb4e112fcafbdb2a080b762d79a6a84c7a 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2018-12-10 Youenn Fablet <youenn@apple.com> >+ >+ DataChannels created asynchronously never open and are unusable >+ https://bugs.webkit.org/show_bug.cgi?id=192566 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ For every new data channel (remote or local), we should check the underlying backend state. >+ This allows firing events if needed. >+ We were not always doing that which was prohibiting sending some open >+ events for data channels created after the SCTP connection is set up. >+ >+ Covered by updated test. >+ >+ * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: >+ (WebCore::LibWebRTCDataChannelHandler::channelEvent): >+ (WebCore::LibWebRTCDataChannelHandler::setClient): >+ (WebCore::LibWebRTCDataChannelHandler::OnStateChange): >+ (WebCore::LibWebRTCDataChannelHandler::checkState): >+ * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h: >+ > 2018-12-10 Youenn Fablet <youenn@apple.com> > > Remove derived classes of RealtimeMediaSourceCenter >diff --git a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp >index bcfe2a45f0e894d820dbf2b69c7a5378c2aaeeea..aaa4000207365ffcbe528128e28ce02f6c607cdd 100644 >--- a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp >+++ b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp >@@ -69,19 +69,9 @@ Ref<RTCDataChannelEvent> LibWebRTCDataChannelHandler::channelEvent(ScriptExecuti > init.negotiated = dataChannel->negotiated(); > init.id = dataChannel->id(); > >- bool isOpened = dataChannel->state() == webrtc::DataChannelInterface::kOpen; >- > auto handler = std::make_unique<LibWebRTCDataChannelHandler>(WTFMove(dataChannel)); > auto channel = RTCDataChannel::create(context, WTFMove(handler), fromStdString(label), WTFMove(init)); > >- if (isOpened) { >- callOnMainThread([channel = channel.copyRef()] { >- // FIXME: We should be able to write channel->didChangeReadyState(...) >- RTCDataChannelHandlerClient& client = channel.get(); >- client.didChangeReadyState(RTCDataChannelState::Open); >- }); >- } >- > return RTCDataChannelEvent::create(eventNames().datachannelEvent, Event::CanBubble::No, Event::IsCancelable::No, WTFMove(channel)); > } > >@@ -96,6 +86,7 @@ void LibWebRTCDataChannelHandler::setClient(RTCDataChannelHandlerClient& client) > ASSERT(!m_client); > m_client = &client; > m_channel->RegisterObserver(this); >+ checkState(); > } > > bool LibWebRTCDataChannelHandler::sendStringData(const String& text) >@@ -122,7 +113,11 @@ void LibWebRTCDataChannelHandler::OnStateChange() > { > if (!m_client) > return; >+ checkState(); >+} > >+void LibWebRTCDataChannelHandler::checkState() >+{ > RTCDataChannelState state; > switch (m_channel->state()) { > case webrtc::DataChannelInterface::kConnecting: >diff --git a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h >index 00552bf666b8dd792e785897d79d20ae7d743d04..e8010196d6e99a06502b5644ae50f45afebcd5ce 100644 >--- a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h >+++ b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h >@@ -57,6 +57,7 @@ public: > private: > // RTCDataChannelHandler API > void setClient(RTCDataChannelHandlerClient&) final; >+ void checkState(); > bool sendStringData(const String&) final; > bool sendRawData(const char*, size_t) final; > void close() final; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 202893917e53d9aaa0af273fc573667ad8a8ea56..a6594cc3de5fd71eda1f3889e9b0ac17ba10e759 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,13 @@ >+2018-12-10 Youenn Fablet <youenn@apple.com> >+ >+ DataChannels created asynchronously never open and are unusable >+ https://bugs.webkit.org/show_bug.cgi?id=192566 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * webrtc/datachannel/basic-expected.txt: >+ * webrtc/datachannel/basic.html: >+ > 2018-12-09 Commit Queue <commit-queue@webkit.org> > > Unreviewed, rolling out r239010. >diff --git a/LayoutTests/webrtc/datachannel/basic-expected.txt b/LayoutTests/webrtc/datachannel/basic-expected.txt >index 0eb226ee30eae7b3023fe56562866c77aba60151..b8ebe43f3f6bb18f0aa059a89380970efc950b2c 100644 >--- a/LayoutTests/webrtc/datachannel/basic-expected.txt >+++ b/LayoutTests/webrtc/datachannel/basic-expected.txt >@@ -3,4 +3,5 @@ PASS Basic data channel exchange from offerer to receiver > PASS Basic data channel exchange from receiver to offerer > PASS Basic data channel exchange from offerer to receiver using UDP only > PASS Basic data channel exchange from offerer to receiver >+PASS Create a second channel asynchronously and send messages > >diff --git a/LayoutTests/webrtc/datachannel/basic.html b/LayoutTests/webrtc/datachannel/basic.html >index fa315d05199dafd1c30ec838ec1e87443dcf0e28..fb9f4db30efe324c19d6fa8c674e10672203081e 100644 >--- a/LayoutTests/webrtc/datachannel/basic.html >+++ b/LayoutTests/webrtc/datachannel/basic.html >@@ -126,6 +126,40 @@ promise_test((test) => { > }); > }, "Basic data channel exchange from offerer to receiver"); > >+promise_test(async (test) => { >+ await new Promise((resolve, reject) => { >+ finishTest = resolve; >+ createConnections((localConnection) => { >+ localChannel = localConnection.createDataChannel('sendDataChannel'); >+ }, (remoteConnection) => { >+ remoteConnection.ondatachannel = resolve; >+ }); >+ setTimeout(() => { reject("Test step 1 timed out"); }, 5000); >+ }); >+ await waitFor(50); >+ let waitForLocalChannelOpening = new Promise((resolve) => { >+ localChannel = localConnection.createDataChannel('sendDataChannel2'); >+ localChannel.onopen = resolve; >+ }); >+ >+ let waitForRemoteChannel = new Promise((resolve) => { >+ remoteConnection.ondatachannel = (event) => { >+ remoteChannel = event.channel; >+ resolve(); >+ }; >+ }); >+ >+ await Promise.all([waitForLocalChannelOpening, waitForRemoteChannel]); >+ >+ counter = 0; >+ await new Promise((resolve, reject) => { >+ finishTest = resolve; >+ remoteChannel.onmessage = receiveMessages; >+ sendMessages(localChannel); >+ setTimeout(() => { reject("Test step 2 timed out"); }, 5000); >+ }); >+}, "Create a second channel asynchronously and send messages"); >+ > </script> > </body> > </html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192566
: 357004