blob: 3d8fa719c36895d14f45b73f8c8a984b7815859a (
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
66
67
|
<!DOCTYPE html>
<html>
<body>
<pre id='console'></pre>
<script src="../../resources/gc.js"></script>
<script>
function log(message)
{
document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
}
function runTest()
{
log("Test that FileReader.abort after reading is done doesn't fire events.");
var text = "Hello";
var reader = new FileReader();
reader.onloadend = function(event) {
fileString = event.target.result;
if (fileString != text)
log("Incorrect data read, expected " + text + ", got " + fileString);
reader.onabort = function() {
log("Received abort event after reading");
};
reader.onload = function() {
log("Received load event after reading");
};
reader.onloadend = function() {
log("Received loadend event after reading");
};
reader.onloadstart = function() {
log("Received load start event after reading");
};
reader.onprogress = function() {
log("Received progress event after reading");
};
reader.abort();
gc();
finishTest();
}
reader.onerror = function(event) {
log("Received error event: " + event.target.error.code);
};
reader.readAsText(new Blob([text]));
}
function finishTest()
{
log("DONE");
if (testRunner.notifyDone)
testRunner.notifyDone();
}
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
window.onload = runTest;
</script>
</body>
</html>
|