3 <title>Test case for bug
36156</title>
6 <p> Test case for
<a href=
"https://bugs.webkit.org/show_bug.cgi?id=36156"> bug
36156</a>: XHR 'progress' event code assumes wrongly that expectedLength
>=
0</p>
7 <p> Verify that the progress event total property is
0 when the expected overall length can't be computed.
<p>
8 <p>PASS should appear below:
</p>
10 <script type=
"text/javascript">
11 if (window
.testRunner
) {
12 testRunner
.dumpAsText();
13 testRunner
.waitUntilDone();
18 document
.getElementById('console').appendChild(document
.createTextNode(message
+ '\n'));
23 var xhr
= new XMLHttpRequest();
24 xhr
.open("GET", "resources/chunked-transfer.php", true);
26 xhr
.onprogress = function(e
) {
27 if (xhr
.readyState
!= xhr
.LOADING
) {
28 // As this test ends when a readystatechange event arrives with
29 // readyState == DONE, a "progress" event cannot arrive when
30 // readyState == DONE.
31 log("FAIL: xhr.readyState must be LOADING when a progress event arrives, but is " + xhr
.readyState
);
33 if (e
.loaded
== 4 && e
.total
== 0 && !e
.lengthComputable
)
35 else if (e
.total
!= 0 && !e
.lengthComputable
)
36 log("FAIL: XMLHttpRequestProgressEvent lengthComputable=false but total is non-zero: " + e
.total
);
39 xhr
.onreadystatechange = function(e
) {
40 if (xhr
.readyState
== xhr
.DONE
)
42 if (window
.testRunner
)
43 testRunner
.notifyDone();