gecko-dev/content/base/test/test_bug445225.html

70 строки
1.7 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=445225
-->
<head>
<title>Test for Bug 445225</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=445225">Mozilla Bug 445225</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 445225 **/
var xhr = null;
function runTest() {
xhr = new XMLHttpRequest();
xhr.multipart = true;
xhr.upload.onprogress =
function(evt) {
ok(false, ".upload shouldn't get any progress events!");
}
xhr.onload = function(evt) { setTimeout(runTest2, 0); }
xhr.open("GET", "file_bug445225_multipart.txt");
xhr.send();
}
var uploadGotLoad = false;
function runTest2() {
xhr = new XMLHttpRequest();
xhr.multipart = true;
xhr.upload.onload =
function(evt) {
uploadGotLoad = true;
}
xhr.onprogress =
function(evt) {
ok(uploadGotLoad,
"XHR shouldn't get any progress events before load event is dispatched to .upload");
}
xhr.onload =
function(evt) {
ok(uploadGotLoad, ".upload should have got load event.");
SimpleTest.finish();
}
xhr.open("POST", "file_bug445225_multipart.txt");
// Send some huge string.
xhr.send(new Array(100).join('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'));
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(runTest);
</script>
</pre>
</body>
</html>