Title: [214527] trunk
Revision
214527
Author
[email protected]
Date
2017-03-28 21:09:14 -0700 (Tue, 28 Mar 2017)

Log Message

[WebRTC] After r214441 addIceCandidate no longer accepts an RTCIceCandidateInit dictionary
https://bugs.webkit.org/show_bug.cgi?id=170192

Patch by Youenn Fablet <[email protected]> on 2017-03-28
Reviewed by Jon Lee.

Source/WebCore:

Covered by updated tests.

* Modules/mediastream/RTCIceCandidate.idl: Candidate is no longer a required field in RTCIceCandidateInit.
* Modules/mediastream/RTCPeerConnectionInternals.js: Reworking defaultsToNull to handle both undefined and null cases.

LayoutTests:

* fast/mediastream/RTCIceCandidate-expected.txt:
* fast/mediastream/RTCIceCandidate.html: Removing no longer valid tests.
* fast/mediastream/RTCPeerConnection-addIceCandidate-expected.txt:
* fast/mediastream/RTCPeerConnection-addIceCandidate.html: Adding more tests to cover null/undefined cases.
Ensuring sdpMid has a valid value.
* fast/mediastream/resources/promise-utils.js: Improving error logging.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (214526 => 214527)


--- trunk/LayoutTests/ChangeLog	2017-03-29 04:02:17 UTC (rev 214526)
+++ trunk/LayoutTests/ChangeLog	2017-03-29 04:09:14 UTC (rev 214527)
@@ -1,3 +1,17 @@
+2017-03-28  Youenn Fablet  <[email protected]>
+
+        [WebRTC] After r214441 addIceCandidate no longer accepts an RTCIceCandidateInit dictionary
+        https://bugs.webkit.org/show_bug.cgi?id=170192
+
+        Reviewed by Jon Lee.
+
+        * fast/mediastream/RTCIceCandidate-expected.txt:
+        * fast/mediastream/RTCIceCandidate.html: Removing no longer valid tests.
+        * fast/mediastream/RTCPeerConnection-addIceCandidate-expected.txt:
+        * fast/mediastream/RTCPeerConnection-addIceCandidate.html: Adding more tests to cover null/undefined cases.
+        Ensuring sdpMid has a valid value.
+        * fast/mediastream/resources/promise-utils.js: Improving error logging.
+
 2017-03-27  Brent Fulgham  <[email protected]>
 
         Only attach Attributes to a given element one time

Modified: trunk/LayoutTests/fast/mediastream/RTCIceCandidate-expected.txt (214526 => 214527)


--- trunk/LayoutTests/fast/mediastream/RTCIceCandidate-expected.txt	2017-03-29 04:02:17 UTC (rev 214526)
+++ trunk/LayoutTests/fast/mediastream/RTCIceCandidate-expected.txt	2017-03-29 04:09:14 UTC (rev 214527)
@@ -33,12 +33,6 @@
 
 Dictionary argument is mandatory.
 PASS new RTCIceCandidate(); threw exception TypeError: Not enough arguments.
-Dictionary member 'candidate' is required.
-PASS new RTCIceCandidate({}); threw exception TypeError: Member RTCIceCandidateInit.candidate is required and must be an instance of DOMString.
-PASS new RTCIceCandidate({sdpMid:"bar", sdpMLineIndex:6}); threw exception TypeError: Member RTCIceCandidateInit.candidate is required and must be an instance of DOMString.
-PASS new RTCIceCandidate({sdpMid:"bar"}); threw exception TypeError: Member RTCIceCandidateInit.candidate is required and must be an instance of DOMString.
-PASS new RTCIceCandidate({sdpMLineIndex:6}); threw exception TypeError: Member RTCIceCandidateInit.candidate is required and must be an instance of DOMString.
-
 One of the 'sdpMid' or 'sdpMLineIndex' members must be present (and not null or undefined).
 PASS new RTCIceCandidate({candidate:"foo"}); threw exception TypeError: Type error.
 PASS new RTCIceCandidate({candidate:"foo", sdpMid: null}); threw exception TypeError: Type error.

Modified: trunk/LayoutTests/fast/mediastream/RTCIceCandidate.html (214526 => 214527)


--- trunk/LayoutTests/fast/mediastream/RTCIceCandidate.html	2017-03-29 04:02:17 UTC (rev 214526)
+++ trunk/LayoutTests/fast/mediastream/RTCIceCandidate.html	2017-03-29 04:09:14 UTC (rev 214527)
@@ -54,13 +54,6 @@
             debug("Dictionary argument is mandatory.");
             shouldThrow('new RTCIceCandidate();');
 
