diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /image/test/mochitest/test_image_crossorigin_data_url.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'image/test/mochitest/test_image_crossorigin_data_url.html')
-rw-r--r-- | image/test/mochitest/test_image_crossorigin_data_url.html | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/image/test/mochitest/test_image_crossorigin_data_url.html b/image/test/mochitest/test_image_crossorigin_data_url.html new file mode 100644 index 0000000000..4465b5aab4 --- /dev/null +++ b/image/test/mochitest/test_image_crossorigin_data_url.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<meta charset=utf-8> +<title>Test for handling of 'crossorigin' attribute on CSS link with data: URL</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<div id="someuniqueidhere"></div> +<img id="testimg" crossorigin src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR42mP4z8AAAAMBAQD3A0FDAAAAAElFTkSuQmCC"> +<script> + /* global async_test, assert_equals */ + var t = async_test("img@crossorigin with data: src"); + window.addEventListener("load", t.step_func_done(function() { + var img = document.getElementById("testimg"); + assert_equals(img.naturalWidth, 1, "Should have 1px width"); + assert_equals(img.naturalHeight, 1, "Should have 1px height"); + var c = document.createElement("canvas"); + c.width = c.height = 1; + var ctx = c.getContext("2d"); + ctx.drawImage(img, 0, 0); + var data = ctx.getImageData(0, 0, 1, 1); + assert_equals(data.width, 1, "Should have 1px data width"); + assert_equals(data.height, 1, "Should have 1px data height"); + assert_equals(data.data[0], 255, "Should have lots of red"); + assert_equals(data.data[1], 0, "Should have no green"); + assert_equals(data.data[2], 0, "Should have no blue"); + assert_equals(data.data[3], 255, "Should have no translucency"); + })); +</script> |