Title: [238230] trunk
Revision
238230
Author
[email protected]
Date
2018-11-15 08:41:26 -0800 (Thu, 15 Nov 2018)

Log Message

Update RTCPeerConnection JS built-ins to be closer to specWe
https://bugs.webkit.org/show_bug.cgi?id=191665

Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

* web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-idl-expected.txt:

Source/WebCore:

Simplify JS built-ins since we no longer need to support callback versions of the API.
Make sure to have the right number of parameters in the JS built-in functions.
Make some simplification to the code.
Covered by existing tests and rebased test.

* Modules/mediastream/RTCPeerConnection.js:
(createOffer):
(createAnswer):
(setLocalDescription):
(setRemoteDescription):
(addIceCandidate):
* Modules/mediastream/RTCPeerConnectionInternals.js:
(enqueueOperation):
(callbacksAndDictionaryOverload): Deleted.

LayoutTests:

* TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238229 => 238230)


--- trunk/LayoutTests/ChangeLog	2018-11-15 15:57:14 UTC (rev 238229)
+++ trunk/LayoutTests/ChangeLog	2018-11-15 16:41:26 UTC (rev 238230)
@@ -1,3 +1,12 @@
+2018-11-15  Youenn Fablet  <[email protected]>
+
+        Update RTCPeerConnection JS built-ins to be closer to specWe
+        https://bugs.webkit.org/show_bug.cgi?id=191665
+
+        Reviewed by Eric Carlson.
+
+        * TestExpectations:
+
 2018-11-15  Miguel Gomez  <[email protected]>
 
         Unreviewed GTK+ gardening after r238220.

Modified: trunk/LayoutTests/TestExpectations (238229 => 238230)


--- trunk/LayoutTests/TestExpectations	2018-11-15 15:57:14 UTC (rev 238229)
+++ trunk/LayoutTests/TestExpectations	2018-11-15 16:41:26 UTC (rev 238230)
@@ -1270,7 +1270,7 @@
 
 webrtc/simulcast-h264.html [ Slow ]
 webrtc/datachannel/multiple-connections.html [ Slow ]
-webkit.org/b/171094 imported/w3c/web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-idl.html [ Failure ]
+webkit.org/b/171094 imported/w3c/web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-idl.html [ Failure DumpJSConsoleLogInStdErr ]
 webkit.org/b/172f21 imported/w3c/web-platform-tests/webrtc/getstats.html [ Failure ]
 imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-offer.html [ Failure ]
 imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-answer.html [ Failure ]

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (238229 => 238230)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-11-15 15:57:14 UTC (rev 238229)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-11-15 16:41:26 UTC (rev 238230)
@@ -1,3 +1,12 @@
+2018-11-15  Youenn Fablet  <[email protected]>
+
+        Update RTCPeerConnection JS built-ins to be closer to specWe
+        https://bugs.webkit.org/show_bug.cgi?id=191665
+
+        Reviewed by Eric Carlson.
+
+        * web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-idl-expected.txt:
+
 2018-11-15  Manuel Rego Casasnovas  <[email protected]>
 
         [css-grid] Consider scrollbars in populateGridPositionsForDirection()

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-idl-expected.txt (238229 => 238230)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-idl-expected.txt	2018-11-15 15:57:14 UTC (rev 238229)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-idl-expected.txt	2018-11-15 16:41:26 UTC (rev 238230)
@@ -24,11 +24,11 @@
 PASS RTCPeerConnection interface: existence and properties of interface prototype object's @@unscopables property 
 PASS RTCPeerConnection interface: operation createOffer(RTCOfferOptions) 
 PASS RTCPeerConnection interface: operation createAnswer(RTCAnswerOptions) 
-FAIL RTCPeerConnection interface: operation setLocalDescription(RTCSessionDescription) assert_equals: property has wrong .length expected 1 but got 0
+PASS RTCPeerConnection interface: operation setLocalDescription(RTCSessionDescription) 
 PASS RTCPeerConnection interface: attribute localDescription 
 PASS RTCPeerConnection interface: attribute currentLocalDescription 
 PASS RTCPeerConnection interface: attribute pendingLocalDescription 
-FAIL RTCPeerConnection interface: operation setRemoteDescription(RTCSessionDescription) assert_equals: property has wrong .length expected 1 but got 0
+PASS RTCPeerConnection interface: operation setRemoteDescription(RTCSessionDescription) 
 PASS RTCPeerConnection interface: attribute remoteDescription 
 PASS RTCPeerConnection interface: attribute currentRemoteDescription 
 PASS RTCPeerConnection interface: attribute pendingRemoteDescription 
