OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <title>Test case for bug 36156</title> | 3 <title>Test case for bug 36156</title> |
4 </head> | 4 </head> |
5 <body> | 5 <body> |
6 <p> Test case for <a href="https://bugs.webkit.org/show_bug.cgi?id=36156"> bug 3
6156</a>: XHR 'progress' event code assumes wrongly that expectedLength >= 0</p> | 6 <p> Test case for <a href="https://bugs.webkit.org/show_bug.cgi?id=36156"> bug 3
6156</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> | 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> | 8 <p>PASS should appear below:</p> |
9 <p id=console></p> | 9 <p id=console></p> |
10 <script type="text/javascript"> | 10 <script type="text/javascript"> |
(...skipping 15 matching lines...) Expand all Loading... |
26 xhr.onprogress = function(e) { | 26 xhr.onprogress = function(e) { |
27 if (xhr.readyState != xhr.LOADING) { | 27 if (xhr.readyState != xhr.LOADING) { |
28 // As this test ends when a readystatechange event arrives with | 28 // As this test ends when a readystatechange event arrives with |
29 // readyState == DONE, a "progress" event cannot arrive when | 29 // readyState == DONE, a "progress" event cannot arrive when |
30 // readyState == DONE. | 30 // readyState == DONE. |
31 log("FAIL: xhr.readyState must be LOADING when a progress event arri
ves, but is " + xhr.readyState); | 31 log("FAIL: xhr.readyState must be LOADING when a progress event arri
ves, but is " + xhr.readyState); |
32 } | 32 } |
33 if (e.loaded == 4 && e.total == 0 && !e.lengthComputable) | 33 if (e.loaded == 4 && e.total == 0 && !e.lengthComputable) |
34 log("PASS"); | 34 log("PASS"); |
35 else if (e.total != 0 && !e.lengthComputable) | 35 else if (e.total != 0 && !e.lengthComputable) |
36 log("FAIL: XMLHttpRequestProgressEvent lengthComputable=false but to
tal is non-zero: " + e.total); | 36 log("FAIL: ProgressEvent lengthComputable=false but total is non-zer
o: " + e.total); |
37 } | 37 } |
38 | 38 |
39 xhr.onreadystatechange = function(e) { | 39 xhr.onreadystatechange = function(e) { |
40 if (xhr.readyState == xhr.DONE) | 40 if (xhr.readyState == xhr.DONE) |
41 { | 41 { |
42 if (window.testRunner) | 42 if (window.testRunner) |
43 testRunner.notifyDone(); | 43 testRunner.notifyDone(); |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 xhr.send(); | 47 xhr.send(); |
48 } | 48 } |
49 | 49 |
50 test(); | 50 test(); |
51 </script> | 51 </script> |
52 </body> | 52 </body> |
OLD | NEW |