blob: 443513e9feeb47afac400d3328cecf8df6f3b36f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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="http://invalid/dummy.js" as=script onerror="scriptFailed = true;">
<link rel=preload href="http://invalid/dummy.css" as=style onerror="styleFailed = true;">
<link rel=preload href="http://invalid/square.png" as=image onerror="imageFailed = true;">
<link rel=preload href="http://invalid/Ahem.ttf" as=font crossorigin onerror="fontFailed = true;">
<link rel=preload href="http://invalid/test.mp4" as=video onerror="videoFailed = true;">
<link rel=preload href="http://invalid/test.oga" as=audio onerror="audioFailed = true;">
<link rel=preload href="http://invalid/security/captions.vtt" as=track onerror="trackFailed = true;">
<link rel=preload href="http://invalid/dummy.xml?fetch" as=fetch onerror="fetchFailed = true;">
<link rel=preload href="http://invalid/dummy.xml?foo" as=foobarxmlthing onerror="assert_unreached('invalid as value should not fire error event')">
<link rel=preload href="http://invalid/dummy.xml?empty" onerror="assert_unreached('empty as value should not fire error event')">
<link rel=preload href="http://invalid/dummy.xml?media" as=style media=print onerror="assert_unreached('non-matching media should not fire error event')">
<link rel=preload href="http://invalid/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>
|