diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /dom/media/webvtt/test/mochitest/test_testtrack_cors_no_response.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/webvtt/test/mochitest/test_testtrack_cors_no_response.html')
-rw-r--r-- | dom/media/webvtt/test/mochitest/test_testtrack_cors_no_response.html | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/dom/media/webvtt/test/mochitest/test_testtrack_cors_no_response.html b/dom/media/webvtt/test/mochitest/test_testtrack_cors_no_response.html new file mode 100644 index 0000000000..e047f74eb3 --- /dev/null +++ b/dom/media/webvtt/test/mochitest/test_testtrack_cors_no_response.html @@ -0,0 +1,41 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Should not load CORS vtt file when server doesn't respond with correct CORS header</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <script type="text/javascript" src="manifest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +</head> +<body> +<video preload="none" crossorigin="anonymous"> + <track src="http://example.com/tests/dom/canvas/test/crossorigin/video.sjs?name=tests/dom/media/webvtt/test/mochitest/basic.vtt&type=text/vtt" kind="subtitles" id="default" default> +</video> +<script type="text/javascript"> +/** + * This test is used to ensure that we shouldn't load CORS resource if server + * doesn't respond with correct CORS header. In this situation, loading should + * be expected to fail. + */ +async function runTest() { + await waitUntiTrackLoadError(); + SimpleTest.finish(); +} + +SimpleTest.waitForExplicitFinish(); +runTest(); + +/** + * The following are test helper functions. + */ +async function waitUntiTrackLoadError() { + const trackElement = document.getElementById("default"); + if (trackElement.readyState != 3) { + info(`wait until receiving error event`); + await once(trackElement, "error"); + } + is(trackElement.readyState, 3, "Track::ReadyState should be set to ERROR."); + is(trackElement.track.cues.length, 0, "Cue list length should be 0."); +} +</script> +</body> +</html> |