Title: [211436] trunk
Revision
211436
Author
[email protected]
Date
2017-01-31 09:52:33 -0800 (Tue, 31 Jan 2017)

Log Message

RTCPeerConnection methods can take dictionaries as input
https://bugs.webkit.org/show_bug.cgi?id=167590

Patch by Youenn Fablet <[email protected]> on 2017-01-31
Reviewed by Alex Christensen.

Source/WebCore:

Test: webrtc/rtcpeerconnection-error-messages.html

Made addIceCandidate/setRemoteDescription/setLocalDescription take either dictionaries or objects as parameter.
Spec only mandates this for addIceCandidate, but sites may be using the old version for setRemoteDescription and setLocalDescription.

Updated RTCPeerConnection methods error messages.

* Modules/mediastream/RTCPeerConnection.js:
(getLocalStreams):
(getStreamById):
(addStream):
(createOffer):
(createAnswer):
(setLocalDescription):
(setRemoteDescription):
(addIceCandidate):
(getStats):
* Modules/mediastream/RTCPeerConnectionInternals.js:

LayoutTests:

Replacing fast/mediastream/RTCPeerConnection-js-built-ins-check-this.html by webrtc/rtcpeerconnection-error-messages.html.
It is a bit more thorough and does not hard code the error message.

* fast/mediastream/RTCPeerConnection-addIceCandidate-expected.txt:
* fast/mediastream/RTCPeerConnection-addIceCandidate.html:
* fast/mediastream/RTCPeerConnection-js-built-ins-check-this-expected.txt: Removed.
* fast/mediastream/RTCPeerConnection-js-built-ins-check-this.html: Removed.
* fast/mediastream/RTCPeerConnection-setLocalDescription-offer-expected.txt:
* fast/mediastream/RTCPeerConnection-setLocalDescription-offer.html:
* fast/mediastream/RTCPeerConnection-setRemoteDescription-offer-expected.txt:
* fast/mediastream/RTCPeerConnection-setRemoteDescription-offer.html:
* webrtc/rtcpeerconnection-error-messages-expected.txt: Added.
* webrtc/rtcpeerconnection-error-messages.html: Added.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (211435 => 211436)


--- trunk/LayoutTests/ChangeLog	2017-01-31 17:21:42 UTC (rev 211435)
+++ trunk/LayoutTests/ChangeLog	2017-01-31 17:52:33 UTC (rev 211436)
@@ -1,3 +1,24 @@
+2017-01-31  Youenn Fablet  <[email protected]>
+
+        RTCPeerConnection methods can take dictionaries as input
+        https://bugs.webkit.org/show_bug.cgi?id=167590
+
+        Reviewed by Alex Christensen.
+
+        Replacing fast/mediastream/RTCPeerConnection-js-built-ins-check-this.html by webrtc/rtcpeerconnection-error-messages.html.
+        It is a bit more thorough and does not hard code the error message.
+
+        * fast/mediastream/RTCPeerConnection-addIceCandidate-expected.txt:
+        * fast/mediastream/RTCPeerConnection-addIceCandidate.html:
+        * fast/mediastream/RTCPeerConnection-js-built-ins-check-this-expected.txt: Removed.
+        * fast/mediastream/RTCPeerConnection-js-built-ins-check-this.html: Removed.
+        * fast/mediastream/RTCPeerConnection-setLocalDescription-offer-expected.txt:
+        * fast/mediastream/RTCPeerConnection-setLocalDescription-offer.html:
+        * fast/mediastream/RTCPeerConnection-setRemoteDescription-offer-expected.txt:
+        * fast/mediastream/RTCPeerConnection-setRemoteDescription-offer.html:
+        * webrtc/rtcpeerconnection-error-messages-expected.txt: Added.
+        * webrtc/rtcpeerconnection-error-messages.html: Added.
+
 2017-01-31  Chris Dumez  <[email protected]>
 
         Add better test coverage for scripting windows opened via window.open()

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


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-addIceCandidate-expected.txt	2017-01-31 17:21:42 UTC (rev 211435)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-addIceCandidate-expected.txt	2017-01-31 17:52:33 UTC (rev 211436)
@@ -23,7 +23,7 @@
 PASS promise pc.addIceCandidate(new RTCIceCandidate({candidate: 'bad content', sdpMLineIndex: sdpMLineIndex})) rejected with OperationError (DOM Exception 34): Invalid candidate content
 
 *** Test some OK input
