blob: 9b9669f186dc546036ff9f03aa0cc34316488d21 [file] [log] [blame]
<!DOCTYPE html>
<html>
<title>createImageBitmap: blob with wrong mime type</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<script>
promise_test(t => {
// Source: https://commons.wikimedia.org/wiki/File:1x1.png (Public Domain)
const IMAGE = atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAA" +
"ACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=");
let bytes = new Array(IMAGE.length);
for (let i = 0; i < IMAGE.length; i++) {
bytes[i] = IMAGE.charCodeAt(i);
}
let blob = new Blob([new Uint8Array(bytes)], { type: "text/html"});
return window.createImageBitmap(blob)
.then(imageBitmap => {
assert_true(true, "Image created!");
assert_equals(imageBitmap.width, 1, "Image is 1x1");
assert_equals(imageBitmap.height, 1, "Image is 1x1");
});
});
</script>