| <!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> |