1<html>
2<head>
3<title>Test case for bug 36156</title>
4</head>
5<body>
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>
9<p id=console></p>
10<script type="text/javascript">
11if (window.layoutTestController) {
12 layoutTestController.dumpAsText();
13 layoutTestController.waitUntilDone();
14}
15
16function log(message)
17{
18 document.getElementById('console').appendChild(document.createTextNode(message + '\n'));
19}
20
21function test()
22{
23 var xhr = new XMLHttpRequest();
24 xhr.open("GET", "resources/chunked-transfer.php", true);
25 xhr.onprogress = function(e) {
26 console.log(e.loaded + ", " + e.total + ", " + e.lengthComputable);
27 if (e.loaded == 4 && e.total == 0 && !e.lengthComputable)
28 {
29 log("PASS");
30 if (window.layoutTestController)
31 layoutTestController.notifyDone();
32 }
33 }
34 xhr.send();
35}
36
37test();
38</script>
39</body>