Title: [218335] trunk
Revision
218335
Author
commit-qu...@webkit.org
Date
2017-06-15 09:24:20 -0700 (Thu, 15 Jun 2017)

Log Message

RTCPeerConnection returns RTCSessionDescription where RTCSessionDescriptionInit would be appropriate
https://bugs.webkit.org/show_bug.cgi?id=173118
<rdar://problem/32746761>

Patch by Youenn Fablet <you...@apple.com> on 2017-06-15
Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

* web-platform-tests/webrtc/RTCPeerConnection-createOffer-expected.txt:

Source/WebCore:

Test: webrtc/createOfferAnswer.html

Making the promise return a RTCSessionDescription::Init instead of a RTCSessionDescription.
This aligns with the spec and is more optimal.

* Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::createOfferSucceeded):
(WebCore::PeerConnectionBackend::createAnswerSucceeded):
* Modules/mediastream/PeerConnectionBackend.h:
* Modules/mediastream/RTCSessionDescription.idl:

LayoutTests:

* fast/mediastream/RTCPeerConnection-setLocalDescription-offer-expected.txt:
* fast/mediastream/RTCPeerConnection-setRemoteDescription-offer-expected.txt:
* webrtc/createOfferAnswer-expected.txt: Added.
* webrtc/createOfferAnswer.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (218334 => 218335)


--- trunk/LayoutTests/ChangeLog	2017-06-15 16:19:57 UTC (rev 218334)
+++ trunk/LayoutTests/ChangeLog	2017-06-15 16:24:20 UTC (rev 218335)
@@ -1,3 +1,16 @@
+2017-06-15  Youenn Fablet  <you...@apple.com>
+
+        RTCPeerConnection returns RTCSessionDescription where RTCSessionDescriptionInit would be appropriate
+        https://bugs.webkit.org/show_bug.cgi?id=173118
+        <rdar://problem/32746761>
+
+        Reviewed by Eric Carlson.
+
+        * fast/mediastream/RTCPeerConnection-setLocalDescription-offer-expected.txt:
+        * fast/mediastream/RTCPeerConnection-setRemoteDescription-offer-expected.txt:
+        * webrtc/createOfferAnswer-expected.txt: Added.
+        * webrtc/createOfferAnswer.html: Added.
+
 2017-06-15  Matt Lewis  <jlew...@apple.com>
 
         Marked imported/w3c/web-platform-tests/dom/nodes/Document-constructor-svg.svg as skip.

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-setLocalDescription-offer-expected.txt (218334 => 218335)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-setLocalDescription-offer-expected.txt	2017-06-15 16:19:57 UTC (rev 218334)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-setLocalDescription-offer-expected.txt	2017-06-15 16:24:20 UTC (rev 218335)
@@ -19,8 +19,8 @@
 
 PASS firstOffer set as local description
 FAIL pc.signalingState should be have-local-offer. Was stable.
-FAIL pc.localDescription should be [object RTCSessionDescription]. Was null.
-FAIL pc.pendingLocalDescription should be [object RTCSessionDescription]. Was null.
+FAIL pc.localDescription should be [object Object]. Was null.
+FAIL pc.pendingLocalDescription should be [object Object]. Was null.
 PASS pc.currentLocalDescription is null
 FAIL Error caught in promise chain: TypeError: null is not an object (evaluating 'pc.localDescription.type')
 PASS successfullyParsed is true

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-setRemoteDescription-offer-expected.txt (218334 => 218335)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-setRemoteDescription-offer-expected.txt	2017-06-15 16:19:57 UTC (rev 218334)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-setRemoteDescription-offer-expected.txt	2017-06-15 16:24:20 UTC (rev 218335)
@@ -12,8 +12,8 @@
 
 PASS remoteOffer1 set as remote description
 FAIL pc.signalingState should be have-remote-offer. Was stable.
-FAIL pc.remoteDescription should be [object RTCSessionDescription]. Was null.
-FAIL pc.pendingRemoteDescription should be [object RTCSessionDescription]. Was null.
+FAIL pc.remoteDescription should be [object Object]. Was null.
+FAIL pc.pendingRemoteDescription should be [object Object]. Was null.
 PASS pc.currentRemoteDescription is null
 
 PASS remoteOffer1 set as remote description (again)