@@ -48,11 +48,15 @@
 FAIL RTCPeerConnection interface: operation createOffer(RTCSessionDescriptionCallback, RTCPeerConnectionErrorCallback, RTCOfferOptions) assert_throws: calling operation with this = null didn't throw TypeError function "function () {
             fn.apply(obj, args);
         }" did not throw
-FAIL RTCPeerConnection interface: operation setLocalDescription(RTCSessionDescription, VoidFunction, RTCPeerConnectionErrorCallback) assert_equals: property has wrong .length expected 1 but got 0
+FAIL RTCPeerConnection interface: operation setLocalDescription(RTCSessionDescription, VoidFunction, RTCPeerConnectionErrorCallback) assert_throws: calling operation with this = null didn't throw TypeError function "function () {
+            fn.apply(obj, args);
+        }" did not throw
 FAIL RTCPeerConnection interface: operation createAnswer(RTCSessionDescriptionCallback, RTCPeerConnectionErrorCallback) assert_throws: calling operation with this = null didn't throw TypeError function "function () {
             fn.apply(obj, args);
         }" did not throw
-FAIL RTCPeerConnection interface: operation setRemoteDescription(RTCSessionDescription, VoidFunction, RTCPeerConnectionErrorCallback) assert_equals: property has wrong .length expected 1 but got 0
+FAIL RTCPeerConnection interface: operation setRemoteDescription(RTCSessionDescription, VoidFunction, RTCPeerConnectionErrorCallback) assert_throws: calling operation with this = null didn't throw TypeError function "function () {
+            fn.apply(obj, args);
+        }" did not throw
 FAIL RTCPeerConnection interface: operation addIceCandidate(RTCIceCandidate, VoidFunction, RTCPeerConnectionErrorCallback) assert_throws: calling operation with this = null didn't throw TypeError function "function () {
             fn.apply(obj, args);
         }" did not throw

Modified: trunk/Source/WebCore/ChangeLog (238229 => 238230)


--- trunk/Source/WebCore/ChangeLog	2018-11-15 15:57:14 UTC (rev 238229)
+++ trunk/Source/WebCore/ChangeLog	2018-11-15 16:41:26 UTC (rev 238230)
@@ -1,3 +1,25 @@
+2018-11-15  Youenn Fablet  <[email protected]>
+
+        Update RTCPeerConnection JS built-ins to be closer to specWe
+        https://bugs.webkit.org/show_bug.cgi?id=191665
+
+        Reviewed by Eric Carlson.
+
+        Simplify JS built-ins since we no longer need to support callback versions of the API.
+        Make sure to have the right number of parameters in the JS built-in functions.
+        Make some simplification to the code.
+        Covered by existing tests and rebased test.
+
+        * Modules/mediastream/RTCPeerConnection.js:
+        (createOffer):
+        (createAnswer):
+        (setLocalDescription):
+        (setRemoteDescription):
+        (addIceCandidate):
+        * Modules/mediastream/RTCPeerConnectionInternals.js:
+        (enqueueOperation):
+        (callbacksAndDictionaryOverload): Deleted.
+
 2018-11-15  Simon Fraser  <[email protected]>
 
         REGRESSION(r238090): Composited iframe contents disappear after switching tabs in Safari

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.js (238229 => 238230)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.js	2018-11-15 15:57:14 UTC (rev 238229)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.js	2018-11-15 16:41:26 UTC (rev 238230)
@@ -52,12 +52,9 @@
     if (!@isRTCPeerConnection(this))
         return @Promise.@reject(@makeThisTypeError("RTCPeerConnection", "createOffer"));
 
