Diff
Modified: trunk/LayoutTests/ChangeLog (214440 => 214441)
--- trunk/LayoutTests/ChangeLog 2017-03-27 23:32:56 UTC (rev 214440)
+++ trunk/LayoutTests/ChangeLog 2017-03-27 23:36:36 UTC (rev 214441)
@@ -1,3 +1,18 @@
+2017-03-27 Youenn Fablet <[email protected]>
+
+ addIceCandidate should not throw if passed null or undefined
+ https://bugs.webkit.org/show_bug.cgi?id=170118
+
+ Reviewed by Eric Carlson.
+
+ Updating test to log addIceCandidate rejection.
+
+ * webrtc/datachannel/basic.html:
+ * webrtc/routines.js:
+ (iceCallback1):
+ (iceCallback2):
+ (onAddIceCandidateError):
+
2017-03-27 Ryan Haddad <[email protected]>
Rebaseline svg/css/getComputedStyle-basic.xhtml for macOS.
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (214440 => 214441)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2017-03-27 23:32:56 UTC (rev 214440)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2017-03-27 23:36:36 UTC (rev 214441)
@@ -1,3 +1,12 @@
+2017-03-27 Youenn Fablet <[email protected]>
+
+ addIceCandidate should not throw if passed null or undefined
+ https://bugs.webkit.org/show_bug.cgi?id=170118
+
+ Reviewed by Eric Carlson.
+
+ * web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-idl-expected.txt:
+
2017-03-22 Youenn Fablet <[email protected]>
Support RTCPeerConnectionState
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-idl-expected.txt (214440 => 214441)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-idl-expected.txt 2017-03-27 23:32:56 UTC (rev 214440)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-idl-expected.txt 2017-03-27 23:36:36 UTC (rev 214441)
@@ -23,7 +23,7 @@
PASS RTCPeerConnection interface: attribute remoteDescription
PASS RTCPeerConnection interface: attribute currentRemoteDescription
PASS RTCPeerConnection interface: attribute pendingRemoteDescription
-FAIL RTCPeerConnection interface: operation addIceCandidate(RTCIceCandidate) assert_equals: property has wrong .length expected 1 but got 0
+FAIL RTCPeerConnection interface: operation addIceCandidate([object Object],[object Object]) assert_equals: property has wrong .length expected 1 but got 0
PASS RTCPeerConnection interface: attribute signalingState
PASS RTCPeerConnection interface: attribute iceGatheringState
PASS RTCPeerConnection interface: attribute iceConnectionState
@@ -79,7 +79,7 @@
PASS RTCPeerConnection interface: pc must inherit property "currentRemoteDescription" with the proper type (8)
PASS RTCPeerConnection interface: pc must inherit property "pendingRemoteDescription" with the proper type (9)
PASS RTCPeerConnection interface: pc must inherit property "addIceCandidate" with the proper type (10)
-PASS RTCPeerConnection interface: calling addIceCandidate(RTCIceCandidate) on pc with too few arguments must throw TypeError
+FAIL RTCPeerConnection interface: calling addIceCandidate([object Object],[object Object]) on pc with too few arguments must throw TypeError assert_unreached: Should have rejected: undefined Reached unreachable code
FAIL RTCPeerConnection interface: pc must inherit property "signalingState" with the proper type (11) Unrecognized type RTCSignalingState
FAIL RTCPeerConnection interface: pc must inherit property "iceGatheringState" with the proper type (12) Unrecognized type RTCIceGatheringState
FAIL RTCPeerConnection interface: pc must inherit property "iceConnectionState" with the proper type (13) Unrecognized type RTCIceConnectionState
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-idl.html (214440 => 214441)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-idl.html 2017-03-27 23:32:56 UTC (rev 214440)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-idl.html 2017-03-27 23:36:36 UTC (rev 214441)
@@ -33,7 +33,7 @@
readonly attribute RTCSessionDescription? remoteDescription;
readonly attribute RTCSessionDescription? currentRemoteDescription;
readonly attribute RTCSessionDescription? pendingRemoteDescription;
- Promise<void> addIceCandidate (RTCIceCandidate candidate);
+ Promise<void> addIceCandidate ((RTCIceCandidateInit or RTCIceCandidate) candidate);
readonly attribute RTCSignalingState signalingState;
readonly attribute RTCIceGatheringState iceGatheringState;
readonly attribute RTCIceConnectionState iceConnectionState;
Modified: trunk/LayoutTests/webrtc/datachannel/basic.html (214440 => 214441)
--- trunk/LayoutTests/webrtc/datachannel/basic.html 2017-03-27 23:32:56 UTC (rev 214440)
+++ trunk/LayoutTests/webrtc/datachannel/basic.html 2017-03-27 23:36:36 UTC (rev 214441)
@@ -95,7 +95,7 @@
remoteChannel = event.channel;
remoteChannel._onmessage_ = receiveMessages;
};
- }, (candidate) => { return candidate.candidate.toLowerCase().indexOf("udp") == -1; });
+ }, (candidate) => { return candidate && candidate.candidate.toLowerCase().indexOf("udp") == -1; });
});
}, "Basic data channel exchange from offerer to receiver using UDP only");
@@ -114,7 +114,7 @@
remoteChannel = event.channel;
remoteChannel._onmessage_ = receiveMessages;
};
- }, (candidate) => { return candidate.candidate.toLowerCase().indexOf("tcp") == -1; });
+ }, (candidate) => { return candidate && candidate.candidate.toLowerCase().indexOf("tcp") == -1; });
});
}, "Basic data channel exchange from offerer to receiver using TCP only");
Modified: trunk/LayoutTests/webrtc/routines.js (214440 => 214441)
--- trunk/LayoutTests/webrtc/routines.js 2017-03-27 23:32:56 UTC (rev 214440)
+++ trunk/LayoutTests/webrtc/routines.js 2017-03-27 23:36:36 UTC (rev 214441)
@@ -42,9 +42,6 @@
function iceCallback1(event, filterOutICECandidate)
{
- if (!event.candidate)
- return;
-
if (filterOutICECandidate && filterOutICECandidate(event.candidate))
return;
@@ -53,14 +50,10 @@
function iceCallback2(event, filterOutICECandidate)
{
- if (!event.candidate)
- return;
-
if (filterOutICECandidate && filterOutICECandidate(event.candidate))
return;
- if (event.candidate)
- localConnection.addIceCandidate(event.candidate).then(onAddIceCandidateSuccess, onAddIceCandidateError);
+ localConnection.addIceCandidate(event.candidate).then(onAddIceCandidateSuccess, onAddIceCandidateError);
}
function onAddIceCandidateSuccess()
@@ -69,6 +62,7 @@
function onAddIceCandidateError(error)
{
+ console.log("addIceCandidate error: " + error)
assert_unreached();
}
Modified: trunk/Source/WebCore/ChangeLog (214440 => 214441)
--- trunk/Source/WebCore/ChangeLog 2017-03-27 23:32:56 UTC (rev 214440)
+++ trunk/Source/WebCore/ChangeLog 2017-03-27 23:36:36 UTC (rev 214441)
@@ -1,3 +1,25 @@
+2017-03-27 Youenn Fablet <[email protected]>
+
+ addIceCandidate should not throw if passed null or undefined
+ https://bugs.webkit.org/show_bug.cgi?id=170118
+
+ Reviewed by Eric Carlson.
+
+ Covered by updated test.
+
+ A null/undefined candidate passed to addIceCandidate means end of Ice candidate..
+
+ * Modules/mediastream/PeerConnectionBackend.cpp:
+ (WebCore::PeerConnectionBackend::addIceCandidate):
+ * Modules/mediastream/PeerConnectionBackend.h:
+ (WebCore::PeerConnectionBackend::endOfIceCandidates):
+ * Modules/mediastream/RTCPeerConnection.cpp:
+ (WebCore::RTCPeerConnection::queuedAddIceCandidate):
+ * Modules/mediastream/RTCPeerConnection.h:
+ * Modules/mediastream/RTCPeerConnection.idl:
+ * Modules/mediastream/RTCPeerConnection.js:
+ (addIceCandidate):
+
2017-03-27 Antti Koivisto <[email protected]>
Allow the page to render before <link> stylesheet tags in body
Modified: trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp (214440 => 214441)
--- trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp 2017-03-27 23:32:56 UTC (rev 214440)
+++ trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp 2017-03-27 23:36:36 UTC (rev 214441)
@@ -225,16 +225,22 @@
m_setDescriptionPromise = std::nullopt;
}
-void PeerConnectionBackend::addIceCandidate(RTCIceCandidate& iceCandidate, DOMPromise<void>&& promise)
+void PeerConnectionBackend::addIceCandidate(RTCIceCandidate* iceCandidate, DOMPromise<void>&& promise)
{
ASSERT(m_peerConnection.signalingState() != RTCSignalingState::Closed);
- if (iceCandidate.sdpMid().isNull() && !iceCandidate.sdpMLineIndex()) {
+ if (!iceCandidate) {
+ endOfIceCandidates(WTFMove(promise));
+ return;
+ }
+
+ // FIXME: As per https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-addicecandidate(), this check should be done before enqueuing the task.
+ if (iceCandidate->sdpMid().isNull() && !iceCandidate->sdpMLineIndex()) {
promise.reject(Exception { TypeError, ASCIILiteral("Trying to add a candidate that is missing both sdpMid and sdpMLineIndex") });
return;
}
m_addIceCandidatePromise = WTFMove(promise);
- doAddIceCandidate(iceCandidate);
+ doAddIceCandidate(*iceCandidate);
}
void PeerConnectionBackend::addIceCandidateSucceeded()
Modified: trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h (214440 => 214441)
--- trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h 2017-03-27 23:32:56 UTC (rev 214440)
+++ trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h 2017-03-27 23:36:36 UTC (rev 214441)
@@ -62,7 +62,6 @@
using CreatePeerConnectionBackend = std::unique_ptr<PeerConnectionBackend> (*)(RTCPeerConnection&);
-// FIXME: What is the value of this abstract class? There is only one concrete class derived from it.
class PeerConnectionBackend {
public:
WEBCORE_EXPORT static CreatePeerConnectionBackend create;
@@ -74,7 +73,7 @@
void createAnswer(RTCAnswerOptions&&, PeerConnection::SessionDescriptionPromise&&);
void setLocalDescription(RTCSessionDescription&, DOMPromise<void>&&);
void setRemoteDescription(RTCSessionDescription&, DOMPromise<void>&&);
- void addIceCandidate(RTCIceCandidate&, DOMPromise<void>&&);
+ void addIceCandidate(RTCIceCandidate*, DOMPromise<void>&&);
virtual std::unique_ptr<RTCDataChannelHandler> createDataChannelHandler(const String&, const RTCDataChannelInit&) = 0;
@@ -137,6 +136,7 @@
virtual void doSetLocalDescription(RTCSessionDescription&) = 0;
virtual void doSetRemoteDescription(RTCSessionDescription&) = 0;
virtual void doAddIceCandidate(RTCIceCandidate&) = 0;
+ virtual void endOfIceCandidates(DOMPromise<void>&& promise) { promise.resolve(); }
virtual void doStop() = 0;
protected:
Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp (214440 => 214441)
--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp 2017-03-27 23:32:56 UTC (rev 214440)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp 2017-03-27 23:36:36 UTC (rev 214441)
@@ -278,7 +278,7 @@
return m_backend->pendingRemoteDescription();
}
-void RTCPeerConnection::queuedAddIceCandidate(RTCIceCandidate& rtcCandidate, DOMPromise<void>&& promise)
+void RTCPeerConnection::queuedAddIceCandidate(RTCIceCandidate* rtcCandidate, DOMPromise<void>&& promise)
{
if (m_signalingState == RTCSignalingState::Closed) {
promise.reject(INVALID_STATE_ERR);
Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h (214440 => 214441)
--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h 2017-03-27 23:32:56 UTC (rev 214440)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h 2017-03-27 23:36:36 UTC (rev 214441)
@@ -86,7 +86,7 @@
RefPtr<RTCSessionDescription> currentRemoteDescription() const;
RefPtr<RTCSessionDescription> pendingRemoteDescription() const;
- void queuedAddIceCandidate(RTCIceCandidate&, DOMPromise<void>&&);
+ void queuedAddIceCandidate(RTCIceCandidate*, DOMPromise<void>&&);
RTCSignalingState signalingState() const { return m_signalingState; }
RTCIceGatheringState iceGatheringState() const { return m_iceGatheringState; }
Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl (214440 => 214441)
--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl 2017-03-27 23:32:56 UTC (rev 214440)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl 2017-03-27 23:36:36 UTC (rev 214441)
@@ -110,7 +110,7 @@
[PrivateIdentifier] Promise<RTCSessionDescriptionInit> queuedCreateAnswer(optional RTCAnswerOptions answerOptions);
[PrivateIdentifier] Promise<void> queuedSetLocalDescription(RTCSessionDescription description);
[PrivateIdentifier] Promise<void> queuedSetRemoteDescription(RTCSessionDescription description);
- [PrivateIdentifier] Promise<void> queuedAddIceCandidate(RTCIceCandidate candidate);
+ [PrivateIdentifier] Promise<void> queuedAddIceCandidate(RTCIceCandidate? candidate);
// 4.11 Certificate management
Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.js (214440 => 214441)
--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.js 2017-03-27 23:32:56 UTC (rev 214440)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.js 2017-03-27 23:36:36 UTC (rev 214441)
@@ -250,7 +250,8 @@
"constructor": @RTCIceCandidate,
"argName": "candidate",
"argType": "RTCIceCandidate",
- "maybeDictionary": "true"
+ "maybeDictionary": "true",
+ "defaultsToNull" : "true"
};
return @objectAndCallbacksOverload(arguments, "addIceCandidate", objectInfo, function (candidate) {
// Promise mode