@@ -29,8 +29,8 @@
 
 PASS remoteOffer2 set as remote description
 FAIL pc.signalingState should be have-remote-offer. Was stable.
-FAIL pc.remoteDescription should be [object RTCSessionDescription]. Was null.
-FAIL pc.pendingRemoteDescription should be [object RTCSessionDescription]. Was null.
+FAIL pc.remoteDescription should be [object Object]. Was null.
+FAIL pc.pendingRemoteDescription should be [object Object]. Was null.
 PASS pc.currentRemoteDescription is null
 
 PASS successfullyParsed is true

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (218334 => 218335)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-06-15 16:19:57 UTC (rev 218334)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-06-15 16:24:20 UTC (rev 218335)
@@ -1,3 +1,13 @@
+2017-06-15  Youenn Fablet  <you...@apple.com>
+
+        RTCPeerConnection returns RTCSessionDescription where RTCSessionDescriptionInit would be appropriate
+        https://bugs.webkit.org/show_bug.cgi?id=173118
+        <rdar://problem/32746761>
+
+        Reviewed by Eric Carlson.
+
+        * web-platform-tests/webrtc/RTCPeerConnection-createOffer-expected.txt:
+
 2017-06-14  Nael Ouedraogo  <nael.ouedra...@crf.canon.fr>
 
         MediaSource duration attribute should not be equal to Infinity when set to a value greater than 2^64

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-createOffer-expected.txt (218334 => 218335)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-createOffer-expected.txt	2017-06-15 16:19:57 UTC (rev 218334)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-createOffer-expected.txt	2017-06-15 16:24:20 UTC (rev 218335)
@@ -1,5 +1,5 @@
 
-FAIL createOffer() with no argument from newly created RTCPeerConnection should succeed assert_false: Expect offer to not be instance of RTCSessionDescription expected false got true
+PASS createOffer() with no argument from newly created RTCPeerConnection should succeed 
 FAIL createOffer() and then setLocalDescription() should succeed assert_not_equals: Expect session description to be defined, but got undefined got disallowed value undefined
 PASS createOffer() after connection is closed should reject with InvalidStateError 
 PASS createOffer() when connection is closed halfway should never resolve 

Added: trunk/LayoutTests/webrtc/createOfferAnswer-expected.txt (0 => 218335)


--- trunk/LayoutTests/webrtc/createOfferAnswer-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webrtc/createOfferAnswer-expected.txt	2017-06-15 16:24:20 UTC (rev 218335)
@@ -0,0 +1,4 @@
+
+PASS Ensuring that offer is a RTCSessionDescriptionInit 
+PASS Ensuring that answer is a RTCSessionDescriptionInit 
+

Added: trunk/LayoutTests/webrtc/createOfferAnswer.html (0 => 218335)


--- trunk/LayoutTests/webrtc/createOfferAnswer.html	                        (rev 0)
+++ trunk/LayoutTests/webrtc/createOfferAnswer.html	2017-06-15 16:24:20 UTC (rev 218335)
@@ -0,0 +1,39 @@
+<!doctype html>
+<html>
+    <head>
+        <meta charset="utf-8">
+        <title>Testing createOffer/createAnswer</title>
+        <script src=""
+        <script src=""
+    </head>
+    <body>
+        <script>
+
+var pc1 = new RTCPeerConnection();
+var pc1Offer;
+promise_test((test) => {
+    pc1.addTransceiver("video");
+
+    return pc1.createOffer().then((offer) => {
+        pc1Offer = offer;
+        assert_false(offer instanceof RTCSessionDescription);
+    });
+}, "Ensuring that offer is a RTCSessionDescriptionInit");
+
+
+promise_test((test) => {
+    var pc2 = new RTCPeerConnection();
+    pc2.addTransceiver("video");
+
+    return pc2.setRemoteDescription(pc1Offer).then(() => {
+        return pc2.createAnswer();
+    }).then((answer) => {
+        assert_false(pc1Offer instanceof RTCSessionDescription);
+        pc1Offer.sdp = "";
+        answer.sdp = "";
+    });
+}, "Ensuring that answer is a RTCSessionDescriptionInit");
+
+        </script>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (218334 => 218335)


--- trunk/Source/WebCore/ChangeLog	2017-06-15 16:19:57 UTC (rev 218334)
+++ trunk/Source/WebCore/ChangeLog	2017-06-15 16:24:20 UTC (rev 218335)
@@ -1,3 +1,22 @@
+2017-06-15  Youenn Fablet  <you...@apple.com>
+
+        RTCPeerConnection returns RTCSessionDescription where RTCSessionDescriptionInit would be appropriate
+        https://bugs.webkit.org/show_bug.cgi?id=173118
+        <rdar://problem/32746761>
+
+        Reviewed by Eric Carlson.
+
+        Test: webrtc/createOfferAnswer.html
+
+        Making the promise return a RTCSessionDescription::Init instead of a RTCSessionDescription.
+        This aligns with the spec and is more optimal.
+
+        * Modules/mediastream/PeerConnectionBackend.cpp:
+        (WebCore::PeerConnectionBackend::createOfferSucceeded):
+        (WebCore::PeerConnectionBackend::createAnswerSucceeded):
+        * Modules/mediastream/PeerConnectionBackend.h:
+        * Modules/mediastream/RTCSessionDescription.idl:
+
 2017-06-15 Emilio Cobos Álvarez  <eco...@igalia.com>
 
         Don't always recalc the style of display: contents elements.

Modified: trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp (218334 => 218335)


--- trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp	2017-06-15 16:19:57 UTC (rev 218334)
+++ trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp	2017-06-15 16:24:20 UTC (rev 218335)
@@ -62,7 +62,7 @@
         return;
 
     ASSERT(m_offerAnswerPromise);
-    m_offerAnswerPromise->resolve(RTCSessionDescription::create(RTCSdpType::Offer, filterSDP(WTFMove(sdp))));
+    m_offerAnswerPromise->resolve(RTCSessionDescription::Init { RTCSdpType::Offer, filterSDP(WTFMove(sdp)) });
     m_offerAnswerPromise = std::nullopt;
 }
 
@@ -97,7 +97,7 @@
         return;
 
     ASSERT(m_offerAnswerPromise);
-    m_offerAnswerPromise->resolve(RTCSessionDescription::create(RTCSdpType::Answer, WTFMove(sdp)));
+    m_offerAnswerPromise->resolve(RTCSessionDescription::Init { RTCSdpType::Answer, WTFMove(sdp) });
     m_offerAnswerPromise = std::nullopt;
 }
 

Modified: trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h (218334 => 218335)


--- trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h	2017-06-15 16:19:57 UTC (rev 218334)
+++ trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h	2017-06-15 16:24:20 UTC (rev 218335)
@@ -35,6 +35,7 @@
 
 #include "JSDOMPromiseDeferred.h"
 #include "RTCRtpParameters.h"
+#include "RTCSessionDescription.h"
 #include "RTCSignalingState.h"
 
 namespace WebCore {
@@ -56,7 +57,7 @@
 struct RTCOfferOptions;
 
 namespace PeerConnection {
-using SessionDescriptionPromise = DOMPromiseDeferred<IDLInterface<RTCSessionDescription>>;
+using SessionDescriptionPromise = DOMPromiseDeferred<IDLDictionary<RTCSessionDescription::Init>>;
 using StatsPromise = DOMPromiseDeferred<IDLInterface<RTCStatsReport>>;
 }
 

Modified: trunk/Source/WebCore/Modules/mediastream/RTCSessionDescription.idl (218334 => 218335)


--- trunk/Source/WebCore/Modules/mediastream/RTCSessionDescription.idl	2017-06-15 16:19:57 UTC (rev 218334)
+++ trunk/Source/WebCore/Modules/mediastream/RTCSessionDescription.idl	2017-06-15 16:24:20 UTC (rev 218335)
@@ -48,13 +48,16 @@
     PrivateIdentifier,
     PublicIdentifier,
 ] interface RTCSessionDescription {
-    [SetterMayThrowException] readonly attribute RTCSdpType type;
+    readonly attribute RTCSdpType type;
     readonly attribute DOMString sdp;
 
     serializer = {type, sdp};
 };
 
-dictionary RTCSessionDescriptionInit {
+[
+    Conditional=WEB_RTC,
+    JSGenerateToJSObject
+] dictionary RTCSessionDescriptionInit {
     required RTCSdpType type;
     DOMString sdp = "";
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to