-PASS promise pc.addIceCandidate(new RTCIceCandidate({candidate: validCandidate, sdpMid: sdpMid})) fulfilled with undefined
+PASS promise pc.addIceCandidate({candidate: validCandidate, sdpMid: sdpMid}) 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 (211435 => 211436)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-addIceCandidate.html	2017-01-31 17:21:42 UTC (rev 211435)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-addIceCandidate.html	2017-01-31 17:52:33 UTC (rev 211436)
@@ -74,9 +74,11 @@
             })
             .then(function () {
                 debug("<br>*** Test some OK input");
-                return promiseShouldResolve("pc.addIceCandidate(new RTCIceCandidate({candidate: validCandidate, sdpMid: sdpMid}))");
+                // Testing passing a RTCIceCandidateInit
+                return promiseShouldResolve("pc.addIceCandidate({candidate: validCandidate, sdpMid: sdpMid})");
             })
             .then(function () {
+                // Testing passing a RTCIceCandidate
                 return promiseShouldResolve("pc.addIceCandidate(new RTCIceCandidate({candidate: validCandidate, sdpMLineIndex: sdpMLineIndex}))");
             })
             .then(function () {

Deleted: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-js-built-ins-check-this-expected.txt (211435 => 211436)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-js-built-ins-check-this-expected.txt	2017-01-31 17:21:42 UTC (rev 211435)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-js-built-ins-check-this-expected.txt	2017-01-31 17:52:33 UTC (rev 211436)
@@ -1,22 +0,0 @@
-Verify that the RTCPeerConnection JS built-in methods check calling 'this'
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS promise RTCPeerConnection.prototype.createOffer.call({}) rejected with TypeError: Function should be called on an RTCPeerConnection
-PASS promise RTCPeerConnection.prototype.createAnswer.call({}) rejected with TypeError: Function should be called on an RTCPeerConnection
-PASS promise RTCPeerConnection.prototype.setLocalDescription.call({}) rejected with TypeError: Function should be called on an RTCPeerConnection
-PASS promise RTCPeerConnection.prototype.setRemoteDescription.call({}) rejected with TypeError: Function should be called on an RTCPeerConnection
-PASS promise RTCPeerConnection.prototype.addIceCandidate.call({}) rejected with TypeError: Function should be called on an RTCPeerConnection
-FAIL promise RTCPeerConnection.prototype.getStats.call({}, null) rejected with TypeError: Can only call RTCPeerConnection.getStats on instances of RTCPeerConnection; expected reason TypeError: Function should be called on an RTCPeerConnection
-PASS promise objectWithPcPrototype.createOffer() rejected with TypeError: Function should be called on an RTCPeerConnection
-PASS promise objectWithPcPrototype.createAnswer() rejected with TypeError: Function should be called on an RTCPeerConnection
-PASS promise objectWithPcPrototype.setLocalDescription() rejected with TypeError: Function should be called on an RTCPeerConnection
-PASS promise objectWithPcPrototype.setRemoteDescription() rejected with TypeError: Function should be called on an RTCPeerConnection
-PASS promise objectWithPcPrototype.addIceCandidate() rejected with TypeError: Function should be called on an RTCPeerConnection
-FAIL promise objectWithPcPrototype.getStats() rejected with TypeError: Can only call RTCPeerConnection.getStats on instances of RTCPeerConnection; expected reason TypeError: Function should be called on an RTCPeerConnection
-PASS End of test promise chain
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-js-built-ins-check-this.html (211435 => 211436)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-js-built-ins-check-this.html	2017-01-31 17:21:42 UTC (rev 211435)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-js-built-ins-check-this.html	2017-01-31 17:52:33 UTC (rev 211436)
@@ -1,46 +0,0 @@
-<!DOCTYPE html>
-<html>
-    <head>
-        <script src=""
-        <script src=""
-    </head>
-    <body>
-        <script>
-            description("Verify that the RTCPeerConnection JS built-in methods check calling 'this'");
-
-            const reason = "TypeError: Function should be called on an RTCPeerConnection";
-
-            function Foo() {}
-            Foo.prototype = RTCPeerConnection.prototype;
-            let objectWithPcPrototype = new Foo();
-
-            promiseShouldReject("RTCPeerConnection.prototype.createOffer.call({})", "reason")
-            .then(() => promiseShouldReject("RTCPeerConnection.prototype.createAnswer.call({})", "reason"))
-            .then(() => promiseShouldReject("RTCPeerConnection.prototype.setLocalDescription.call({})", "reason"))
-            .then(() => promiseShouldReject("RTCPeerConnection.prototype.setRemoteDescription.call({})", "reason"))
-            .then(() => promiseShouldReject("RTCPeerConnection.prototype.addIceCandidate.call({})", "reason"))
-            .then(() => promiseShouldReject("RTCPeerConnection.prototype.getStats.call({}, null)", "reason"))
-
-            .then(() => promiseShouldReject("objectWithPcPrototype.createOffer()", "reason"))
-            .then(() => promiseShouldReject("objectWithPcPrototype.createAnswer()", "reason"))
-            .then(() => promiseShouldReject("objectWithPcPrototype.setLocalDescription()", "reason"))
-            .then(() => promiseShouldReject("objectWithPcPrototype.setRemoteDescription()", "reason"))
-            .then(() => promiseShouldReject("objectWithPcPrototype.addIceCandidate()", "reason"))
-            .then(() => promiseShouldReject("objectWithPcPrototype.getStats()", "reason"))
-
-            .then(() => {
-                testPassed("End of test promise chain");
-                finishJSTest();
-            })
-            .catch(error => {
-                testFailed("Error in promise chain: " + error);
-                finishJSTest();
-            });
-
-            window.jsTestIsAsync = true;
-            window.successfullyParsed = true;
-
-        </script>
-        <script src=""
-    </body>
-</html>

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


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-setLocalDescription-offer-expected.txt	2017-01-31 17:21:42 UTC (rev 211435)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-setLocalDescription-offer-expected.txt	2017-01-31 17:52:33 UTC (rev 211436)
@@ -31,8 +31,8 @@
 PASS pc.signalingState is 'have-local-offer'
 
 *** Try setting local descriptions with bad types for the current state
-PASS promise pc.setLocalDescription(new RTCSessionDescription({type:'answer', sdp:firstOffer.sdp})); rejected with InvalidStateError (DOM Exception 11): Description type incompatible with current signaling state
-PASS promise pc.setLocalDescription(new RTCSessionDescription({type:'pranswer', sdp:firstOffer.sdp})); rejected with InvalidStateError (DOM Exception 11): Description type incompatible with current signaling state
+PASS promise pc.setLocalDescription({type:'answer', sdp:firstOffer.sdp}); rejected with InvalidStateError (DOM Exception 11): Description type incompatible with current signaling state
+PASS promise pc.setLocalDescription({type:'pranswer', sdp:firstOffer.sdp}); rejected with InvalidStateError (DOM Exception 11): Description type incompatible with current signaling state
 
 *** Add videoTrack
 PASS pc.getTransceivers().length is 2

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-setLocalDescription-offer.html (211435 => 211436)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-setLocalDescription-offer.html	2017-01-31 17:21:42 UTC (rev 211435)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-setLocalDescription-offer.html	2017-01-31 17:52:33 UTC (rev 211436)
@@ -84,10 +84,10 @@
                 debug("");
 
                 debug("*** Try setting local descriptions with bad types for the current state");
-                return promiseShouldReject("pc.setLocalDescription(new RTCSessionDescription({type:'answer', sdp:firstOffer.sdp}));");
+                return promiseShouldReject("pc.setLocalDescription({type:'answer', sdp:firstOffer.sdp});");
             })
             .then(function () {
-                return promiseShouldReject("pc.setLocalDescription(new RTCSessionDescription({type:'pranswer', sdp:firstOffer.sdp}));");
+                return promiseShouldReject("pc.setLocalDescription({type:'pranswer', sdp:firstOffer.sdp});");
             })
             .then(function () {
                 debug("");

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


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-setRemoteDescription-offer-expected.txt	2017-01-31 17:21:42 UTC (rev 211435)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-setRemoteDescription-offer-expected.txt	2017-01-31 17:52:33 UTC (rev 211436)
@@ -33,8 +33,8 @@
 PASS pc.signalingState is 'have-remote-offer'
 
 *** Try setting local descriptions with bad types for the current state
-PASS promise pc.setRemoteDescription(new RTCSessionDescription({type:'answer', sdp:remoteOffer1.sdp})); rejected with InvalidStateError (DOM Exception 11): Description type incompatible with current signaling state
-PASS promise pc.setRemoteDescription(new RTCSessionDescription({type:'pranswer', sdp:remoteOffer1.sdp})); rejected with InvalidStateError (DOM Exception 11): Description type incompatible with current signaling state
+PASS promise pc.setRemoteDescription({type:'answer', sdp:remoteOffer1.sdp}); rejected with InvalidStateError (DOM Exception 11): Description type incompatible with current signaling state
+PASS promise pc.setRemoteDescription({type:'pranswer', sdp:remoteOffer1.sdp}); rejected with InvalidStateError (DOM Exception 11): Description type incompatible with current signaling state
 
 *** Create (remote) offer with video (remoteOffer2)
 *** Done, start testing with remoteOffer2

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-setRemoteDescription-offer.html (211435 => 211436)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-setRemoteDescription-offer.html	2017-01-31 17:21:42 UTC (rev 211435)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-setRemoteDescription-offer.html	2017-01-31 17:52:33 UTC (rev 211436)
@@ -106,10 +106,10 @@
                 debug("");
 
                 debug("*** Try setting local descriptions with bad types for the current state");
-                return promiseShouldReject("pc.setRemoteDescription(new RTCSessionDescription({type:'answer', sdp:remoteOffer1.sdp}));");
+                return promiseShouldReject("pc.setRemoteDescription({type:'answer', sdp:remoteOffer1.sdp});");
             })
             .then(function () {
-                return promiseShouldReject("pc.setRemoteDescription(new RTCSessionDescription({type:'pranswer', sdp:remoteOffer1.sdp}));");
+                return promiseShouldReject("pc.setRemoteDescription({type:'pranswer', sdp:remoteOffer1.sdp});");
             })
             .then(function () {
                 debug("");

Added: trunk/LayoutTests/webrtc/rtcpeerconnection-error-messages-expected.txt (0 => 211436)


--- trunk/LayoutTests/webrtc/rtcpeerconnection-error-messages-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webrtc/rtcpeerconnection-error-messages-expected.txt	2017-01-31 17:52:33 UTC (rev 211436)
@@ -0,0 +1,30 @@
+TypeError: The RTCPeerConnection.localDescription getter can only be used on instances of RTCPeerConnection
+TypeError: The RTCPeerConnection.currentLocalDescription getter can only be used on instances of RTCPeerConnection
+TypeError: The RTCPeerConnection.pendingLocalDescription getter can only be used on instances of RTCPeerConnection
+TypeError: The RTCPeerConnection.remoteDescription getter can only be used on instances of RTCPeerConnection
+TypeError: The RTCPeerConnection.currentRemoteDescription getter can only be used on instances of RTCPeerConnection
+TypeError: The RTCPeerConnection.pendingRemoteDescription getter can only be used on instances of RTCPeerConnection
+TypeError: The RTCPeerConnection.signalingState getter can only be used on instances of RTCPeerConnection
+TypeError: The RTCPeerConnection.iceGatheringState getter can only be used on instances of RTCPeerConnection
+TypeError: The RTCPeerConnection.iceConnectionState getter can only be used on instances of RTCPeerConnection
+[object RTCPeerConnection] has no property named connectionState
+[object RTCPeerConnection] has no property named canTrickleIceCandidates
+[object RTCPeerConnection] has no property named defaultIceServers
+TypeError: Can only call RTCPeerConnection.getConfiguration on instances of RTCPeerConnection
+TypeError: Can only call RTCPeerConnection.setConfiguration on instances of RTCPeerConnection
+TypeError: Can only call RTCPeerConnection.close on instances of RTCPeerConnection
+TypeError: The RTCPeerConnection.onnegotiationneeded getter can only be used on instances of RTCPeerConnection
+TypeError: The RTCPeerConnection.onicecandidate getter can only be used on instances of RTCPeerConnection
+[object RTCPeerConnection] has no property named onicecandidateerror
+TypeError: The RTCPeerConnection.onsignalingstatechange getter can only be used on instances of RTCPeerConnection
+TypeError: The RTCPeerConnection.oniceconnectionstatechange getter can only be used on instances of RTCPeerConnection
+TypeError: The RTCPeerConnection.onicegatheringstatechange getter can only be used on instances of RTCPeerConnection
+[object RTCPeerConnection] has no property named onconnectionstatechange
+Promise rejected with: TypeError: Can only call RTCPeerConnection.createOffer on instances of RTCPeerConnection
+Promise rejected with: TypeError: Can only call RTCPeerConnection.createAnswer on instances of RTCPeerConnection
+Promise rejected with: TypeError: Can only call RTCPeerConnection.setLocalDescription on instances of RTCPeerConnection
+Promise rejected with: TypeError: Can only call RTCPeerConnection.setRemoteDescription on instances of RTCPeerConnection
+Promise rejected with: TypeError: Can only call RTCPeerConnection.addIceCandidate on instances of RTCPeerConnection
+
+PASS Exercising TypeError messages in RTCPeerConnection 
+

Added: trunk/LayoutTests/webrtc/rtcpeerconnection-error-messages.html (0 => 211436)


--- trunk/LayoutTests/webrtc/rtcpeerconnection-error-messages.html	                        (rev 0)
+++ trunk/LayoutTests/webrtc/rtcpeerconnection-error-messages.html	2017-01-31 17:52:33 UTC (rev 211436)
@@ -0,0 +1,78 @@
+<!DOCTYPE html>
+<div id="log"></div>
+<script src=''></script>
+<script src=''></script>
+<script>
+function log(msg)
+{
+    document.getElementById("log").innerHTML += msg + "<br>";
+}
+
+function printMethodError(method, target)
+{
+    try {
+        method.call(target);
+        assert_unreached();
+    } catch(e) {
+         log(e);
+    }
+}
+
+function printPromiseMethodError(method, target)
+{
+    return method.call(target).then(assert_unreached, (e) => {
+         log("Promise rejected with: " + e);
+    });
+}
+
+function printGetterError(object, getterName, target)
+{
+    const property = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(object), getterName);
+    if (property  === undefined) {
+        log(object + " has no property named " + getterName);
+        return;
+    }
+    printMethodError(property.get, target);
+}
+
+promise_test(function(test) {
+    // This test prints exceptions to check the format of their messages.
+
+    var pc = new RTCPeerConnection();
+    var candidate = new RTCIceCandidate({ candidate: "foo", sdpMid: "bar" });
+
+    var results = [
+        printPromiseMethodError(pc.createOffer, candidate),
+        printPromiseMethodError(pc.createAnswer, candidate),
+        printPromiseMethodError(pc.setLocalDescription, candidate),
+        printPromiseMethodError(pc.setRemoteDescription, candidate),
+        printPromiseMethodError(pc.addIceCandidate, candidate),
+
+        printGetterError(pc, "localDescription", candidate),
+        printGetterError(pc, "currentLocalDescription", candidate),
+        printGetterError(pc, "pendingLocalDescription", candidate),
+        printGetterError(pc, "remoteDescription", candidate),
+        printGetterError(pc, "currentRemoteDescription", candidate),
+        printGetterError(pc, "pendingRemoteDescription", candidate),
+        printGetterError(pc, "signalingState", candidate),
+        printGetterError(pc, "iceGatheringState", candidate),
+        printGetterError(pc, "iceConnectionState", candidate),
+        printGetterError(pc, "connectionState", candidate),
+        printGetterError(pc, "canTrickleIceCandidates", candidate),
+        printGetterError(pc, "defaultIceServers", candidate),
+
+        printMethodError(pc.getConfiguration, candidate),
+        printMethodError(pc.setConfiguration, candidate),
+        printMethodError(pc.close, candidate),
+
+        printGetterError(pc, "onnegotiationneeded", candidate),
+        printGetterError(pc, "onicecandidate", candidate),
+        printGetterError(pc, "onicecandidateerror", candidate),
+        printGetterError(pc, "onsignalingstatechange", candidate),
+        printGetterError(pc, "oniceconnectionstatechange", candidate),
+        printGetterError(pc, "onicegatheringstatechange", candidate),
+        printGetterError(pc, "onconnectionstatechange", candidate),
+    ];
+    return Promise.all(results);
+}, "Exercising TypeError messages in RTCPeerConnection");
+</script>

Modified: trunk/Source/WebCore/ChangeLog (211435 => 211436)


--- trunk/Source/WebCore/ChangeLog	2017-01-31 17:21:42 UTC (rev 211435)
+++ trunk/Source/WebCore/ChangeLog	2017-01-31 17:52:33 UTC (rev 211436)
@@ -1,3 +1,29 @@
+2017-01-31  Youenn Fablet  <[email protected]>
+
+        RTCPeerConnection methods can take dictionaries as input
+        https://bugs.webkit.org/show_bug.cgi?id=167590
+
+        Reviewed by Alex Christensen.
+
+        Test: webrtc/rtcpeerconnection-error-messages.html
+
+        Made addIceCandidate/setRemoteDescription/setLocalDescription take either dictionaries or objects as parameter.
+        Spec only mandates this for addIceCandidate, but sites may be using the old version for setRemoteDescription and setLocalDescription.
+
+        Updated RTCPeerConnection methods error messages.
+
+        * Modules/mediastream/RTCPeerConnection.js:
+        (getLocalStreams):
+        (getStreamById):
+        (addStream):
+        (createOffer):
+        (createAnswer):
+        (setLocalDescription):
+        (setRemoteDescription):
+        (addIceCandidate):
+        (getStats):
+        * Modules/mediastream/RTCPeerConnectionInternals.js:
+
 2017-01-31  Simon Fraser  <[email protected]>
 
         REGRESSION (r209411): Scrolling to a fragment identifier in overflow:scroll inside position:fixed no longer works

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.js (211435 => 211436)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.js	2017-01-31 17:21:42 UTC (rev 211435)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.js	2017-01-31 17:52:33 UTC (rev 211436)
@@ -58,7 +58,7 @@
     "use strict";
 
     if (!@isRTCPeerConnection(this))
-        @throwTypeError("Function should be called on an RTCPeerConnection");
+        throw @makeThisTypeError("RTCPeerConnection", "getLocalStreams");
 
     return [email protected]();
 }
@@ -68,7 +68,7 @@
     "use strict";
 
     if (!@isRTCPeerConnection(this))
-        @throwTypeError("Function should be called on an RTCPeerConnection");
+        throw @makeThisTypeError("RTCPeerConnection", "getStreamById");
 
     if (arguments.length < 1)
         @throwTypeError("Not enough arguments");
@@ -85,7 +85,7 @@
     "use strict";
 
     if (!@isRTCPeerConnection(this))
-        @throwTypeError("Function should be called on an RTCPeerConnection");
+        throw @makeThisTypeError("RTCPeerConnection", "addStream");
 
     if (arguments.length < 1)
         @throwTypeError("Not enough arguments");
@@ -105,7 +105,7 @@
     "use strict";
 
     if (!@isRTCPeerConnection(this))
-        @throwTypeError("Function should be called on an RTCPeerConnection");
+        throw @makeThisTypeError("RTCPeerConnection", "removeStream");
 
     if (arguments.length < 1)
         @throwTypeError("Not enough arguments");
@@ -132,7 +132,7 @@
     "use strict";
 
     if (!@isRTCPeerConnection(this))
-        return @Promise.@reject(new @TypeError("Function should be called on an RTCPeerConnection"));
+        return @Promise.@reject(@makeThisTypeError("RTCPeerConnection", "createOffer"));
 
     const peerConnection = this;
 
