Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Restrict floats over setCurrentTime & setCurrentScale to finite values
Restrict floats over setCurrentTime & setCurrentScale to finite values https://bugs.webkit.org/show_bug.cgi?id=249741 Reviewed by Simon Fraser. This patch is to align WebKit with Blink / Chromium, Gecko / Firefox and Web-Specification. Merge - https://chromium.googlesource.com/chromium/blink/+/b4e294d0dec2aeffa4d401e19916e753a7d74a75 This patch modifies "setCurrentTime" and "setCurrentScale" to work with finite floats and also update IDL definition aligned with current web-standard and also aligned with other browsers. * Source/WebCore/svg/SVGSVGElement.cpp: (SVGSVGElement::currentScale): Add ASSERT for finite 'scale' (SVGSVGElement::getCurrentTime): Change "if" to ASSERT for finite seconds * Source/WebCore/svg/SVGSVGElement.idl: Aligned with Web-Spec * LayoutTests/svg/dom/SVGSVGElement-currentTime.html: Add Test Case * LayoutTests/svg/dom/SVGSVGElement-currentTime-expected.txt: Add Test Case Expectation * LayoutTests/svg/dom/SVGSVGElement-currentScale-NaN-no-crash.html: Add Test Case * LayoutTests/svg/dom/SSVGSVGElement-currentScale-NaN-no-crash-expected.txt: Add Test Case Expectation * LayoutTests/svg/animations/animate-setcurrentime.html: Rebaselined * LayoutTests/svg/animations/animate-setcurrentime-expected.txt: Ditto Canonical link: https://commits.webkit.org/258322@main
- Loading branch information
1 parent
ffe153e
commit e938348a700cfd5e7db4d10a905e8af922328996
Showing
8 changed files
with
114 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Setting .currentScale to a non-finite should throw. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS svgElement.currentScale = NaN threw exception TypeError: The provided value is non-finite. | ||
PASS svgElement.currentScale = Infinity threw exception TypeError: The provided value is non-finite. | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../../resources/js-test.js"></script> | ||
</head> | ||
<body> | ||
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200"></svg> | ||
<script> | ||
description("Setting .currentScale to a non-finite should throw."); | ||
|
||
self.jsTestIsAsync = true; | ||
|
||
if (window.testRunner) { | ||
testRunner.dumpAsText(); | ||
testRunner.waitUntilDone(); | ||
} | ||
|
||
function runTest() | ||
{ | ||
svgElement = document.getElementById("svg"); | ||
shouldThrow("svgElement.currentScale = NaN"); | ||
shouldThrow("svgElement.currentScale = Infinity"); | ||
finishJSTest(); | ||
} | ||
window.onload = runTest; | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Calling svgElement.setCurrentTime() with a non-finite value should throw. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS svgElement.setCurrentTime(NaN) threw exception TypeError: The provided value is non-finite. | ||
PASS svgElement.setCurrentTime(Infinity) threw exception TypeError: The provided value is non-finite. | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../../resources/js-test.js"></script> | ||
</head> | ||
<body> | ||
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200"></svg> | ||
<script> | ||
description("Calling svgElement.setCurrentTime() with a non-finite value should throw."); | ||
|
||
self.jsTestIsAsync = true; | ||
|
||
if (window.testRunner) { | ||
testRunner.dumpAsText(); | ||
testRunner.waitUntilDone(); | ||
} | ||
|
||
function runTest() | ||
{ | ||
svgElement = document.getElementById("svg"); | ||
shouldThrow("svgElement.setCurrentTime(NaN)"); | ||
shouldThrow("svgElement.setCurrentTime(Infinity)"); | ||
finishJSTest(); | ||
} | ||
window.onload = runTest; | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters