| <!DOCTYPE html> |
| <script src="../../../../resources/testharness.js"></script> |
| <script src="../../../../resources/testharnessreport.js"></script> |
| <script> |
| |
| async_test(function(t) { |
| var png_max_dimension = 65535; |
| var offscreenCanvas = new OffscreenCanvas(10, png_max_dimension + 1); |
| var ctx = offscreenCanvas.getContext("2d"); |
| ctx.fillRect(0, 0, 1, 1); |
| offscreenCanvas.convertToBlob({type: "image/png"}).then(t.step_func_done(function() { |
| }), t.step_func_done(function(e) { |
| assert_false("convertToBlob failed, but shouldn't be."); |
| })); |
| }, "Verify that convertToBlob does not crash with oversized source encoded to Png"); |
| |
| async_test(function(t) { |
| // Based on third_party/libjpeg/jmorecfg.h:JPEG_MAX_DIMENSION |
| var jpeg_max_dimension = 65500; |
| var offscreenCanvas = new OffscreenCanvas(10, jpeg_max_dimension + 1); |
| var ctx = offscreenCanvas.getContext("2d"); |
| ctx.fillRect(0, 0, 1, 1); |
| offscreenCanvas.convertToBlob({type: "image/jpeg"}).then(t.step_func_done(function() { |
| }), t.step_func_done(function(e) { |
| assert_false("convertToBlob failed, but shouldn't be."); |
| })); |
| }, "Verify that convertToBlob does not crash with oversized source encoded to Jpeg"); |
| |
| async_test(function(t) { |
| // Based on third_party/libwebp/src/webp/encode.h:WEBP_MAX_DIMENSION |
| var webp_max_dimension = 16383; |
| var offscreenCanvas = new OffscreenCanvas(10, webp_max_dimension + 1); |
| var ctx = offscreenCanvas.getContext("2d"); |
| ctx.fillRect(0, 0, 1, 1); |
| offscreenCanvas.convertToBlob({type: "image/webp"}).then(t.step_func_done(function() { |
| }), t.step_func_done(function(e) { |
| assert_false("convertToBlob failed, but shouldn't be."); |
| })); |
| }, "Verify that convertToBlob does not crash with oversized source encoded to Webp"); |
| </script> |
| |