Diff
Modified: trunk/LayoutTests/ChangeLog (200527 => 200528)
--- trunk/LayoutTests/ChangeLog 2016-05-06 22:06:29 UTC (rev 200527)
+++ trunk/LayoutTests/ChangeLog 2016-05-06 22:23:29 UTC (rev 200528)
@@ -1,3 +1,23 @@
+2016-05-06 Chris Dumez <cdu...@apple.com>
+
+ Clean up converting from JSValue to float / double in the bindings generator
+ https://bugs.webkit.org/show_bug.cgi?id=157407
+
+ Reviewed by Darin Adler.
+
+ Rebaseline the tests now that we provide a more useful exception message.
+
+ * fast/canvas/canvas-2d-imageData-create-nonfinite-expected.txt:
+ * fast/canvas/canvas-getImageData-invalid-expected.txt:
+ * fast/canvas/canvas-putImageData-expected.txt:
+ * fast/canvas/canvas-putImageData.js:
+ * fast/canvas/linearGradient-infinite-values-expected.txt:
+ * fast/canvas/radialGradient-infinite-values-expected.txt:
+ * fast/canvas/resources/canvas-2d-imageData-create-nonfinite.js:
+ * fast/canvas/script-tests/canvas-getImageData-invalid.js:
+ * fast/canvas/script-tests/linearGradient-infinite-values.js:
+ * fast/canvas/script-tests/radialGradient-infinite-values.js:
+
2016-05-06 Brady Eidson <beid...@apple.com>
Unreviewed IDB test gardening.
Modified: trunk/LayoutTests/fast/canvas/canvas-2d-imageData-create-nonfinite-expected.txt (200527 => 200528)
--- trunk/LayoutTests/fast/canvas/canvas-2d-imageData-create-nonfinite-expected.txt 2016-05-06 22:06:29 UTC (rev 200527)
+++ trunk/LayoutTests/fast/canvas/canvas-2d-imageData-create-nonfinite-expected.txt 2016-05-06 22:23:29 UTC (rev 200528)
@@ -3,13 +3,13 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS ctx.createImageData(Infinity, Infinity) threw exception TypeError: Type error.
-PASS ctx.createImageData(Infinity, 10) threw exception TypeError: Type error.
-PASS ctx.createImageData(-Infinity, 10) threw exception TypeError: Type error.
-PASS ctx.createImageData(10, Infinity) threw exception TypeError: Type error.
-PASS ctx.createImageData(10, -Infinity) threw exception TypeError: Type error.
-PASS ctx.createImageData(NaN, 10) threw exception TypeError: Type error.
-PASS ctx.createImageData(10, NaN) threw exception TypeError: Type error.
+PASS ctx.createImageData(Infinity, Infinity) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createImageData(Infinity, 10) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createImageData(-Infinity, 10) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createImageData(10, Infinity) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createImageData(10, -Infinity) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createImageData(NaN, 10) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createImageData(10, NaN) threw exception TypeError: The provided value is non-finite.
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/canvas/canvas-getImageData-invalid-expected.txt (200527 => 200528)
--- trunk/LayoutTests/fast/canvas/canvas-getImageData-invalid-expected.txt 2016-05-06 22:06:29 UTC (rev 200527)
+++ trunk/LayoutTests/fast/canvas/canvas-getImageData-invalid-expected.txt 2016-05-06 22:23:29 UTC (rev 200528)
@@ -3,18 +3,18 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS ctx.getImageData(NaN, 10, 10, 10) threw exception TypeError: Type error.
-PASS ctx.getImageData(10, NaN, 10, 10) threw exception TypeError: Type error.
-PASS ctx.getImageData(10, 10, NaN, 10) threw exception TypeError: Type error.
-PASS ctx.getImageData(10, 10, 10, NaN) threw exception TypeError: Type error.
-PASS ctx.getImageData(Infinity, 10, 10, 10) threw exception TypeError: Type error.
-PASS ctx.getImageData(10, Infinity, 10, 10) threw exception TypeError: Type error.
-PASS ctx.getImageData(10, 10, Infinity, 10) threw exception TypeError: Type error.
-PASS ctx.getImageData(10, 10, 10, Infinity) threw exception TypeError: Type error.
-PASS ctx.getImageData(undefined, 10, 10, 10) threw exception TypeError: Type error.
-PASS ctx.getImageData(10, undefined, 10, 10) threw exception TypeError: Type error.
-PASS ctx.getImageData(10, 10, undefined, 10) threw exception TypeError: Type error.
-PASS ctx.getImageData(10, 10, 10, undefined) threw exception TypeError: Type error.
+PASS ctx.getImageData(NaN, 10, 10, 10) threw exception TypeError: The provided value is non-finite.
+PASS ctx.getImageData(10, NaN, 10, 10) threw exception TypeError: The provided value is non-finite.
+PASS ctx.getImageData(10, 10, NaN, 10) threw exception TypeError: The provided value is non-finite.
+PASS ctx.getImageData(10, 10, 10, NaN) threw exception TypeError: The provided value is non-finite.
+PASS ctx.getImageData(Infinity, 10, 10, 10) threw exception TypeError: The provided value is non-finite.
+PASS ctx.getImageData(10, Infinity, 10, 10) threw exception TypeError: The provided value is non-finite.
+PASS ctx.getImageData(10, 10, Infinity, 10) threw exception TypeError: The provided value is non-finite.
+PASS ctx.getImageData(10, 10, 10, Infinity) threw exception TypeError: The provided value is non-finite.
+PASS ctx.getImageData(undefined, 10, 10, 10) threw exception TypeError: The provided value is non-finite.
+PASS ctx.getImageData(10, undefined, 10, 10) threw exception TypeError: The provided value is non-finite.
+PASS ctx.getImageData(10, 10, undefined, 10) threw exception TypeError: The provided value is non-finite.
+PASS ctx.getImageData(10, 10, 10, undefined) threw exception TypeError: The provided value is non-finite.
PASS ctx.getImageData(10, 10, 0, 10) threw exception Error: IndexSizeError: DOM Exception 1.
PASS ctx.getImageData(10, 10, 10, 0) threw exception Error: IndexSizeError: DOM Exception 1.
PASS successfullyParsed is true
Modified: trunk/LayoutTests/fast/canvas/canvas-putImageData-expected.txt (200527 => 200528)
--- trunk/LayoutTests/fast/canvas/canvas-putImageData-expected.txt 2016-05-06 22:06:29 UTC (rev 200527)
+++ trunk/LayoutTests/fast/canvas/canvas-putImageData-expected.txt 2016-05-06 22:23:29 UTC (rev 200528)
@@ -145,24 +145,24 @@
PASS getPixel(1,1) is [0,128,0,255]
PASS getPixel(9,9) is [0,128,0,255]
PASS context.putImageData({}, 0, 0) threw exception TypeError: Type error.
-PASS context.putImageData(buffer, NaN, 0, 0, 0, 0, 0) threw exception TypeError: Type error.
-PASS context.putImageData(buffer, 0, NaN, 0, 0, 0, 0) threw exception TypeError: Type error.
-PASS context.putImageData(buffer, 0, 0, NaN, 0, 0, 0) threw exception TypeError: Type error.
-PASS context.putImageData(buffer, 0, 0, 0, NaN, 0, 0) threw exception TypeError: Type error.
-PASS context.putImageData(buffer, 0, 0, 0, 0, NaN, 0) threw exception TypeError: Type error.
-PASS context.putImageData(buffer, 0, 0, 0, 0, 0, NaN) threw exception TypeError: Type error.
-PASS context.putImageData(buffer, Infinity, 0, 0, 0, 0, 0) threw exception TypeError: Type error.
-PASS context.putImageData(buffer, 0, Infinity, 0, 0, 0, 0) threw exception TypeError: Type error.
-PASS context.putImageData(buffer, 0, 0, Infinity, 0, 0, 0) threw exception TypeError: Type error.
-PASS context.putImageData(buffer, 0, 0, 0, Infinity, 0, 0) threw exception TypeError: Type error.
-PASS context.putImageData(buffer, 0, 0, 0, 0, Infinity, 0) threw exception TypeError: Type error.
-PASS context.putImageData(buffer, 0, 0, 0, 0, 0, Infinity) threw exception TypeError: Type error.
-PASS context.putImageData(buffer, undefined, 0, 0, 0, 0, 0) threw exception TypeError: Type error.
-PASS context.putImageData(buffer, 0, undefined, 0, 0, 0, 0) threw exception TypeError: Type error.
-PASS context.putImageData(buffer, 0, 0, undefined, 0, 0, 0) threw exception TypeError: Type error.
-PASS context.putImageData(buffer, 0, 0, 0, undefined, 0, 0) threw exception TypeError: Type error.
-PASS context.putImageData(buffer, 0, 0, 0, 0, undefined, 0) threw exception TypeError: Type error.
-PASS context.putImageData(buffer, 0, 0, 0, 0, 0, undefined) threw exception TypeError: Type error.
+PASS context.putImageData(buffer, NaN, 0, 0, 0, 0, 0) threw exception TypeError: The provided value is non-finite.
+PASS context.putImageData(buffer, 0, NaN, 0, 0, 0, 0) threw exception TypeError: The provided value is non-finite.
+PASS context.putImageData(buffer, 0, 0, NaN, 0, 0, 0) threw exception TypeError: The provided value is non-finite.
+PASS context.putImageData(buffer, 0, 0, 0, NaN, 0, 0) threw exception TypeError: The provided value is non-finite.
+PASS context.putImageData(buffer, 0, 0, 0, 0, NaN, 0) threw exception TypeError: The provided value is non-finite.
+PASS context.putImageData(buffer, 0, 0, 0, 0, 0, NaN) threw exception TypeError: The provided value is non-finite.
+PASS context.putImageData(buffer, Infinity, 0, 0, 0, 0, 0) threw exception TypeError: The provided value is non-finite.
+PASS context.putImageData(buffer, 0, Infinity, 0, 0, 0, 0) threw exception TypeError: The provided value is non-finite.
+PASS context.putImageData(buffer, 0, 0, Infinity, 0, 0, 0) threw exception TypeError: The provided value is non-finite.
+PASS context.putImageData(buffer, 0, 0, 0, Infinity, 0, 0) threw exception TypeError: The provided value is non-finite.
+PASS context.putImageData(buffer, 0, 0, 0, 0, Infinity, 0) threw exception TypeError: The provided value is non-finite.
+PASS context.putImageData(buffer, 0, 0, 0, 0, 0, Infinity) threw exception TypeError: The provided value is non-finite.
+PASS context.putImageData(buffer, undefined, 0, 0, 0, 0, 0) threw exception TypeError: The provided value is non-finite.
+PASS context.putImageData(buffer, 0, undefined, 0, 0, 0, 0) threw exception TypeError: The provided value is non-finite.
+PASS context.putImageData(buffer, 0, 0, undefined, 0, 0, 0) threw exception TypeError: The provided value is non-finite.
+PASS context.putImageData(buffer, 0, 0, 0, undefined, 0, 0) threw exception TypeError: The provided value is non-finite.
+PASS context.putImageData(buffer, 0, 0, 0, 0, undefined, 0) threw exception TypeError: The provided value is non-finite.
+PASS context.putImageData(buffer, 0, 0, 0, 0, 0, undefined) threw exception TypeError: The provided value is non-finite.
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/canvas/canvas-putImageData.js (200527 => 200528)
--- trunk/LayoutTests/fast/canvas/canvas-putImageData.js 2016-05-06 22:06:29 UTC (rev 200527)
+++ trunk/LayoutTests/fast/canvas/canvas-putImageData.js 2016-05-06 22:23:29 UTC (rev 200528)
@@ -202,24 +202,24 @@
shouldThrow("context.putImageData({}, 0, 0)", "'TypeError: Type error'");
-shouldThrow("context.putImageData(buffer, NaN, 0, 0, 0, 0, 0)", "'TypeError: Type error'");
-shouldThrow("context.putImageData(buffer, 0, NaN, 0, 0, 0, 0)", "'TypeError: Type error'");
-shouldThrow("context.putImageData(buffer, 0, 0, NaN, 0, 0, 0)", "'TypeError: Type error'");
-shouldThrow("context.putImageData(buffer, 0, 0, 0, NaN, 0, 0)", "'TypeError: Type error'");
-shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, NaN, 0)", "'TypeError: Type error'");
-shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, 0, NaN)", "'TypeError: Type error'");
-shouldThrow("context.putImageData(buffer, Infinity, 0, 0, 0, 0, 0)", "'TypeError: Type error'");
-shouldThrow("context.putImageData(buffer, 0, Infinity, 0, 0, 0, 0)", "'TypeError: Type error'");
-shouldThrow("context.putImageData(buffer, 0, 0, Infinity, 0, 0, 0)", "'TypeError: Type error'");
-shouldThrow("context.putImageData(buffer, 0, 0, 0, Infinity, 0, 0)", "'TypeError: Type error'");
-shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, Infinity, 0)", "'TypeError: Type error'");
-shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, 0, Infinity)", "'TypeError: Type error'");
-shouldThrow("context.putImageData(buffer, undefined, 0, 0, 0, 0, 0)", "'TypeError: Type error'");
-shouldThrow("context.putImageData(buffer, 0, undefined, 0, 0, 0, 0)", "'TypeError: Type error'");
-shouldThrow("context.putImageData(buffer, 0, 0, undefined, 0, 0, 0)", "'TypeError: Type error'");
-shouldThrow("context.putImageData(buffer, 0, 0, 0, undefined, 0, 0)", "'TypeError: Type error'");
-shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, undefined, 0)", "'TypeError: Type error'");
-shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, 0, undefined)", "'TypeError: Type error'");
+shouldThrow("context.putImageData(buffer, NaN, 0, 0, 0, 0, 0)", "'TypeError: The provided value is non-finite'");
+shouldThrow("context.putImageData(buffer, 0, NaN, 0, 0, 0, 0)", "'TypeError: The provided value is non-finite'");
+shouldThrow("context.putImageData(buffer, 0, 0, NaN, 0, 0, 0)", "'TypeError: The provided value is non-finite'");
+shouldThrow("context.putImageData(buffer, 0, 0, 0, NaN, 0, 0)", "'TypeError: The provided value is non-finite'");
+shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, NaN, 0)", "'TypeError: The provided value is non-finite'");
+shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, 0, NaN)", "'TypeError: The provided value is non-finite'");
+shouldThrow("context.putImageData(buffer, Infinity, 0, 0, 0, 0, 0)", "'TypeError: The provided value is non-finite'");
+shouldThrow("context.putImageData(buffer, 0, Infinity, 0, 0, 0, 0)", "'TypeError: The provided value is non-finite'");
+shouldThrow("context.putImageData(buffer, 0, 0, Infinity, 0, 0, 0)", "'TypeError: The provided value is non-finite'");
+shouldThrow("context.putImageData(buffer, 0, 0, 0, Infinity, 0, 0)", "'TypeError: The provided value is non-finite'");
+shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, Infinity, 0)", "'TypeError: The provided value is non-finite'");
+shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, 0, Infinity)", "'TypeError: The provided value is non-finite'");
+shouldThrow("context.putImageData(buffer, undefined, 0, 0, 0, 0, 0)", "'TypeError: The provided value is non-finite'");
+shouldThrow("context.putImageData(buffer, 0, undefined, 0, 0, 0, 0)", "'TypeError: The provided value is non-finite'");
+shouldThrow("context.putImageData(buffer, 0, 0, undefined, 0, 0, 0)", "'TypeError: The provided value is non-finite'");
+shouldThrow("context.putImageData(buffer, 0, 0, 0, undefined, 0, 0)", "'TypeError: The provided value is non-finite'");
+shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, undefined, 0)", "'TypeError: The provided value is non-finite'");
+shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, 0, undefined)", "'TypeError: The provided value is non-finite'");
// Ensure we don't mess up bounds clipping checks
var rectcanvas = document.createElement("canvas");
Modified: trunk/LayoutTests/fast/canvas/linearGradient-infinite-values-expected.txt (200527 => 200528)
--- trunk/LayoutTests/fast/canvas/linearGradient-infinite-values-expected.txt 2016-05-06 22:06:29 UTC (rev 200527)
+++ trunk/LayoutTests/fast/canvas/linearGradient-infinite-values-expected.txt 2016-05-06 22:23:29 UTC (rev 200528)
@@ -3,18 +3,18 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS ctx.createLinearGradient(0, 0, 100, NaN) threw exception TypeError: Type error.
-PASS ctx.createLinearGradient(0, 0, 100, Infinity) threw exception TypeError: Type error.
-PASS ctx.createLinearGradient(0, 0, 100, -Infinity) threw exception TypeError: Type error.
-PASS ctx.createLinearGradient(0, 0, NaN, 100) threw exception TypeError: Type error.
-PASS ctx.createLinearGradient(0, 0, Infinity, 100) threw exception TypeError: Type error.
-PASS ctx.createLinearGradient(0, 0, -Infinity, 100) threw exception TypeError: Type error.
-PASS ctx.createLinearGradient(0, NaN, 100, 100) threw exception TypeError: Type error.
-PASS ctx.createLinearGradient(0, Infinity, 100, 100) threw exception TypeError: Type error.
-PASS ctx.createLinearGradient(0, -Infinity, 100, 100) threw exception TypeError: Type error.
-PASS ctx.createLinearGradient(NaN, 0, 100, 100) threw exception TypeError: Type error.
-PASS ctx.createLinearGradient(Infinity, 0, 100, 100) threw exception TypeError: Type error.
-PASS ctx.createLinearGradient(-Infinity, 0, 100, 100) threw exception TypeError: Type error.
+PASS ctx.createLinearGradient(0, 0, 100, NaN) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createLinearGradient(0, 0, 100, Infinity) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createLinearGradient(0, 0, 100, -Infinity) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createLinearGradient(0, 0, NaN, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createLinearGradient(0, 0, Infinity, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createLinearGradient(0, 0, -Infinity, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createLinearGradient(0, NaN, 100, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createLinearGradient(0, Infinity, 100, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createLinearGradient(0, -Infinity, 100, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createLinearGradient(NaN, 0, 100, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createLinearGradient(Infinity, 0, 100, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createLinearGradient(-Infinity, 0, 100, 100) threw exception TypeError: The provided value is non-finite.
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/canvas/radialGradient-infinite-values-expected.txt (200527 => 200528)
--- trunk/LayoutTests/fast/canvas/radialGradient-infinite-values-expected.txt 2016-05-06 22:06:29 UTC (rev 200527)
+++ trunk/LayoutTests/fast/canvas/radialGradient-infinite-values-expected.txt 2016-05-06 22:23:29 UTC (rev 200528)
@@ -3,24 +3,24 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS ctx.createRadialGradient(0, 0, 100, 0, 0, NaN) threw exception TypeError: Type error.
-PASS ctx.createRadialGradient(0, 0, 100, 0, 0, Infinity) threw exception TypeError: Type error.
-PASS ctx.createRadialGradient(0, 0, 100, 0, 0, -Infinity) threw exception TypeError: Type error.
-PASS ctx.createRadialGradient(0, 0, 100, 0, NaN, 100) threw exception TypeError: Type error.
-PASS ctx.createRadialGradient(0, 0, 100, 0, Infinity, 100) threw exception TypeError: Type error.
-PASS ctx.createRadialGradient(0, 0, 100, 0, -Infinity, 100) threw exception TypeError: Type error.
-PASS ctx.createRadialGradient(0, 0, 100, NaN, 0, 100) threw exception TypeError: Type error.
-PASS ctx.createRadialGradient(0, 0, 100, Infinity, 0, 100) threw exception TypeError: Type error.
-PASS ctx.createRadialGradient(0, 0, 100, -Infinity, 0, 100) threw exception TypeError: Type error.
-PASS ctx.createRadialGradient(0, 0, NaN, 0, 0, 100) threw exception TypeError: Type error.
-PASS ctx.createRadialGradient(0, 0, Infinity, 0, 0, 100) threw exception TypeError: Type error.
-PASS ctx.createRadialGradient(0, 0, -Infinity, 0, 0, 100) threw exception TypeError: Type error.
-PASS ctx.createRadialGradient(0, NaN, 100, 0, 0, 100) threw exception TypeError: Type error.
-PASS ctx.createRadialGradient(0, Infinity, 100, 0, 0, 100) threw exception TypeError: Type error.
-PASS ctx.createRadialGradient(0, -Infinity, 100, 0, 0, 100) threw exception TypeError: Type error.
-PASS ctx.createRadialGradient(NaN, 0, 100, 0, 0, 100) threw exception TypeError: Type error.
-PASS ctx.createRadialGradient(Infinity, 0, 100, 0, 0, 100) threw exception TypeError: Type error.
-PASS ctx.createRadialGradient(-Infinity, 0, 100, 0, 0, 100) threw exception TypeError: Type error.
+PASS ctx.createRadialGradient(0, 0, 100, 0, 0, NaN) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createRadialGradient(0, 0, 100, 0, 0, Infinity) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createRadialGradient(0, 0, 100, 0, 0, -Infinity) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createRadialGradient(0, 0, 100, 0, NaN, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createRadialGradient(0, 0, 100, 0, Infinity, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createRadialGradient(0, 0, 100, 0, -Infinity, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createRadialGradient(0, 0, 100, NaN, 0, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createRadialGradient(0, 0, 100, Infinity, 0, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createRadialGradient(0, 0, 100, -Infinity, 0, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createRadialGradient(0, 0, NaN, 0, 0, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createRadialGradient(0, 0, Infinity, 0, 0, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createRadialGradient(0, 0, -Infinity, 0, 0, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createRadialGradient(0, NaN, 100, 0, 0, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createRadialGradient(0, Infinity, 100, 0, 0, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createRadialGradient(0, -Infinity, 100, 0, 0, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createRadialGradient(NaN, 0, 100, 0, 0, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createRadialGradient(Infinity, 0, 100, 0, 0, 100) threw exception TypeError: The provided value is non-finite.
+PASS ctx.createRadialGradient(-Infinity, 0, 100, 0, 0, 100) threw exception TypeError: The provided value is non-finite.
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/canvas/resources/canvas-2d-imageData-create-nonfinite.js (200527 => 200528)
--- trunk/LayoutTests/fast/canvas/resources/canvas-2d-imageData-create-nonfinite.js 2016-05-06 22:06:29 UTC (rev 200527)
+++ trunk/LayoutTests/fast/canvas/resources/canvas-2d-imageData-create-nonfinite.js 2016-05-06 22:23:29 UTC (rev 200528)
@@ -3,10 +3,10 @@
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
-shouldThrow("ctx.createImageData(Infinity, Infinity)", '"TypeError: Type error"');
-shouldThrow("ctx.createImageData(Infinity, 10)", '"TypeError: Type error"');
-shouldThrow("ctx.createImageData(-Infinity, 10)", '"TypeError: Type error"');
-shouldThrow("ctx.createImageData(10, Infinity)", '"TypeError: Type error"');
-shouldThrow("ctx.createImageData(10, -Infinity)", '"TypeError: Type error"');
-shouldThrow("ctx.createImageData(NaN, 10)", '"TypeError: Type error"');
-shouldThrow("ctx.createImageData(10, NaN)", '"TypeError: Type error"');
+shouldThrow("ctx.createImageData(Infinity, Infinity)", '"TypeError: The provided value is non-finite"');
+shouldThrow("ctx.createImageData(Infinity, 10)", '"TypeError: The provided value is non-finite"');
+shouldThrow("ctx.createImageData(-Infinity, 10)", '"TypeError: The provided value is non-finite"');
+shouldThrow("ctx.createImageData(10, Infinity)", '"TypeError: The provided value is non-finite"');
+shouldThrow("ctx.createImageData(10, -Infinity)", '"TypeError: The provided value is non-finite"');
+shouldThrow("ctx.createImageData(NaN, 10)", '"TypeError: The provided value is non-finite"');
+shouldThrow("ctx.createImageData(10, NaN)", '"TypeError: The provided value is non-finite"');
Modified: trunk/LayoutTests/fast/canvas/script-tests/canvas-getImageData-invalid.js (200527 => 200528)
--- trunk/LayoutTests/fast/canvas/script-tests/canvas-getImageData-invalid.js 2016-05-06 22:06:29 UTC (rev 200527)
+++ trunk/LayoutTests/fast/canvas/script-tests/canvas-getImageData-invalid.js 2016-05-06 22:23:29 UTC (rev 200528)
@@ -2,17 +2,17 @@
ctx = document.createElement('canvas').getContext('2d');
-shouldThrow("ctx.getImageData(NaN, 10, 10, 10)", '"TypeError: Type error"');
-shouldThrow("ctx.getImageData(10, NaN, 10, 10)", '"TypeError: Type error"');
-shouldThrow("ctx.getImageData(10, 10, NaN, 10)", '"TypeError: Type error"');
-shouldThrow("ctx.getImageData(10, 10, 10, NaN)", '"TypeError: Type error"');
-shouldThrow("ctx.getImageData(Infinity, 10, 10, 10)", '"TypeError: Type error"');
-shouldThrow("ctx.getImageData(10, Infinity, 10, 10)", '"TypeError: Type error"');
-shouldThrow("ctx.getImageData(10, 10, Infinity, 10)", '"TypeError: Type error"');
-shouldThrow("ctx.getImageData(10, 10, 10, Infinity)", '"TypeError: Type error"');
-shouldThrow("ctx.getImageData(undefined, 10, 10, 10)", '"TypeError: Type error"');
-shouldThrow("ctx.getImageData(10, undefined, 10, 10)", '"TypeError: Type error"');
-shouldThrow("ctx.getImageData(10, 10, undefined, 10)", '"TypeError: Type error"');
-shouldThrow("ctx.getImageData(10, 10, 10, undefined)", '"TypeError: Type error"');
+shouldThrow("ctx.getImageData(NaN, 10, 10, 10)", '"TypeError: The provided value is non-finite"');
+shouldThrow("ctx.getImageData(10, NaN, 10, 10)", '"TypeError: The provided value is non-finite"');
+shouldThrow("ctx.getImageData(10, 10, NaN, 10)", '"TypeError: The provided value is non-finite"');
+shouldThrow("ctx.getImageData(10, 10, 10, NaN)", '"TypeError: The provided value is non-finite"');
+shouldThrow("ctx.getImageData(Infinity, 10, 10, 10)", '"TypeError: The provided value is non-finite"');
+shouldThrow("ctx.getImageData(10, Infinity, 10, 10)", '"TypeError: The provided value is non-finite"');
+shouldThrow("ctx.getImageData(10, 10, Infinity, 10)", '"TypeError: The provided value is non-finite"');
+shouldThrow("ctx.getImageData(10, 10, 10, Infinity)", '"TypeError: The provided value is non-finite"');
+shouldThrow("ctx.getImageData(undefined, 10, 10, 10)", '"TypeError: The provided value is non-finite"');
+shouldThrow("ctx.getImageData(10, undefined, 10, 10)", '"TypeError: The provided value is non-finite"');
+shouldThrow("ctx.getImageData(10, 10, undefined, 10)", '"TypeError: The provided value is non-finite"');
+shouldThrow("ctx.getImageData(10, 10, 10, undefined)", '"TypeError: The provided value is non-finite"');
shouldThrow("ctx.getImageData(10, 10, 0, 10)", '"Error: IndexSizeError: DOM Exception 1"');
shouldThrow("ctx.getImageData(10, 10, 10, 0)", '"Error: IndexSizeError: DOM Exception 1"');
Modified: trunk/LayoutTests/fast/canvas/script-tests/linearGradient-infinite-values.js (200527 => 200528)
--- trunk/LayoutTests/fast/canvas/script-tests/linearGradient-infinite-values.js 2016-05-06 22:06:29 UTC (rev 200527)
+++ trunk/LayoutTests/fast/canvas/script-tests/linearGradient-infinite-values.js 2016-05-06 22:23:29 UTC (rev 200528)
@@ -4,15 +4,15 @@
var ctx = document.createElement('canvas').getContext('2d');
-shouldThrow("ctx.createLinearGradient(0, 0, 100, NaN)", "'TypeError: Type error'");
-shouldThrow("ctx.createLinearGradient(0, 0, 100, Infinity)", "'TypeError: Type error'");
-shouldThrow("ctx.createLinearGradient(0, 0, 100, -Infinity)", "'TypeError: Type error'");
-shouldThrow("ctx.createLinearGradient(0, 0, NaN, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createLinearGradient(0, 0, Infinity, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createLinearGradient(0, 0, -Infinity, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createLinearGradient(0, NaN, 100, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createLinearGradient(0, Infinity, 100, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createLinearGradient(0, -Infinity, 100, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createLinearGradient(NaN, 0, 100, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createLinearGradient(Infinity, 0, 100, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createLinearGradient(-Infinity, 0, 100, 100)", "'TypeError: Type error'");
+shouldThrow("ctx.createLinearGradient(0, 0, 100, NaN)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createLinearGradient(0, 0, 100, Infinity)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createLinearGradient(0, 0, 100, -Infinity)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createLinearGradient(0, 0, NaN, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createLinearGradient(0, 0, Infinity, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createLinearGradient(0, 0, -Infinity, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createLinearGradient(0, NaN, 100, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createLinearGradient(0, Infinity, 100, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createLinearGradient(0, -Infinity, 100, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createLinearGradient(NaN, 0, 100, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createLinearGradient(Infinity, 0, 100, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createLinearGradient(-Infinity, 0, 100, 100)", "'TypeError: The provided value is non-finite'");
Modified: trunk/LayoutTests/fast/canvas/script-tests/radialGradient-infinite-values.js (200527 => 200528)
--- trunk/LayoutTests/fast/canvas/script-tests/radialGradient-infinite-values.js 2016-05-06 22:06:29 UTC (rev 200527)
+++ trunk/LayoutTests/fast/canvas/script-tests/radialGradient-infinite-values.js 2016-05-06 22:23:29 UTC (rev 200528)
@@ -4,21 +4,21 @@
var ctx = document.createElement('canvas').getContext('2d');
-shouldThrow("ctx.createRadialGradient(0, 0, 100, 0, 0, NaN)", "'TypeError: Type error'");
-shouldThrow("ctx.createRadialGradient(0, 0, 100, 0, 0, Infinity)", "'TypeError: Type error'");
-shouldThrow("ctx.createRadialGradient(0, 0, 100, 0, 0, -Infinity)", "'TypeError: Type error'");
-shouldThrow("ctx.createRadialGradient(0, 0, 100, 0, NaN, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createRadialGradient(0, 0, 100, 0, Infinity, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createRadialGradient(0, 0, 100, 0, -Infinity, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createRadialGradient(0, 0, 100, NaN, 0, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createRadialGradient(0, 0, 100, Infinity, 0, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createRadialGradient(0, 0, 100, -Infinity, 0, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createRadialGradient(0, 0, NaN, 0, 0, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createRadialGradient(0, 0, Infinity, 0, 0, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createRadialGradient(0, 0, -Infinity, 0, 0, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createRadialGradient(0, NaN, 100, 0, 0, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createRadialGradient(0, Infinity, 100, 0, 0, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createRadialGradient(0, -Infinity, 100, 0, 0, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createRadialGradient(NaN, 0, 100, 0, 0, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createRadialGradient(Infinity, 0, 100, 0, 0, 100)", "'TypeError: Type error'");
-shouldThrow("ctx.createRadialGradient(-Infinity, 0, 100, 0, 0, 100)", "'TypeError: Type error'");
+shouldThrow("ctx.createRadialGradient(0, 0, 100, 0, 0, NaN)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createRadialGradient(0, 0, 100, 0, 0, Infinity)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createRadialGradient(0, 0, 100, 0, 0, -Infinity)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createRadialGradient(0, 0, 100, 0, NaN, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createRadialGradient(0, 0, 100, 0, Infinity, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createRadialGradient(0, 0, 100, 0, -Infinity, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createRadialGradient(0, 0, 100, NaN, 0, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createRadialGradient(0, 0, 100, Infinity, 0, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createRadialGradient(0, 0, 100, -Infinity, 0, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createRadialGradient(0, 0, NaN, 0, 0, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createRadialGradient(0, 0, Infinity, 0, 0, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createRadialGradient(0, 0, -Infinity, 0, 0, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createRadialGradient(0, NaN, 100, 0, 0, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createRadialGradient(0, Infinity, 100, 0, 0, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createRadialGradient(0, -Infinity, 100, 0, 0, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createRadialGradient(NaN, 0, 100, 0, 0, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createRadialGradient(Infinity, 0, 100, 0, 0, 100)", "'TypeError: The provided value is non-finite'");
+shouldThrow("ctx.createRadialGradient(-Infinity, 0, 100, 0, 0, 100)", "'TypeError: The provided value is non-finite'");
Modified: trunk/Source/WebCore/ChangeLog (200527 => 200528)
--- trunk/Source/WebCore/ChangeLog 2016-05-06 22:06:29 UTC (rev 200527)
+++ trunk/Source/WebCore/ChangeLog 2016-05-06 22:23:29 UTC (rev 200528)
@@ -1,3 +1,46 @@
+2016-05-06 Chris Dumez <cdu...@apple.com>
+
+ Clean up converting from JSValue to float / double in the bindings generator
+ https://bugs.webkit.org/show_bug.cgi?id=157407
+
+ Reviewed by Darin Adler.
+
+ Clean up converting from JSValue to float / double in the bindings generator:
+ - Handle all aspects of converting to float / double inside JSValueToNative()
+ instead of relying partly on the call sites.
+ - Add a build<>() template function to JSDOMBuild.h that is now
+ called from the bindings to convert to float / double and deal with
+ non-finite values.
+ - Provide a better message with the TypeError that is thrown for non-finite
+ values.
+
+ No new tests, rebaselined existing tests.
+
+ * bindings/js/JSDOMBinding.cpp:
+ (WebCore::throwSequenceTypeError):
+ (WebCore::throwNonFiniteTypeError):
+ * bindings/js/JSDOMBinding.h:
+ * bindings/js/JSDOMBuild.h:
+ (WebCore::build):
+ * bindings/scripts/CodeGenerator.pm:
+ (IsFloatingPointType):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (JSValueToNative):
+ (GenerateImplementation): Deleted.
+ (GenerateParametersCheck): Deleted.
+ (GenerateReturnParameters): Deleted.
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::setJSTestObjStrictFloat):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalDoubleIsNaN):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalFloatIsNaN):
+ (WebCore::jsTestObjPrototypeFunctionStrictFunction):
+ (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
+ (WebCore::jsTestObjPrototypeFunctionAny):
+ (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
+ (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
+ * bindings/scripts/test/JS/JSTestTypedefs.cpp:
+ (WebCore::jsTestTypedefsPrototypeFunctionSetShadow):
+
2016-05-06 Dean Jackson <d...@apple.com>
Regions, Shapes and Tracks don't need runtime features
Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp (200527 => 200528)
--- trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp 2016-05-06 22:06:29 UTC (rev 200527)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp 2016-05-06 22:23:29 UTC (rev 200528)
@@ -788,9 +788,14 @@
void throwSequenceTypeError(JSC::ExecState& state)
{
- throwTypeError(state, "Value is not a sequence");
+ throwTypeError(state, ASCIILiteral("Value is not a sequence"));
}
+void throwNonFiniteTypeError(ExecState& state)
+{
+ throwTypeError(&state, ASCIILiteral("The provided value is non-finite"));
+}
+
bool throwSetterTypeError(JSC::ExecState& state, const char* interfaceName, const char* attributeName)
{
throwTypeError(state, makeString("The ", interfaceName, '.', attributeName, " setter can only be used on instances of ", interfaceName));
Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (200527 => 200528)
--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2016-05-06 22:06:29 UTC (rev 200527)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2016-05-06 22:23:29 UTC (rev 200528)
@@ -91,6 +91,7 @@
void throwAttributeTypeError(JSC::ExecState&, const char* interfaceName, const char* attributeName, const char* expectedType);
WEBCORE_EXPORT void throwSequenceTypeError(JSC::ExecState&);
WEBCORE_EXPORT bool throwSetterTypeError(JSC::ExecState&, const char* interfaceName, const char* attributeName);
+WEBCORE_EXPORT void throwNonFiniteTypeError(JSC::ExecState&);
WEBCORE_EXPORT JSC::EncodedJSValue throwArgumentMustBeEnumError(JSC::ExecState&, unsigned argumentIndex, const char* argumentName, const char* functionInterfaceName, const char* functionName, const char* expectedValues);
JSC::EncodedJSValue throwArgumentMustBeFunctionError(JSC::ExecState&, unsigned argumentIndex, const char* argumentName, const char* functionInterfaceName, const char* functionName);
Modified: trunk/Source/WebCore/bindings/js/JSDOMBuild.h (200527 => 200528)
--- trunk/Source/WebCore/bindings/js/JSDOMBuild.h 2016-05-06 22:06:29 UTC (rev 200527)
+++ trunk/Source/WebCore/bindings/js/JSDOMBuild.h 2016-05-06 22:23:29 UTC (rev 200528)
@@ -26,14 +26,27 @@
#pragma once
+#include "JSDOMBinding.h"
+
namespace WebCore {
template<typename T> T build(JSC::ExecState&, JSC::JSValue);
template<typename T, unsigned characterCount> T build(JSC::ExecState&, JSC::JSValue, const char (&propertyName)[characterCount]);
+enum class ShouldAllowNonFinite { No, Yes };
+template<typename T> T build(JSC::ExecState&, JSC::JSValue, ShouldAllowNonFinite);
template<typename T, unsigned characterCount> inline T build(JSC::ExecState& state, JSC::JSValue value, const char (&propertyName)[characterCount])
{
return build<T>(state, value.get(&state, JSC::Identifier::fromString(&state, propertyName)));
}
+template<typename T> inline T build(JSC::ExecState& state, JSC::JSValue value, ShouldAllowNonFinite allowNonFinite)
+{
+ static_assert(std::is_same<T, float>::value || std::is_same<T, double>::value, "Should be called with converting to float or double");
+ double number = value.toNumber(&state);
+ if (allowNonFinite == ShouldAllowNonFinite::No && UNLIKELY(!std::isfinite(number)))
+ throwNonFiniteTypeError(state);
+ return static_cast<T>(number);
}
+
+}
Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (200527 => 200528)
--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2016-05-06 22:06:29 UTC (rev 200527)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2016-05-06 22:23:29 UTC (rev 200528)
@@ -61,6 +61,13 @@
"unsigned short" => 1,
);
+my %floatingPointTypeHash = (
+ "float" => 1,
+ "unrestricted float" => 1,
+ "double" => 1,
+ "unrestricted double" => 1,
+);
+
my %primitiveTypeHash = ( "boolean" => 1, "void" => 1, "Date" => 1 );
# WebCore types used directly in IDL files.
@@ -357,6 +364,13 @@
return 0;
}
+sub IsFloatingPointType
+{
+ my ($object, $type) = @_;
+ return 1 if $floatingPointTypeHash{$type};
+ return 0;
+}
+
sub IsPrimitiveType
{
my $object = shift;
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (200527 => 200528)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-05-06 22:06:29 UTC (rev 200527)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-05-06 22:23:29 UTC (rev 200528)
@@ -2928,13 +2928,6 @@
push(@implContent, " }\n");
}
- if ($type eq "double" or $type eq "float") {
- push(@implContent, " if (UNLIKELY(!std::isfinite(nativeValue))) {\n");
- push(@implContent, " throwVMTypeError(state);\n");
- push(@implContent, " return false;\n");
- push(@implContent, " }\n");
- }
-
if ($svgPropertyOrListPropertyType) {
if ($svgPropertyType) {
push(@implContent, " if (impl.isReadOnly()) {\n");
@@ -3798,11 +3791,6 @@
if ($codeGenerator->IsTypedArrayType($argType) and $argType ne "ArrayBuffer") {
$value = $shouldPassByReference ? "$name.releaseNonNull()" : "WTFMove($name)";
}
-
- if ($argType eq "double" or $argType eq "float") {
- push(@$outputArray, " if (UNLIKELY(!std::isfinite($name)))\n");
- push(@$outputArray, " return throwVMTypeError(state);\n");
- }
}
push(@arguments, $value);
@@ -4414,8 +4402,16 @@
return ($value, 0) if $type eq "any";
return ("$value.toBoolean(state)", 1) if $type eq "boolean";
- return ("$value.toNumber(state)", 1) if $type eq "double" or $type eq "unrestricted double";
- return ("$value.toFloat(state)", 1) if $type eq "float" or $type eq "unrestricted float";
+
+ if ($codeGenerator->IsFloatingPointType($type)) {
+ AddToImplIncludes("JSDOMBuild.h");
+ return ("build<double>(*state, $value, ShouldAllowNonFinite::No)", 1) if $type eq "double";
+ return ("build<double>(*state, $value, ShouldAllowNonFinite::Yes)", 1) if $type eq "unrestricted double";
+ return ("build<float>(*state, $value, ShouldAllowNonFinite::No)", 1) if $type eq "float";
+ return ("build<float>(*state, $value, ShouldAllowNonFinite::Yes)", 1) if $type eq "unrestricted float";
+ die "Unhandled floating point type: " . $type;
+ }
+
return ("valueToDate(state, $value)", 1) if $type eq "Date";
return ("to$type($value)", 1) if $codeGenerator->IsTypedArrayType($type);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (200527 => 200528)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-05-06 22:06:29 UTC (rev 200527)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-05-06 22:23:29 UTC (rev 200528)
@@ -3630,7 +3630,7 @@
return throwSetterTypeError(*state, "TestObj", "strictFloat");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = value.toFloat(state);
+ auto nativeValue = build<float>(*state, value, ShouldAllowNonFinite::Yes);
if (UNLIKELY(state->hadException()))
return false;
impl.setStrictFloat(WTFMove(nativeValue));
@@ -4688,7 +4688,7 @@
return throwThisTypeError(*state, "TestObj", "methodWithOptionalDoubleIsNaN");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
auto& impl = castedThis->wrapped();
- auto number = state->argument(0).toNumber(state);
+ auto number = build<double>(*state, state->argument(0), ShouldAllowNonFinite::Yes);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.methodWithOptionalDoubleIsNaN(WTFMove(number));
@@ -4703,7 +4703,7 @@
return throwThisTypeError(*state, "TestObj", "methodWithOptionalFloatIsNaN");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
auto& impl = castedThis->wrapped();
- auto number = state->argument(0).toFloat(state);
+ auto number = build<float>(*state, state->argument(0), ShouldAllowNonFinite::Yes);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.methodWithOptionalFloatIsNaN(WTFMove(number));
@@ -5692,7 +5692,7 @@
auto str = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- auto a = state->argument(1).toFloat(state);
+ auto a = build<float>(*state, state->argument(1), ShouldAllowNonFinite::Yes);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
auto b = toInt32(state, state->argument(2), NormalConversion);
@@ -5784,7 +5784,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto head = state->argument(0).toNumber(state);
+ auto head = build<double>(*state, state->argument(0), ShouldAllowNonFinite::Yes);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
Vector<double> tail = toNativeArguments<double>(state, 1);
@@ -5827,7 +5827,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 2))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto a = state->argument(0).toFloat(state);
+ auto a = build<float>(*state, state->argument(0), ShouldAllowNonFinite::Yes);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
auto b = toInt32(state, state->argument(1), NormalConversion);
@@ -5871,11 +5871,9 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto a = state->argument(0).toFloat(state);
+ auto a = build<float>(*state, state->argument(0), ShouldAllowNonFinite::No);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- if (UNLIKELY(!std::isfinite(a)))
- return throwVMTypeError(state);
impl.testPromiseFunctionWithFloatArgument(WTFMove(a), DeferredWrapper(state, castedThis->globalObject(), promiseDeferred));
return JSValue::encode(jsUndefined());
}
@@ -5937,11 +5935,9 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto a = state->argument(0).toFloat(state);
+ auto a = build<float>(*state, state->argument(0), ShouldAllowNonFinite::No);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- if (UNLIKELY(!std::isfinite(a)))
- return throwVMTypeError(state);
impl.testPromiseOverloadedFunction(WTFMove(a), DeferredWrapper(state, castedThis->globalObject(), promiseDeferred));
return JSValue::encode(jsUndefined());
}
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp (200527 => 200528)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp 2016-05-06 22:06:29 UTC (rev 200527)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp 2016-05-06 22:23:29 UTC (rev 200528)
@@ -24,6 +24,7 @@
#include "DOMStringList.h"
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
+#include "JSDOMBuild.h"
#include "JSDOMConstructor.h"
#include "JSDOMStringList.h"
#include "JSSVGPoint.h"
@@ -480,19 +481,19 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 3))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto width = state->argument(0).toFloat(state);
+ auto width = build<float>(*state, state->argument(0), ShouldAllowNonFinite::Yes);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- auto height = state->argument(1).toFloat(state);
+ auto height = build<float>(*state, state->argument(1), ShouldAllowNonFinite::Yes);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- auto blur = state->argument(2).toFloat(state);
+ auto blur = build<float>(*state, state->argument(2), ShouldAllowNonFinite::Yes);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
auto color = state->argument(3).isUndefined() ? String() : state->uncheckedArgument(3).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- auto alpha = state->argument(4).isUndefined() ? Optional<float>() : state->uncheckedArgument(4).toFloat(state);
+ auto alpha = state->argument(4).isUndefined() ? Optional<float>() : build<float>(*state, state->uncheckedArgument(4), ShouldAllowNonFinite::Yes);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.setShadow(WTFMove(width), WTFMove(height), WTFMove(blur), WTFMove(color), WTFMove(alpha));