@@ -156,7 +156,7 @@
     "use strict";
 
     if (!@isRTCPeerConnection(this))
-        return @Promise.@reject(new @TypeError("Function should be called on an RTCPeerConnection"));
+        return @Promise.@reject(@makeThisTypeError("RTCPeerConnection", "createAnswer"));
 
     const peerConnection = this;
 
@@ -180,14 +180,16 @@
     "use strict";
 
     if (!@isRTCPeerConnection(this))
-        return @Promise.@reject(new @TypeError("Function should be called on an RTCPeerConnection"));
+        return @Promise.@reject(@makeThisTypeError("RTCPeerConnection", "setLocalDescription"));
 
     const peerConnection = this;
 
+    // FIXME: According the spec, we should throw when receiving a RTCSessionDescription.
     const objectInfo = {
         "constructor": @RTCSessionDescription,
         "argName": "description",
-        "argType": "RTCSessionDescription"
+        "argType": "RTCSessionDescription",
+        "maybeDictionary": "true"
     };
     return @objectAndCallbacksOverload(arguments, "setLocalDescription", objectInfo, function (description) {
         // Promise mode
@@ -209,14 +211,16 @@
     "use strict";
 
     if (!@isRTCPeerConnection(this))
-        return @Promise.@reject(new @TypeError("Function should be called on an RTCPeerConnection"));
+        return @Promise.@reject(@makeThisTypeError("RTCPeerConnection", "setRemoteDescription"));
 
     const peerConnection = this;
 
+    // FIXME: According the spec, we should throw when receiving a RTCSessionDescription.
     const objectInfo = {
         "constructor": @RTCSessionDescription,
         "argName": "description",
-        "argType": "RTCSessionDescription"
+        "argType": "RTCSessionDescription",
+        "maybeDictionary": "true"
     };
     return @objectAndCallbacksOverload(arguments, "setRemoteDescription", objectInfo, function (description) {
         // Promise mode
@@ -238,7 +242,7 @@
     "use strict";
 
     if (!@isRTCPeerConnection(this))
-        return @Promise.@reject(new @TypeError("Function should be called on an RTCPeerConnection"));
+        return @Promise.@reject(@makeThisTypeError("RTCPeerConnection", "addIceCandidate"));
 
     const peerConnection = this;
 
@@ -245,7 +249,8 @@
     const objectInfo = {
         "constructor": @RTCIceCandidate,
         "argName": "candidate",
-        "argType": "RTCIceCandidate"
+        "argType": "RTCIceCandidate",
+        "maybeDictionary": "true"
     };
     return @objectAndCallbacksOverload(arguments, "addIceCandidate", objectInfo, function (candidate) {
         // Promise mode

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js (211435 => 211436)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js	2017-01-31 17:21:42 UTC (rev 211435)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js	2017-01-31 17:52:33 UTC (rev 211436)
@@ -71,7 +71,18 @@
         argsCount = 1;
     } else {
         const hasMatchingType = objectArg instanceof objectInfo.constructor;
-        objectArgOk = objectInfo.defaultsToNull ? (objectArg === null || typeof objectArg === "undefined" || hasMatchingType) : hasMatchingType;
+        if (hasMatchingType)
+            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;
+            }
+        }
     }
 
     if (!objectArgOk)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to