<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
async_test(t => {
var png_max_dimension = 65535;
var canvas = document.createElement("canvas");
canvas.width = 10;
canvas.height = png_max_dimension + 1;
canvas.toBlob(function(blob) {
t.done();
}, "image/png", 1.0);
}, "Verify that toBlob does not crash when encoding oversized canvas to Png.");
async_test(t => {
// Based on third_party/libjpeg/jmorecfg.h:JPEG_MAX_DIMENSION
var jpeg_max_dimension = 65500;
var canvas = document.createElement("canvas");
canvas.width = 10;
canvas.height = jpeg_max_dimension + 1;
canvas.toBlob(function(blob) {
t.done();
}, "image/jpeg", 1.0);
}, "Verify that toBlob does not crash when encoding oversized canvas to Jpeg.");
async_test(t => {
// Based on third_party/libwebp/src/webp/encode.h:WEBP_MAX_DIMENSION
var webp_max_dimension = 16383;
var canvas = document.createElement("canvas");
canvas.width = 10;
canvas.height = webp_max_dimension + 1;
canvas.toBlob(function(blob) {
t.done();
}, "image/webp", 1.0);
}, "Verify that toBlob does not crash when encoding oversized canvas to Webp.");
</script>