Title: [267071] trunk
Revision
267071
Author
[email protected]
Date
2020-09-14 20:31:34 -0700 (Mon, 14 Sep 2020)

Log Message

Types of Panner.setPosition() / setOrientation() parameters should not be unrestricted float
https://bugs.webkit.org/show_bug.cgi?id=216508

Reviewed by Darin Adler.

Source/WebCore:

Types of Panner.setPosition() / setOrientation() parameters should not be unrestricted float:
- https://www.w3.org/TR/webaudio/#pannernode

They should use float type so that we throw when passing values that are non-finite or not a number.

Test: webaudio/panner-node-exceptions.html

* Modules/webaudio/PannerNode.idl:

LayoutTests:

Add layout test coverage.

* webaudio/panner-node-exceptions-expected.txt: Added.
* webaudio/panner-node-exceptions.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (267070 => 267071)


--- trunk/LayoutTests/ChangeLog	2020-09-15 03:27:54 UTC (rev 267070)
+++ trunk/LayoutTests/ChangeLog	2020-09-15 03:31:34 UTC (rev 267071)
@@ -1,3 +1,15 @@
+2020-09-14  Chris Dumez  <[email protected]>
+
+        Types of Panner.setPosition() / setOrientation() parameters should not be unrestricted float
+        https://bugs.webkit.org/show_bug.cgi?id=216508
+
+        Reviewed by Darin Adler.
+
+        Add layout test coverage.
+
+        * webaudio/panner-node-exceptions-expected.txt: Added.
+        * webaudio/panner-node-exceptions.html: Added.
+
 2020-09-14  Hector Lopez  <[email protected]>
 
         REGRESSION (r267002): ASSERTION FAILED:[ iOS wk2 Debug ] !HashTranslator::equal(KeyTraits::emptyValue(), key) on fast/scrolling/ios/click-events-during-momentum-scroll-in-overflow.html

Added: trunk/LayoutTests/webaudio/panner-node-exceptions-expected.txt (0 => 267071)


--- trunk/LayoutTests/webaudio/panner-node-exceptions-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webaudio/panner-node-exceptions-expected.txt	2020-09-15 03:31:34 UTC (rev 267071)
@@ -0,0 +1,27 @@
+Tests exception cases for PannerNode API.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS panner.setPosition(NaN, 1, 1) threw exception TypeError: The provided value is non-finite.
+PASS panner.setOrientation(NaN, 1, 1) threw exception TypeError: The provided value is non-finite.
+PASS panner.setPosition(1, NaN, 1) threw exception TypeError: The provided value is non-finite.
+PASS panner.setOrientation(1, NaN, 1) threw exception TypeError: The provided value is non-finite.
+PASS panner.setPosition(1, 1, NaN) threw exception TypeError: The provided value is non-finite.
+PASS panner.setOrientation(1, 1, NaN) threw exception TypeError: The provided value is non-finite.
+PASS panner.setPosition(Infinity, 1, 1) threw exception TypeError: The provided value is non-finite.
+PASS panner.setOrientation(Infinity, 1, 1) threw exception TypeError: The provided value is non-finite.
+PASS panner.setPosition(1, Infinity, 1) threw exception TypeError: The provided value is non-finite.
+PASS panner.setOrientation(1, Infinity, 1) threw exception TypeError: The provided value is non-finite.
+PASS panner.setPosition(1, 1, Infinity) threw exception TypeError: The provided value is non-finite.
+PASS panner.setOrientation(1, 1, Infinity) threw exception TypeError: The provided value is non-finite.
+PASS panner.setPosition(-Infinity, 1, 1) threw exception TypeError: The provided value is non-finite.
+PASS panner.setOrientation(-Infinity, 1, 1) threw exception TypeError: The provided value is non-finite.
+PASS panner.setPosition(1, -Infinity, 1) threw exception TypeError: The provided value is non-finite.
+PASS panner.setOrientation(1, -Infinity, 1) threw exception TypeError: The provided value is non-finite.
+PASS panner.setPosition(1, 1, -Infinity) threw exception TypeError: The provided value is non-finite.
+PASS panner.setOrientation(1, 1, -Infinity) threw exception TypeError: The provided value is non-finite.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/webaudio/panner-node-exceptions.html (0 => 267071)


--- trunk/LayoutTests/webaudio/panner-node-exceptions.html	                        (rev 0)
+++ trunk/LayoutTests/webaudio/panner-node-exceptions.html	2020-09-15 03:31:34 UTC (rev 267071)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Tests exception cases for PannerNode API.");
+
+let context = new OfflineAudioContext(2, 10, 44100);
+let panner = new PannerNode(context);
+
+const forbiddenValues = ["NaN", "Infinity", "-Infinity"];
+
+for (let forbiddenValue of forbiddenValues) {
+    shouldThrowErrorName("panner.setPosition(" + forbiddenValue + ", 1, 1)", "TypeError");
+    shouldThrowErrorName("panner.setOrientation(" + forbiddenValue + ", 1, 1)", "TypeError");
+    shouldThrowErrorName("panner.setPosition(1, " + forbiddenValue + ", 1)", "TypeError");
+    shouldThrowErrorName("panner.setOrientation(1, " + forbiddenValue + ", 1)", "TypeError");
+    shouldThrowErrorName("panner.setPosition(1, 1, " + forbiddenValue + ")", "TypeError");
+    shouldThrowErrorName("panner.setOrientation(1, 1, " + forbiddenValue + ")", "TypeError");
+}
+
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (267070 => 267071)


--- trunk/Source/WebCore/ChangeLog	2020-09-15 03:27:54 UTC (rev 267070)
+++ trunk/Source/WebCore/ChangeLog	2020-09-15 03:31:34 UTC (rev 267071)
@@ -1,3 +1,19 @@
+2020-09-14  Chris Dumez  <[email protected]>
+
+        Types of Panner.setPosition() / setOrientation() parameters should not be unrestricted float
+        https://bugs.webkit.org/show_bug.cgi?id=216508
+
+        Reviewed by Darin Adler.
+
+        Types of Panner.setPosition() / setOrientation() parameters should not be unrestricted float:
+        - https://www.w3.org/TR/webaudio/#pannernode
+
+        They should use float type so that we throw when passing values that are non-finite or not a number.
+
+        Test: webaudio/panner-node-exceptions.html
+
+        * Modules/webaudio/PannerNode.idl:
+
 2020-09-14  Sam Weinig  <[email protected]>
 
         Remove runtime setting for enabling/disabling ShadowDOM

Modified: trunk/Source/WebCore/Modules/webaudio/PannerNode.idl (267070 => 267071)


--- trunk/Source/WebCore/Modules/webaudio/PannerNode.idl	2020-09-15 03:27:54 UTC (rev 267070)
+++ trunk/Source/WebCore/Modules/webaudio/PannerNode.idl	2020-09-15 03:31:34 UTC (rev 267071)
@@ -33,8 +33,8 @@
     attribute PanningModelType panningModel;
 
     // Uses a 3D cartesian coordinate system 
-    [MayThrowException] undefined setPosition(unrestricted float x, unrestricted float y, unrestricted float z);
-    [MayThrowException] undefined setOrientation(unrestricted float x, unrestricted float y, unrestricted float z);
+    [MayThrowException] undefined setPosition(float x, float y, float z);
+    [MayThrowException] undefined setOrientation(float x, float y, float z);
     
     // Default distance model is inverse
     attribute DistanceModelType distanceModel;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to