Title: [282778] trunk
Revision
282778
Author
you...@apple.com
Date
2021-09-20 13:56:19 -0700 (Mon, 20 Sep 2021)

Log Message

Make sure RTCRtpSender.setParameters returns an exception with a valid type
https://bugs.webkit.org/show_bug.cgi?id=230476

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/webrtc/RTCRtpParameters-encodings-expected.txt:
* web-platform-tests/webrtc/RTCRtpParameters-transactionId-expected.txt:

Source/WebCore:

Covered by rebased test.

* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
(WebCore::LibWebRTCRtpSenderBackend::setParameters):
Make sure to convert correctly the error.

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (282777 => 282778)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-09-20 20:44:29 UTC (rev 282777)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-09-20 20:56:19 UTC (rev 282778)
@@ -1,3 +1,13 @@
+2021-09-20  Youenn Fablet  <you...@apple.com>
+
+        Make sure RTCRtpSender.setParameters returns an exception with a valid type
+        https://bugs.webkit.org/show_bug.cgi?id=230476
+
+        Reviewed by Alex Christensen.
+
+        * web-platform-tests/webrtc/RTCRtpParameters-encodings-expected.txt:
+        * web-platform-tests/webrtc/RTCRtpParameters-transactionId-expected.txt:
+
 2021-09-20  Antoine Quint  <grao...@webkit.org>
 
         box-shadow and text-shadow do not yield float values while interpolating

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpParameters-encodings-expected.txt (282777 => 282778)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpParameters-encodings-expected.txt	2021-09-20 20:44:29 UTC (rev 282777)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpParameters-encodings-expected.txt	2021-09-20 20:56:19 UTC (rev 282778)
@@ -2,12 +2,10 @@
 PASS addTransceiver() with undefined sendEncodings should have default encoding parameter with active set to true
 PASS addTransceiver() with empty list sendEncodings should have default encoding parameter with active set to true
 FAIL sender.getParameters() should return sendEncodings set by addTransceiver() assert_not_own_property: rid should be removed with a single encoding unexpected property "rid" is found on object
-FAIL sender.setParameters() with mismatch number of encodings should reject with InvalidModificationError promise_rejects_dom: function "function () { throw e }" threw object "InvalidStateError: Attempted to set RtpParameters with different encoding count" that is not a DOMException InvalidModificationError: property "code" is equal to 11, expected 13
+PASS sender.setParameters() with mismatch number of encodings should reject with InvalidModificationError
 PASS sender.setParameters() with encodings unset should reject with TypeError
 FAIL setParameters() with modified encoding.rid field should reject with InvalidModificationError assert_not_equals: Expect sender param.rtcp.cname to be set got disallowed value undefined
-FAIL setParameters() with encoding.scaleResolutionDownBy field set to less than 1.0 should reject with RangeError promise_rejects_js: function "function () { throw e }" threw object "InvalidStateError: Attempted to set RtpParameters scale_resolution_down_by to an invalid value. scale_resolution_down_by must be >= 1.0" ("InvalidStateError") expected instance of function "function RangeError() {
-    [native code]
-}" ("RangeError")
+PASS setParameters() with encoding.scaleResolutionDownBy field set to less than 1.0 should reject with RangeError
 PASS setParameters() with encoding.scaleResolutionDownBy field set to greater than 1.0 should succeed
 PASS setParameters() with modified encoding.active should succeed with RTCRtpTransceiverInit
 PASS setParameters() with modified encoding.active should succeed without RTCRtpTransceiverInit

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpParameters-transactionId-expected.txt (282777 => 282778)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpParameters-transactionId-expected.txt	2021-09-20 20:44:29 UTC (rev 282777)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpParameters-transactionId-expected.txt	2021-09-20 20:56:19 UTC (rev 282778)
@@ -1,7 +1,7 @@
 
 PASS sender.getParameters() should return different transaction IDs for each call
-FAIL sender.setParameters() with transaction ID different from last getParameters() should reject with InvalidModificationError promise_rejects_dom: function "function () { throw e }" threw object "InvalidStateError: Failed to set parameters since the transaction_id doesn't match the last value returned from getParameters()" that is not a DOMException InvalidModificationError: property "code" is equal to 11, expected 13
+PASS sender.setParameters() with transaction ID different from last getParameters() should reject with InvalidModificationError
 PASS sender.setParameters() with transaction ID unset should reject with TypeError
 PASS setParameters() twice with the same parameters should reject with InvalidStateError
-FAIL setParameters() with parameters older than last getParameters() should reject with InvalidModificationError promise_rejects_dom: function "function () { throw e }" threw object "InvalidStateError: Failed to set parameters since the transaction_id doesn't match the last value returned from getParameters()" that is not a DOMException InvalidModificationError: property "code" is equal to 11, expected 13
+PASS setParameters() with parameters older than last getParameters() should reject with InvalidModificationError
 

Modified: trunk/Source/WebCore/ChangeLog (282777 => 282778)


--- trunk/Source/WebCore/ChangeLog	2021-09-20 20:44:29 UTC (rev 282777)
+++ trunk/Source/WebCore/ChangeLog	2021-09-20 20:56:19 UTC (rev 282778)
@@ -1,3 +1,16 @@
+2021-09-20  Youenn Fablet  <you...@apple.com>
+
+        Make sure RTCRtpSender.setParameters returns an exception with a valid type
+        https://bugs.webkit.org/show_bug.cgi?id=230476
+
+        Reviewed by Alex Christensen.
+
+        Covered by rebased test.
+
+        * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
+        (WebCore::LibWebRTCRtpSenderBackend::setParameters):
+        Make sure to convert correctly the error.
+
 2021-09-20  Simon Fraser  <simon.fra...@apple.com>
 
         ScrollSnapAnimatorState should be explicit about when it starts animations

Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp (282777 => 282778)


--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp	2021-09-20 20:44:29 UTC (rev 282777)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp	2021-09-20 20:56:19 UTC (rev 282778)
@@ -150,7 +150,7 @@
 
     auto error = m_rtcSender->SetParameters(rtcParameters);
     if (!error.ok()) {
-        promise.reject(Exception { InvalidStateError, error.message() });
+        promise.reject(toException(error));
         return;
     }
     promise.resolve();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to