https://bugs.webkit.org/show_bug.cgi?id=132407
Reviewed by Dirk Schulze.
Source/WebCore:
Per the WebIDL spec, passing non-finite parameter to a method that
takes doubles, should generate a type error.
Tests:
* canvas/philip/tests/2d.imageData.create2.nonfinite.html:
* fast/canvas/canvas-2d-imageData-create-nonfinite.html:
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::createImageData):
LayoutTests:
* canvas/philip/tests/2d.imageData.create2.nonfinite.html:
* fast/canvas/canvas-2d-imageData-create-nonfinite-expected.txt:
* fast/canvas/resources/canvas-2d-imageData-create-nonfinite.js:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@168092
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-05-01 Rik Cabanier <cabanier@adobe.com>
+
+ Calling createPattern with a broken image must throw an invalidstate error
+ https://bugs.webkit.org/show_bug.cgi?id=132407
+
+ Reviewed by Dirk Schulze.
+
+ * canvas/philip/tests/2d.imageData.create2.nonfinite.html:
+ * fast/canvas/canvas-2d-imageData-create-nonfinite-expected.txt:
+ * fast/canvas/resources/canvas-2d-imageData-create-nonfinite.js:
+
2014-05-01 Andreas Kling <akling@apple.com>
Skip fast/multicol/fixed-stack.html
try { var _thrown = false;
ctx.createImageData(Infinity, 10);
-} catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) _fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createImageData(Infinity, 10)"); }
+} catch (e) { if (e.code != DOMException.TYPE_ERR) _fail("Failed assertion: expected exception of type TYPE_ERR, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createImageData(Infinity, 10)"); }
try { var _thrown = false;
ctx.createImageData(-Infinity, 10);
-} catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) _fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createImageData(-Infinity, 10)"); }
+} catch (e) { if (e.code != DOMException.TYPE_ERR) _fail("Failed assertion: expected exception of type TYPE_ERR, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createImageData(-Infinity, 10)"); }
try { var _thrown = false;
ctx.createImageData(NaN, 10);
-} catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) _fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createImageData(NaN, 10)"); }
+} catch (e) { if (e.code != DOMException.TYPE_ERR) _fail("Failed assertion: expected exception of type TYPE_ERR, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createImageData(NaN, 10)"); }
try { var _thrown = false;
ctx.createImageData(10, Infinity);
-} catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) _fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createImageData(10, Infinity)"); }
+} catch (e) { if (e.code != DOMException.TYPE_ERR) _fail("Failed assertion: expected exception of type TYPE_ERR, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createImageData(10, Infinity)"); }
try { var _thrown = false;
ctx.createImageData(10, -Infinity);
-} catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) _fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createImageData(10, -Infinity)"); }
+} catch (e) { if (e.code != DOMException.TYPE_ERR) _fail("Failed assertion: expected exception of type TYPE_ERR, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createImageData(10, -Infinity)"); }
try { var _thrown = false;
ctx.createImageData(10, NaN);
-} catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) _fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createImageData(10, NaN)"); }
+} catch (e) { if (e.code != DOMException.TYPE_ERR) _fail("Failed assertion: expected exception of type TYPE_ERR, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createImageData(10, NaN)"); }
try { var _thrown = false;
ctx.createImageData(Infinity, Infinity);
-} catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) _fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createImageData(Infinity, Infinity)"); }
+} catch (e) { if (e.code != DOMException.TYPE_ERR) _fail("Failed assertion: expected exception of type TYPE_ERR, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createImageData(Infinity, Infinity)"); }
});
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS ctx.createImageData(Infinity, Infinity) threw exception Error: NotSupportedError: DOM Exception 9.
-PASS ctx.createImageData(Infinity, 10) threw exception Error: NotSupportedError: DOM Exception 9.
-PASS ctx.createImageData(-Infinity, 10) threw exception Error: NotSupportedError: DOM Exception 9.
-PASS ctx.createImageData(10, Infinity) threw exception Error: NotSupportedError: DOM Exception 9.
-PASS ctx.createImageData(10, -Infinity) threw exception Error: NotSupportedError: DOM Exception 9.
-PASS ctx.createImageData(NaN, 10) threw exception Error: NotSupportedError: DOM Exception 9.
-PASS ctx.createImageData(10, NaN) threw exception Error: NotSupportedError: DOM Exception 9.
+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 successfullyParsed is true
TEST COMPLETE
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
-shouldThrow("ctx.createImageData(Infinity, Infinity)", '"Error: NotSupportedError: DOM Exception 9"');
-shouldThrow("ctx.createImageData(Infinity, 10)", '"Error: NotSupportedError: DOM Exception 9"');
-shouldThrow("ctx.createImageData(-Infinity, 10)", '"Error: NotSupportedError: DOM Exception 9"');
-shouldThrow("ctx.createImageData(10, Infinity)", '"Error: NotSupportedError: DOM Exception 9"');
-shouldThrow("ctx.createImageData(10, -Infinity)", '"Error: NotSupportedError: DOM Exception 9"');
-shouldThrow("ctx.createImageData(NaN, 10)", '"Error: NotSupportedError: DOM Exception 9"');
-shouldThrow("ctx.createImageData(10, NaN)", '"Error: NotSupportedError: DOM Exception 9"');
+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"');
+2014-05-01 Rik Cabanier <cabanier@adobe.com>
+
+ Calling createPattern with a broken image must throw an invalidstate error
+ https://bugs.webkit.org/show_bug.cgi?id=132407
+
+ Reviewed by Dirk Schulze.
+
+ Per the WebIDL spec, passing non-finite parameter to a method that
+ takes doubles, should generate a type error.
+
+ Tests:
+ * canvas/philip/tests/2d.imageData.create2.nonfinite.html:
+ * fast/canvas/canvas-2d-imageData-create-nonfinite.html:
+
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::createImageData):
+
2014-04-30 David Hyatt <hyatt@apple.com>
REGRESSION (r168046): [New Multicolumn] LeftToRight-rl.html (and all the other reversed/block-axis pagination tests) fail
return 0;
}
if (!std::isfinite(sw) || !std::isfinite(sh)) {
- ec = NOT_SUPPORTED_ERR;
+ ec = TypeError;
return 0;
}