-            debug("Dictionary member 'candidate' is required.");
-            shouldThrow('new RTCIceCandidate({});');
-            shouldThrow('new RTCIceCandidate({sdpMid:"bar", sdpMLineIndex:6});');
-            shouldThrow('new RTCIceCandidate({sdpMid:"bar"});');
-            shouldThrow('new RTCIceCandidate({sdpMLineIndex:6});');
-            debug("");
-
             debug("One of the 'sdpMid' or 'sdpMLineIndex' members must be present (and not null or undefined).");
             shouldThrow('new RTCIceCandidate({candidate:"foo"});');
             shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMid: null});');

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-addIceCandidate-expected.txt (214526 => 214527)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-addIceCandidate-expected.txt	2017-03-29 04:02:17 UTC (rev 214526)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-addIceCandidate-expected.txt	2017-03-29 04:09:14 UTC (rev 214527)
@@ -18,12 +18,17 @@
 *** A (bad) sdpMid takes precedesce over valid sdpMLineIndex
 FAIL promise pc.addIceCandidate(new RTCIceCandidate({candidate: validCandidate, sdpMid: badSdpMid, sdpMLineIndex: sdpMLineIndex})) fulfilled unexpectedly.
 *** Test bad candidate content with valid sdpMid
-FAIL evaluating pc.addIceCandidate(new RTCIceCandidate({candidate: 'bad content', sdpMid: sdpMid})) threw exception TypeError: Type error
+PASS promise pc.addIceCandidate(new RTCIceCandidate({candidate: 'bad content', sdpMid: sdpMid})) rejected with OperationError (DOM Exception 34): Expect line: candidate:<candidate-str>
 *** Test bad candidate content with valid sdpMLineIndex
 PASS promise pc.addIceCandidate(new RTCIceCandidate({candidate: 'bad content', sdpMLineIndex: sdpMLineIndex})) rejected with OperationError (DOM Exception 34): Expect line: candidate:<candidate-str>
+*** Test valid candidate with no mid and mlineindex
+PASS promise pc.addIceCandidate({candidate: validCandidate}) rejected with TypeError: Argument 1 ('candidate') to RTCPeerConnection.addIceCandidate must be an instance of RTCIceCandidate
 
 *** Test some OK input
-FAIL promise pc.addIceCandidate({candidate: validCandidate, sdpMid: sdpMid}) rejected unexpectedly.
+PASS promise pc.addIceCandidate({candidate: validCandidate, sdpMid: sdpMid}) fulfilled with undefined
+PASS promise pc.addIceCandidate({candidate: validCandidate, sdpMLineIndex: sdpMLineIndex}) fulfilled with undefined
+PASS promise pc.addIceCandidate(undefined) fulfilled with undefined
+PASS promise pc.addIceCandidate(null) fulfilled with undefined
 PASS promise pc.addIceCandidate(new RTCIceCandidate({candidate: validCandidate, sdpMLineIndex: sdpMLineIndex})) fulfilled with undefined
 *** A valid sdpMid takes precedesce over a bad sdpMLineIndex
 PASS promise pc.addIceCandidate(new RTCIceCandidate({candidate: validCandidate, sdpMid: sdpMid, sdpMLineIndex: badSdpMLineIndex})) fulfilled with undefined

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-addIceCandidate.html (214526 => 214527)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-addIceCandidate.html	2017-03-29 04:02:17 UTC (rev 214526)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-addIceCandidate.html	2017-03-29 04:09:14 UTC (rev 214527)
@@ -55,6 +55,8 @@
                 badSdpMid = sdpMid + "_foo";
                 shouldNotBe("sdpMid", "badSdpMid");
 
+                sdpMid = 1;
+
                 return promiseShouldReject("pc.addIceCandidate(new RTCIceCandidate({candidate: validCandidate, sdpMid: badSdpMid}))");
             })
             .then(function () {
@@ -73,11 +75,24 @@
                 return promiseShouldReject("pc.addIceCandidate(new RTCIceCandidate({candidate: 'bad content', sdpMLineIndex: sdpMLineIndex}))");
             })
             .then(function () {
+                debug("*** Test valid candidate with no mid and mlineindex");
+                return promiseShouldReject("pc.addIceCandidate({candidate: validCandidate})");
+            })
+            .then(function () {
                 debug("<br>*** Test some OK input");
                 // Testing passing a RTCIceCandidateInit
                 return promiseShouldResolve("pc.addIceCandidate({candidate: validCandidate, sdpMid: sdpMid})");
             })
             .then(function () {
+                return promiseShouldResolve("pc.addIceCandidate({candidate: validCandidate, sdpMLineIndex: sdpMLineIndex})");
+            })
+            .then(function () {
+                return promiseShouldResolve("pc.addIceCandidate(undefined)");
+            })
+            .then(function () {
+                return promiseShouldResolve("pc.addIceCandidate(null)");
+            })
+            .then(function () {
                 // Testing passing a RTCIceCandidate
                 return promiseShouldResolve("pc.addIceCandidate(new RTCIceCandidate({candidate: validCandidate, sdpMLineIndex: sdpMLineIndex}))");
             })

