-
Notifications
You must be signed in to change notification settings - Fork 3k
/
filereader_error.html
46 lines (38 loc) · 1.41 KB
/
filereader_error.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>FileAPI Test: filereader_abort</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="http://www.w3.org/TR/FileAPI/#dfn-domerror">
<link rel="help" href="http://www.w3.org/TR/FileAPI/#abort">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
<script>
var blob = new Blob(["TEST THE ERROR ATTRIBUTE AND ERROR EVENT"]);
var reader = new FileReader();
var load = false;
setup({explicit_done: true});
test(function() {
assert_equals(reader.error, null, "The error is null when no error occurred");
}, "Check if the error attribute is null when no error occurred");
on_event(reader, "load", function(evt) {
load = true;
});
on_event(reader, "loadend", function(evt) {
test(function() {
assert_equals(reader.result, null, "The result is null");
}, "Check if the result is null when error occurred");
test(function() {
assert_false(load, "The load event not occurred");
}, "Check if the load event not occurred when reads failed");
done();
});
reader.readAsText(blob);
reader.abort();
</script>
</body>
</html>