-    const peerConnection = this;
-
-    return @callbacksAndDictionaryOverload(arguments, "createOffer", function (options) {
-        return @enqueueOperation(peerConnection, function () {
-            return peerConnection.@queuedCreateOffer(options);
-        });
+    const offerOptions = arguments[0];
+    return @enqueueOperation(this, () => {
+        return this.@queuedCreateOffer(offerOptions);
     });
 }
 
@@ -68,16 +65,13 @@
     if (!@isRTCPeerConnection(this))
         return @Promise.@reject(@makeThisTypeError("RTCPeerConnection", "createAnswer"));
 
-    const peerConnection = this;
-
-    return @callbacksAndDictionaryOverload(arguments, "createAnswer", function (options) {
-        return @enqueueOperation(peerConnection, function () {
-            return peerConnection.@queuedCreateAnswer(options);
-        });
+    const answerOptions = arguments[0];
+    return @enqueueOperation(this, () => {
+        return this.@queuedCreateAnswer(answerOptions);
     });
 }
 
-function setLocalDescription()
+function setLocalDescription(description)
 {
     "use strict";
 
@@ -84,7 +78,8 @@
     if (!@isRTCPeerConnection(this))
         return @Promise.@reject(@makeThisTypeError("RTCPeerConnection", "setLocalDescription"));
 
-    const peerConnection = this;
+    if (arguments.length < 1)
+        return @Promise.@reject(new @TypeError("Not enough arguments"));
 
     // FIXME 169644: According the spec, we should throw when receiving a RTCSessionDescription.
     const objectInfo = {
@@ -93,14 +88,14 @@
         "argType": "RTCSessionDescription",
         "maybeDictionary": "true"
     };
-    return @objectAndCallbacksOverload(arguments, "setLocalDescription", objectInfo, function (description) {
-        return @enqueueOperation(peerConnection, function () {
-            return peerConnection.@queuedSetLocalDescription(description);
+    return @objectOverload(description, "setLocalDescription", objectInfo, (description) => {
+        return @enqueueOperation(this, () => {
+            return this.@queuedSetLocalDescription(description);
         });
     });
 }
 
-function setRemoteDescription()
+function setRemoteDescription(description)
 {
     "use strict";
 
@@ -107,7 +102,8 @@
     if (!@isRTCPeerConnection(this))
         return @Promise.@reject(@makeThisTypeError("RTCPeerConnection", "setRemoteDescription"));
 
-    const peerConnection = this;
+    if (arguments.length < 1)
+        return @Promise.@reject(new @TypeError("Not enough arguments"));
 
     // FIXME: According the spec, we should only expect RTCSessionDescriptionInit.
     const objectInfo = {
@@ -116,9 +112,9 @@
         "argType": "RTCSessionDescription",
         "maybeDictionary": "true"
     };
-    return @objectAndCallbacksOverload(arguments, "setRemoteDescription", objectInfo, function (description) {
-        return @enqueueOperation(peerConnection, function () {
-            return peerConnection.@queuedSetRemoteDescription(description);
+    return @objectOverload(description, "setRemoteDescription", objectInfo, (description) => {
+        return @enqueueOperation(this, () => {
+            return this.@queuedSetRemoteDescription(description);
         });
     });
 }
@@ -133,8 +129,6 @@
     if (arguments.length < 1)
         return @Promise.@reject(new @TypeError("Not enough arguments"));
 
-    const peerConnection = this;
-
     const objectInfo = {
         "constructor": @RTCIceCandidate,
         "argName": "candidate",
@@ -142,9 +136,9 @@
         "maybeDictionary": "true",
         "defaultsToNull" : "true"
     };
-    return @objectAndCallbacksOverload(arguments, "addIceCandidate", objectInfo, function (candidate) {
-        return @enqueueOperation(peerConnection, function () {
-            return peerConnection.@queuedAddIceCandidate(candidate);
+    return @objectOverload(candidate, "addIceCandidate", objectInfo, (candidate) => {
+        return @enqueueOperation(this, () => {
+            return this.@queuedAddIceCandidate(candidate);
         });
     });
 }

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js (238229 => 238230)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js	2018-11-15 15:57:14 UTC (rev 238229)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js	2018-11-15 16:41:26 UTC (rev 238230)
@@ -49,17 +49,15 @@
             operation().@then(resolve, reject).@then(runNext, runNext);
         });
 
-        if (operations.length == 1)
+        if (operations.length === 1)
             operations[0]();
     });
 }
 
-function objectAndCallbacksOverload(args, functionName, objectInfo, promiseMode)
+function objectOverload(objectArg, functionName, objectInfo, promiseMode)
 {
     "use strict";
 
-    let argsCount = args.length;
-    let objectArg = args[0];
     let objectArgOk = false;
 
     const hasMatchingType = objectArg instanceof objectInfo.constructor;
@@ -83,17 +81,6 @@
     return promiseMode(objectArg);
 }
 
-function callbacksAndDictionaryOverload(args, functionName, promiseMode)
-{
-    "use strict";
-
-    const options = args[0];
-    if (args.length && !@isDictionary(options))
-        return @Promise.@reject(new @TypeError(`Argument 1 ('options') to RTCPeerConnection.${functionName} must be a dictionary`));
-
-    return promiseMode(options);
-}
-
 function isRTCPeerConnection(connection)
 {
     "use strict";
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to