3 <p> Verify that XMLHttpRequest.open resets received size.
</p>
4 <p> You should see PASSED once.
</p>
6 <script type=
"text/javascript">
7 var resourceSize
= 1461754;
12 document
.body
.appendChild(document
.createTextNode(msg
));
13 document
.body
.appendChild(document
.createElement("br"));
16 function onProgress(e
) {
17 if (e
.position
>= resourceSize
/ 4) {
18 // We want to restart the XMLHttpRequest to see if the count is updated
20 xhr
.onprogress
= onProgressTest
;
21 xhr
.onreadystatechange
= onReadyStateChange
;
22 xhr
.open("GET", "resources/big-response.php", true);
27 function onProgressTest(e
) {
28 lastPosition
= e
.position
;
31 function onReadyStateChange() {
32 if (req
.readyState
== 4) {
33 // Compare last position with the known resource size.
34 log((lastPosition
== resourceSize
) ? "PASSED" : ("FAILED: expected " + resourceSize
+ ", actual " + lastPosition
));
35 if (window
.testRunner
)
36 testRunner
.notifyDone();
40 if (window
.testRunner
) {
41 testRunner
.dumpAsText();
42 testRunner
.waitUntilDone();
45 var req
= new XMLHttpRequest();
46 req
.onprogress
= onProgress
;
47 req
.open("GET", "resources/big-response.php", true);