Diff
Modified: trunk/LayoutTests/ChangeLog (282197 => 282198)
--- trunk/LayoutTests/ChangeLog 2021-09-09 07:13:28 UTC (rev 282197)
+++ trunk/LayoutTests/ChangeLog 2021-09-09 07:21:18 UTC (rev 282198)
@@ -1,5 +1,15 @@
2021-09-09 Youenn Fablet <[email protected]>
+ Add support for RTCDataChannel closing event
+ https://bugs.webkit.org/show_bug.cgi?id=229988
+
+ Reviewed by Eric Carlson.
+
+ * TestExpectations:
+ Unskip no longer timing out test.
+
+2021-09-09 Youenn Fablet <[email protected]>
+
Add support for RTCSctpTransport
https://bugs.webkit.org/show_bug.cgi?id=229292
<rdar://problem/82394152>
Modified: trunk/LayoutTests/TestExpectations (282197 => 282198)
--- trunk/LayoutTests/TestExpectations 2021-09-09 07:13:28 UTC (rev 282197)
+++ trunk/LayoutTests/TestExpectations 2021-09-09 07:21:18 UTC (rev 282198)
@@ -2194,7 +2194,6 @@
imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-tracks.https.html [ Skip ]
imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-remote-track-mute.https.html [ Skip ]
imported/w3c/web-platform-tests/webrtc/RTCDataChannel-bufferedAmount.html [ Skip ]
-imported/w3c/web-platform-tests/webrtc/RTCDataChannel-close.html [ Skip ]
imported/w3c/web-platform-tests/webrtc/RTCIceConnectionState-candidate-pair.https.html [ Skip ]
imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-mandatory-getStats.https.html [ Skip ]
imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-onicecandidateerror.https.html [ Skip ]
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (282197 => 282198)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-09-09 07:13:28 UTC (rev 282197)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-09-09 07:21:18 UTC (rev 282198)
@@ -1,5 +1,15 @@
2021-09-09 Youenn Fablet <[email protected]>
+ Add support for RTCDataChannel closing event
+ https://bugs.webkit.org/show_bug.cgi?id=229988
+
+ Reviewed by Eric Carlson.
+
+ * web-platform-tests/webrtc/RTCDataChannel-close-expected.txt:
+ * web-platform-tests/webrtc/idlharness.https.window-expected.txt:
+
+2021-09-09 Youenn Fablet <[email protected]>
+
Add support for RTCSctpTransport
https://bugs.webkit.org/show_bug.cgi?id=229292
<rdar://problem/82394152>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDataChannel-close-expected.txt (282197 => 282198)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDataChannel-close-expected.txt 2021-09-09 07:13:28 UTC (rev 282197)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDataChannel-close-expected.txt 2021-09-09 07:21:18 UTC (rev 282198)
@@ -1,12 +1,10 @@
-Harness Error (TIMEOUT), message = null
+PASS Close datachannel causes onclosing and onclose to be called
+PASS Close datachannel causes closing and close event to be called
+FAIL Close peerconnection causes close event and error to be called on datachannel Can't find variable: RTCErrorEvent
+PASS Close peerconnection after datachannel close causes no events
+PASS Close negotiated datachannel causes onclosing and onclose to be called
+PASS Close negotiated datachannel causes closing and close event to be called
+FAIL Close peerconnection causes close event and error to be called on negotiated datachannel Can't find variable: RTCErrorEvent
+PASS Close peerconnection after negotiated datachannel close causes no events
-FAIL Close datachannel causes onclosing and onclose to be called assert_true: Closing event was seen expected true got false
-FAIL Close datachannel causes closing and close event to be called assert_true: Closing event was seen expected true got false
-FAIL Close peerconnection causes close event and error to be called on datachannel assert_array_equals: lengths differ, expected array ["error", "close"] length 2, got ["close"] length 1
-TIMEOUT Close peerconnection after datachannel close causes no events Test timed out
-NOTRUN Close negotiated datachannel causes onclosing and onclose to be called
-NOTRUN Close negotiated datachannel causes closing and close event to be called
-NOTRUN Close peerconnection causes close event and error to be called on negotiated datachannel
-NOTRUN Close peerconnection after negotiated datachannel close causes no events
-
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/idlharness.https.window-expected.txt (282197 => 282198)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/idlharness.https.window-expected.txt 2021-09-09 07:13:28 UTC (rev 282197)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/idlharness.https.window-expected.txt 2021-09-09 07:21:18 UTC (rev 282198)
@@ -404,7 +404,7 @@
PASS RTCDataChannel interface: attribute onopen
PASS RTCDataChannel interface: attribute onbufferedamountlow
PASS RTCDataChannel interface: attribute onerror
-FAIL RTCDataChannel interface: attribute onclosing assert_true: The prototype object must have a property "onclosing" expected true got false
+PASS RTCDataChannel interface: attribute onclosing
PASS RTCDataChannel interface: attribute onclose
PASS RTCDataChannel interface: operation close()
PASS RTCDataChannel interface: attribute onmessage
@@ -428,7 +428,7 @@
PASS RTCDataChannel interface: new RTCPeerConnection().createDataChannel('') must inherit property "onopen" with the proper type
PASS RTCDataChannel interface: new RTCPeerConnection().createDataChannel('') must inherit property "onbufferedamountlow" with the proper type
PASS RTCDataChannel interface: new RTCPeerConnection().createDataChannel('') must inherit property "onerror" with the proper type
-FAIL RTCDataChannel interface: new RTCPeerConnection().createDataChannel('') must inherit property "onclosing" with the proper type assert_inherits: property "onclosing" not found in prototype chain
+PASS RTCDataChannel interface: new RTCPeerConnection().createDataChannel('') must inherit property "onclosing" with the proper type
PASS RTCDataChannel interface: new RTCPeerConnection().createDataChannel('') must inherit property "onclose" with the proper type
PASS RTCDataChannel interface: new RTCPeerConnection().createDataChannel('') must inherit property "close()" with the proper type
PASS RTCDataChannel interface: new RTCPeerConnection().createDataChannel('') must inherit property "onmessage" with the proper type
Modified: trunk/Source/WebCore/ChangeLog (282197 => 282198)
--- trunk/Source/WebCore/ChangeLog 2021-09-09 07:13:28 UTC (rev 282197)
+++ trunk/Source/WebCore/ChangeLog 2021-09-09 07:21:18 UTC (rev 282198)
@@ -1,5 +1,31 @@
2021-09-09 Youenn Fablet <[email protected]>
+ Add support for RTCDataChannel closing event
+ https://bugs.webkit.org/show_bug.cgi?id=229988
+
+ Reviewed by Eric Carlson.
+
+ Add support for the closing event.
+ Updating close method as per https://w3c.github.io/webrtc-pc/#dom-rtcdatachannel-close:
+ - make the channel enter closing state (without firing event)
+ - wait for the state to move to closed from the backend.
+
+ We also add support for the error event by checking, when entering closed state whether
+ the channel is in an error state.
+
+ Covered by rebased test.
+
+ * Modules/mediastream/RTCDataChannel.cpp:
+ (WebCore::RTCDataChannel::close):
+ (WebCore::RTCDataChannel::didChangeReadyState):
+ (WebCore::RTCDataChannel::stop):
+ * Modules/mediastream/RTCDataChannel.idl:
+ * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
+ (WebCore::LibWebRTCDataChannelHandler::checkState):
+ * dom/EventNames.h:
+
+2021-09-09 Youenn Fablet <[email protected]>
+
Add support for RTCSctpTransport
https://bugs.webkit.org/show_bug.cgi?id=229292
<rdar://problem/82394152>
Modified: trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.cpp (282197 => 282198)
--- trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.cpp 2021-09-09 07:13:28 UTC (rev 282197)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.cpp 2021-09-09 07:21:18 UTC (rev 282198)
@@ -175,14 +175,15 @@
if (m_stopped)
return;
- m_stopped = true;
- m_readyState = RTCDataChannelState::Closed;
+ if (m_readyState == RTCDataChannelState::Closing || m_readyState == RTCDataChannelState::Closed)
+ return;
+ m_readyState = RTCDataChannelState::Closing;
+
m_messageQueue.clear();
if (m_handler)
m_handler->close();
- m_handler = nullptr;
}
bool RTCDataChannel::virtualHasPendingActivity() const
@@ -198,14 +199,19 @@
m_readyState = newState;
switch (m_readyState) {
+ case RTCDataChannelState::Connecting:
+ ASSERT_NOT_REACHED();
+ break;
case RTCDataChannelState::Open:
scheduleDispatchEvent(Event::create(eventNames().openEvent, Event::CanBubble::No, Event::IsCancelable::No));
break;
+ case RTCDataChannelState::Closing:
+ scheduleDispatchEvent(Event::create(eventNames().closingEvent, Event::CanBubble::No, Event::IsCancelable::No));
+ break;
case RTCDataChannelState::Closed:
scheduleDispatchEvent(Event::create(eventNames().closeEvent, Event::CanBubble::No, Event::IsCancelable::No));
+ m_stopped = true;
break;
- default:
- break;
}
}
@@ -245,6 +251,8 @@
removeFromDataChannelLocalMapIfNeeded();
close();
+ m_stopped = true;
+ m_handler = nullptr;
}
void RTCDataChannel::scheduleDispatchEvent(Ref<Event>&& event)
Modified: trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.idl (282197 => 282198)
--- trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.idl 2021-09-09 07:13:28 UTC (rev 282197)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.idl 2021-09-09 07:21:18 UTC (rev 282198)
@@ -55,6 +55,7 @@
attribute EventHandler onopen;
attribute EventHandler onerror;
attribute EventHandler onclose;
+ attribute EventHandler onclosing;
attribute EventHandler onmessage;
attribute EventHandler onbufferedamountlow;
};
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp (282197 => 282198)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp 2021-09-09 07:13:28 UTC (rev 282197)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp 2021-09-09 07:21:18 UTC (rev 282198)
@@ -129,6 +129,7 @@
void LibWebRTCDataChannelHandler::checkState()
{
+ bool hasError = false;
RTCDataChannelState state;
switch (m_channel->state()) {
case webrtc::DataChannelInterface::kConnecting:
@@ -141,6 +142,7 @@
state = RTCDataChannelState::Closing;
break;
case webrtc::DataChannelInterface::kClosed:
+ hasError = !m_channel->error().ok();
state = RTCDataChannelState::Closed;
break;
}
@@ -150,7 +152,9 @@
m_bufferedMessages.append(state);
return;
}
- postTask([protectedClient = makeRef(*m_client), state] {
+ postTask([protectedClient = makeRef(*m_client), state, hasError] {
+ if (hasError)
+ protectedClient->didDetectError();
protectedClient->didChangeReadyState(state);
});
}
Modified: trunk/Source/WebCore/dom/EventNames.h (282197 => 282198)
--- trunk/Source/WebCore/dom/EventNames.h 2021-09-09 07:13:28 UTC (rev 282197)
+++ trunk/Source/WebCore/dom/EventNames.h 2021-09-09 07:21:18 UTC (rev 282198)
@@ -89,6 +89,7 @@
macro(checking) \
macro(click) \
macro(close) \
+ macro(closing) \
macro(complete) \
macro(compositionend) \
macro(compositionstart) \