test_bug444722.html (1404B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=444722 5 --> 6 <head> 7 <title>Test for Bug 444722</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 10 </head> 11 <body> 12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=444722">Mozilla Bug 444722</a> 13 <p id="display"></p> 14 <div id="content" style="display: none"> 15 16 </div> 17 <pre id="test"> 18 <script class="testbody" type="text/javascript"> 19 20 /** Test for Bug 444722 */ 21 var counter = 0; 22 var testCount = 0; 23 var xhrs = new Array(); 24 25 function loadHandler() { 26 ++counter; 27 ok(true, "load handler should have been called."); 28 if (counter == testCount) { 29 SimpleTest.finish(); 30 } 31 } 32 33 function testXHR(method, hasData, data) { 34 ++testCount; 35 var xhr = new XMLHttpRequest(); 36 xhr.open(method, "file_XHR_pass1.xml"); 37 xhr.onload = loadHandler; 38 try { 39 if (hasData) { 40 xhr.send(data); 41 } else { 42 xhr.send(); 43 } 44 } catch(ex) { 45 --testCount; 46 ok(false, "Calling XMLHttpRequest.send failed: " + ex); 47 } 48 // Keep XHR alive. 49 xhrs.push(xhr); 50 } 51 52 SimpleTest.waitForExplicitFinish(); 53 54 testXHR("GET", false, null); 55 testXHR("GET", true, null); 56 testXHR("GET", true, "some data"); 57 58 testXHR("POST", false, null); 59 testXHR("POST", true, null); 60 testXHR("POST", true, "some data"); 61 </script> 62 </pre> 63 </body> 64 </html>