Modified: trunk/LayoutTests/fast/mediastream/resources/promise-utils.js (214526 => 214527)


--- trunk/LayoutTests/fast/mediastream/resources/promise-utils.js	2017-03-29 04:02:17 UTC (rev 214526)
+++ trunk/LayoutTests/fast/mediastream/resources/promise-utils.js	2017-03-29 04:09:14 UTC (rev 214527)
@@ -28,7 +28,7 @@
             done();
         })
         .catch(function (reason) {
-            testFailed("promise " + expr + " rejected unexpectedly.");
+            testFailed("promise " + expr + " rejected unexpectedly:" + reason);
             done();
         });
     });

Modified: trunk/Source/WebCore/ChangeLog (214526 => 214527)


--- trunk/Source/WebCore/ChangeLog	2017-03-29 04:02:17 UTC (rev 214526)
+++ trunk/Source/WebCore/ChangeLog	2017-03-29 04:09:14 UTC (rev 214527)
@@ -1,5 +1,17 @@
 2017-03-28  Youenn Fablet  <[email protected]>
 
+        [WebRTC] After r214441 addIceCandidate no longer accepts an RTCIceCandidateInit dictionary
+        https://bugs.webkit.org/show_bug.cgi?id=170192
+
+        Reviewed by Jon Lee.
+
+        Covered by updated tests.
+
+        * Modules/mediastream/RTCIceCandidate.idl: Candidate is no longer a required field in RTCIceCandidateInit.
+        * Modules/mediastream/RTCPeerConnectionInternals.js: Reworking defaultsToNull to handle both undefined and null cases.
+
+2017-03-28  Youenn Fablet  <[email protected]>
+
         LibWebRTCProvider should allow setting encoder and decoder factories
         https://bugs.webkit.org/show_bug.cgi?id=170212
 

Modified: trunk/Source/WebCore/Modules/mediastream/RTCIceCandidate.idl (214526 => 214527)


--- trunk/Source/WebCore/Modules/mediastream/RTCIceCandidate.idl	2017-03-29 04:02:17 UTC (rev 214526)
+++ trunk/Source/WebCore/Modules/mediastream/RTCIceCandidate.idl	2017-03-29 04:09:14 UTC (rev 214527)
@@ -61,8 +61,7 @@
     Conditional=WEB_RTC,
     EnabledAtRuntime=PeerConnection
 ] dictionary RTCIceCandidateInit {
-    // FIXME 169662: no longer required, with default string
-    required DOMString candidate;
+    DOMString candidate = "";
     DOMString? sdpMid = null;
     unsigned short? sdpMLineIndex = null;
     // FIXME 169662: missing ufrag

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js (214526 => 214527)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js	2017-03-29 04:02:17 UTC (rev 214526)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js	2017-03-29 04:09:14 UTC (rev 214527)
@@ -62,26 +62,18 @@
     let objectArg = args[0];
     let objectArgOk = false;
 
-    if (!argsCount) {
-        if (!objectInfo.defaultsToNull)
-            return @Promise.@reject(new @TypeError("Not enough arguments"));
-
+    const hasMatchingType = objectArg instanceof objectInfo.constructor;
+    if (hasMatchingType)
+        objectArgOk = true;
+    else if (objectArg == null && objectInfo.defaultsToNull) {
+        objectArgOk = true;
         objectArg = null;
-        objectArgOk = true;
-        argsCount = 1;
-    } else {
-        const hasMatchingType = objectArg instanceof objectInfo.constructor;
-        if (hasMatchingType)
+    } else if (objectInfo.maybeDictionary) {
+        try {
+            objectArg = new objectInfo.constructor(objectArg);
             objectArgOk = true;
-        else if (objectInfo.defaultsToNull)
-            objectArgOk = objectArg === null || typeof objectArg === "undefined";
-        else if (objectInfo.maybeDictionary) {
-            try {
-                objectArg = new objectInfo.constructor(objectArg);
-                objectArgOk = true;
-            } catch (e) {
-                objectArgOk = false;
-            }
+        } catch (e) {
+            objectArgOk = false;
         }
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to