| <title>Test case for bug 120828 (abort case)</title> |
| <p>Test case for <a href="https://bugs.webkit.org/show_bug.cgi?id=120828"> bug 120828</a>: Correctly set XHR loadend attributes (loaded and total).</p> |
| <p>Verify that abort and loadend events have their ProgressEvent attributes (loaded, total and lengthComputable) correctly set.</p> |
| <script type="text/javascript"> |
| testRunner.waitUntilDone(); |
| function onProgressEvent(e) |
| if (total != e.total || loaded != e.loaded) |
| fail("Event " + e.type + "total/loaded values not matching: " |
| + "(" + e.loaded + " / " + e.total + "), expected (" + loaded + " / " + total + ")"); |
| function onUnexpectedProgressEvent(e) |
| fail("unexpected ProgressEvent: " + e.type); |
| status = "FAILED: " + msg; |
| var req = new XMLHttpRequest(); |
| req.onprogress = function(e){ |
| req.onerror = onUnexpectedProgressEvent; |
| req.onabort = onProgressEvent; |
| req.onloadend = function(e) { |
| req.open("GET", "resources/download-with-delay.php?iteration=" + iteration + "&delay=" + delay, true); |
| var consoleElt = document.getElementById("console"); |
| consoleElt.innerHTML += message + "<br/>"; |