diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/preload/onerror-event.html | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/preload/onerror-event.html')
-rw-r--r-- | testing/web-platform/tests/preload/onerror-event.html | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/testing/web-platform/tests/preload/onerror-event.html b/testing/web-platform/tests/preload/onerror-event.html new file mode 100644 index 0000000000..1d2ebefc65 --- /dev/null +++ b/testing/web-platform/tests/preload/onerror-event.html @@ -0,0 +1,65 @@ +<!DOCTYPE html> +<html> +<title>Makes sure that preloaded resources trigger the onerror event</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/preload/resources/preload_helper.js"></script> +<script> + var scriptFailed = false; + var styleFailed = false; + var imageFailed = false; + var fontFailed = false; + var videoFailed = false; + var audioFailed = false; + var trackFailed = false; + var gibberishFailed = false; + var fetchFailed = false; +</script> +<link rel=preload href="non-existent/dummy.js" as=script onerror="scriptFailed = true;"> +<link rel=preload href="non-existent/dummy.css" as=style onerror="styleFailed = true;"> +<link rel=preload href="non-existent/square.png" as=image onerror="imageFailed = true;"> +<link rel=preload href="non-existent/Ahem.ttf" as=font crossorigin onerror="fontFailed = true;"> +<link rel=preload href="non-existent/test.mp4" as=video onerror="videoFailed = true;"> +<link rel=preload href="non-existent/test.oga" as=audio onerror="audioFailed = true;"> +<link rel=preload href="non-existent/security/captions.vtt" as=track onerror="trackFailed = true;"> +<link rel=preload href="non-existent/dummy.xml?fetch" as=fetch onerror="fetchFailed = true;"> +<link rel=preload href="non-existent/dummy.xml?foo" as=foobarxmlthing onerror="assert_unreached('invalid as value should not fire error event')"> +<link rel=preload href="non-existent/dummy.xml?empty" onerror="assert_unreached('empty as value should not fire error event')"> +<link rel=preload href="non-existent/dummy.xml?media" as=style media=print onerror="assert_unreached('non-matching media should not fire error event')"> +<link rel=preload href="non-existent/dummy.xml?media" as=style type='text/html' onerror="assert_unreached('invalid mime type should not fire error event')"> +<body> +<script> + setup({single_test: true}); + + var iterations = 0; + + function check_finished() { + if (styleFailed && scriptFailed && imageFailed && fontFailed && videoFailed && audioFailed && + trackFailed && fetchFailed) { + done(); + } + iterations++; + if (iterations == 10) { + // At least one is expected to fail, but this should give details to the exact failure(s). + assert_true(styleFailed, "style triggered error event"); + assert_true(scriptFailed, "script triggered error event"); + assert_true(imageFailed, "image triggered error event"); + assert_true(fontFailed, "font triggered error event"); + assert_true(videoFailed, "video triggered error event"); + assert_true(audioFailed, "audio triggered error event"); + assert_true(trackFailed, "track triggered error event"); + assert_true(fetchFailed, "fetch as triggered error event"); + done(); + } else { + step_timeout(check_finished, 500); + } + } + + window.addEventListener("load", function() { + verifyPreloadAndRTSupport(); + step_timeout(check_finished, 500); + }); +</script> +</body> +</html> |