Title: [254863] trunk
Revision
254863
Author
[email protected]
Date
2020-01-21 10:58:36 -0800 (Tue, 21 Jan 2020)

Log Message

Disallow setting SVGElement currentScale to non-finite values
https://bugs.webkit.org/show_bug.cgi?id=206019

Align SVGElement currentScale definition to SVG2 section 5.14.2
(https://www.w3.org/TR/SVG2/struct.html#InterfaceSVGSVGElement)

Patch by Sunny He <[email protected]> on 2020-01-21
Reviewed by Darin Adler.

Source/WebCore:

Test: svg/dom/set-currentScale-nonfinite.html

* svg/SVGSVGElement.idl:

LayoutTests:

* svg/dom/set-currentScale-nonfinite-expected.txt: Added.
* svg/dom/set-currentScale-nonfinite.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (254862 => 254863)


--- trunk/LayoutTests/ChangeLog	2020-01-21 18:42:40 UTC (rev 254862)
+++ trunk/LayoutTests/ChangeLog	2020-01-21 18:58:36 UTC (rev 254863)
@@ -1,3 +1,16 @@
+2020-01-21  Sunny He  <[email protected]>
+
+        Disallow setting SVGElement currentScale to non-finite values
+        https://bugs.webkit.org/show_bug.cgi?id=206019
+
+        Align SVGElement currentScale definition to SVG2 section 5.14.2
+        (https://www.w3.org/TR/SVG2/struct.html#InterfaceSVGSVGElement)
+
+        Reviewed by Darin Adler.
+
+        * svg/dom/set-currentScale-nonfinite-expected.txt: Added.
+        * svg/dom/set-currentScale-nonfinite.html: Added.
+
 2020-01-21  Noam Rosenthal  <[email protected]>
 
         -webkit-image-set should support all the image functions WebKit supports, not just url()

Added: trunk/LayoutTests/svg/dom/set-currentScale-nonfinite-expected.txt (0 => 254863)


--- trunk/LayoutTests/svg/dom/set-currentScale-nonfinite-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/dom/set-currentScale-nonfinite-expected.txt	2020-01-21 18:58:36 UTC (rev 254863)
@@ -0,0 +1,18 @@
+This test checks that setting currentScale fails for non-finite values
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS svgvar.currentScale is 1.0
+PASS Setting currentScale to undefined threw an exception.
+PASS svgvar.currentScale is 1.0
+PASS Setting currentScale to NaN threw an exception.
+PASS svgvar.currentScale is 1.0
+PASS Setting currentScale to Infinity threw an exception.
+PASS svgvar.currentScale is 1.0
+PASS Setting currentScale to a string threw an exception.
+PASS svgvar.currentScale is 1.0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/svg/dom/set-currentScale-nonfinite.html (0 => 254863)


--- trunk/LayoutTests/svg/dom/set-currentScale-nonfinite.html	                        (rev 0)
+++ trunk/LayoutTests/svg/dom/set-currentScale-nonfinite.html	2020-01-21 18:58:36 UTC (rev 254863)
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+    <svg id="svgvar"></svg>
+</body>
+<script>
+    description("This test checks that setting currentScale fails for non-finite values");
+
+    var svgvar = document.getElementById('svgvar');
+
+    svgvar.currentScale = 1.0;
+    shouldBe('svgvar.currentScale', '1.0');
+
+    const testIncorrectScaleValue = (value, description) => {
+        try {
+            svgvar.currentScale = value;
+            testFailed(`Setting currentScale to ${description} should have thrown an exception.`);
+        } catch (e) {
+            if (e instanceof TypeError)
+                testPassed(`Setting currentScale to ${description} threw an exception.`);
+        }
+        shouldBe('svgvar.currentScale', '1.0');
+    };
+
+    testIncorrectScaleValue(undefined, "undefined");
+    testIncorrectScaleValue(NaN, "NaN");
+    testIncorrectScaleValue(Infinity, "Infinity");
+    testIncorrectScaleValue("a", "a string");
+
+    var successfullyParsed = true;
+</script>
+
+<script src=""
+</html>

Modified: trunk/Source/WebCore/ChangeLog (254862 => 254863)


--- trunk/Source/WebCore/ChangeLog	2020-01-21 18:42:40 UTC (rev 254862)
+++ trunk/Source/WebCore/ChangeLog	2020-01-21 18:58:36 UTC (rev 254863)
@@ -1,3 +1,17 @@
+2020-01-21  Sunny He  <[email protected]>
+
+        Disallow setting SVGElement currentScale to non-finite values
+        https://bugs.webkit.org/show_bug.cgi?id=206019
+
+        Align SVGElement currentScale definition to SVG2 section 5.14.2
+        (https://www.w3.org/TR/SVG2/struct.html#InterfaceSVGSVGElement)
+
+        Reviewed by Darin Adler.
+
+        Test: svg/dom/set-currentScale-nonfinite.html
+
+        * svg/SVGSVGElement.idl:
+
 2020-01-21  Noam Rosenthal  <[email protected]>
 
         -webkit-image-set should support all the image functions WebKit supports, not just url()

Modified: trunk/Source/WebCore/svg/SVGSVGElement.idl (254862 => 254863)


--- trunk/Source/WebCore/svg/SVGSVGElement.idl	2020-01-21 18:42:40 UTC (rev 254862)
+++ trunk/Source/WebCore/svg/SVGSVGElement.idl	2020-01-21 18:58:36 UTC (rev 254863)
@@ -33,7 +33,7 @@
     [SameObject] readonly attribute SVGAnimatedLength width;
     [SameObject] readonly attribute SVGAnimatedLength height;
 
-    attribute unrestricted float currentScale;
+    attribute float currentScale;
     [SameObject] readonly attribute SVGPoint currentTranslate;
     
     readonly attribute boolean useCurrentView;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to