blob: 3fe5ab3001bed0b66e063e8cd1c7c81d45f0a22b [file] [log] [blame]
<html>
<body>
<p>This test that progress events are fired for XMLHttpRequestUpload objects in the correct order, loadstart, progress, load.</p>
<pre id='console'></pre>
<script type="text/javascript">
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function log(message)
{
document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
}
var xhr;
function progressHandler(evt)
{
log("PASS: onprogress event fired on XMLHttpRequestUpload: " + evt + " [Loaded: " + evt.loaded + " Total: " + evt.total + "]");
}
function loadstartHandler(evt)
{
log("PASS: loadstart event fired on XMLHttpRequestUpload: " + evt);
}
function loadHandler(evt)
{
log("PASS: load event fired on XMLHttpRequestUpload: " + evt);
}
function readystatechangeHandler(evt)
{
if (xhr.readyState == xhr.DONE) {
if (window.testRunner)
testRunner.notifyDone();
}
}
xhr = new XMLHttpRequest;
xhr.upload.onprogress = progressHandler;
xhr.upload.onloadstart = loadstartHandler;
xhr.upload.onload = loadHandler;
xhr.onreadystatechange = readystatechangeHandler;
xhr.open("POST", "resources/post-echo.cgi", true);
xhr.send("data");
</script>
</body>
</html>