haikuwebkit/LayoutTests/fast/canvas/canvas-crash.html

33 lines
898 B
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
<title>Canvas test: This test passes if it doesn't crash.'</title>
<body>
<a id="a"></a>
<script>
if (window.testRunner)
testRunner.dumpAsText();
function canvastest()
{
fast/canvas/canvas-crash.html doesn't test what it intends to on iOS https://bugs.webkit.org/show_bug.cgi?id=228747 Reviewed by Simon Fraser. Source/WebCore: The test fast/canvas/canvas-crash.html intends to test changes made to actual canvas code (see r215632); however, on the iOS simulator the test doesn't even manage to make a canvas context because of "maximum area" and "maximum backing store size" limits, which differ per-platform. This results in unique test results for iOS, as well as the test not actually exercising the code it was intended to. Fix this by adding an override for the maximum area limit (we already had one for maximum backing store size), and overriding them in this test (and another similarly afflicted test). * html/HTMLCanvasElement.cpp: (WebCore::maxCanvasArea): (WebCore::HTMLCanvasElement::setMaxCanvasAreaForTesting): (WebCore::HTMLCanvasElement::createImageBuffer const): * html/HTMLCanvasElement.h: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): (WebCore::Internals::setMaxCanvasArea): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * fast/canvas/canvas-crash.html: * fast/canvas/canvas-skia-excessive-size.html: * platform/ios-simulator/fast/canvas/canvas-crash-expected.txt: Removed. * platform/ios-simulator/fast/canvas/canvas-skia-excessive-size-expected.txt: Removed. Delete the iOS-specific results, and adopt the new overrides in these two tests. Canonical link: https://commits.webkit.org/240306@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280715 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-06 01:56:58 +00:00
if (window.internals) {
window.internals.setMaxCanvasPixelMemory(16384 * 16384 * 4);
window.internals.setMaxCanvasArea(13951 * 11138);
}
var ctx = document.getCSSCanvasContext("2d", "canvastest", 13951, 11138);
Update operations in CanvasImageData.idl to use long rather than float as per spec https://bugs.webkit.org/show_bug.cgi?id=225263 Reviewed by Simon Fraser. LayoutTests/imported/w3c: * canvas/2d.imageData.create2.tiny-expected.txt: * canvas/2d.imageData.get.tiny-expected.txt: Update results, which now don't pass, to match the spec behavior. * web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.double-expected.txt: * web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.zero-expected.txt: * web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.double-expected.txt: * web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.large.crash-expected.txt: * web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.rounding-expected.txt: * web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.zero-expected.txt: Update results, which now pass! Source/WebCore: Use `[EnforceRange] long` to match the current HTML spec. * html/canvas/CanvasImageData.idl: * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::createImageData const): (WebCore::CanvasRenderingContext2DBase::getImageData const): (WebCore::CanvasRenderingContext2DBase::putImageData): * html/canvas/CanvasRenderingContext2DBase.h: LayoutTests: * canvas/philip/tests/2d.imageData.create2.tiny-expected.txt: * canvas/philip/tests/2d.imageData.get.tiny-expected.txt: Update results, which now don't pass, to match the spec behavior. * fast/canvas/canvas-2d-imageData-create-nonfinite-expected.txt: * fast/canvas/canvas-crash.html: * fast/canvas/canvas-getImageData-invalid-expected.txt: * fast/canvas/canvas-getImageData-invalid-result-buffer-crash.html: * fast/canvas/canvas-getImageData-invalid.html: * fast/canvas/canvas-getImageData-large-crash-expected.txt: * fast/canvas/canvas-getImageData-rounding-expected.txt: * fast/canvas/canvas-getImageData-rounding.html: * fast/canvas/canvas-putImageData-expected.txt: * fast/canvas/canvas-putImageData.js: * fast/canvas/resources/canvas-2d-imageData-create-nonfinite.js: Update tests and results to match spec behavior. Canonical link: https://commits.webkit.org/237223@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276877 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-01 20:40:57 +00:00
ctx.putImageData(ctx.getImageData(1431655766, document.getElementById("a").appendChild(document.createElement("media")).clientWidth, 4096, -1024), 128, -65535, 127, -2147483648, 2147483647, -2147483648);
fast/canvas/canvas-crash.html doesn't test what it intends to on iOS https://bugs.webkit.org/show_bug.cgi?id=228747 Reviewed by Simon Fraser. Source/WebCore: The test fast/canvas/canvas-crash.html intends to test changes made to actual canvas code (see r215632); however, on the iOS simulator the test doesn't even manage to make a canvas context because of "maximum area" and "maximum backing store size" limits, which differ per-platform. This results in unique test results for iOS, as well as the test not actually exercising the code it was intended to. Fix this by adding an override for the maximum area limit (we already had one for maximum backing store size), and overriding them in this test (and another similarly afflicted test). * html/HTMLCanvasElement.cpp: (WebCore::maxCanvasArea): (WebCore::HTMLCanvasElement::setMaxCanvasAreaForTesting): (WebCore::HTMLCanvasElement::createImageBuffer const): * html/HTMLCanvasElement.h: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): (WebCore::Internals::setMaxCanvasArea): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * fast/canvas/canvas-crash.html: * fast/canvas/canvas-skia-excessive-size.html: * platform/ios-simulator/fast/canvas/canvas-crash-expected.txt: Removed. * platform/ios-simulator/fast/canvas/canvas-skia-excessive-size-expected.txt: Removed. Delete the iOS-specific results, and adopt the new overrides in these two tests. Canonical link: https://commits.webkit.org/240306@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280715 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-06 01:56:58 +00:00
// Resize the context to ensure the large canvas doesn't leak into the next test.
document.getCSSCanvasContext("2d", "canvastest", 1, 1);
}
canvastest();
var result = document.getElementById("a");
result.innerHTML = "PASSED";
</script>
</body>