1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/test/test_bug444722.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,65 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=444722 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 444722</title> 1.11 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.13 +</head> 1.14 +<body> 1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=444722">Mozilla Bug 444722</a> 1.16 +<p id="display"></p> 1.17 +<div id="content" style="display: none"> 1.18 + 1.19 +</div> 1.20 +<pre id="test"> 1.21 +<script class="testbody" type="text/javascript"> 1.22 + 1.23 +/** Test for Bug 444722 **/ 1.24 +var counter = 0; 1.25 +var testCount = 0; 1.26 +var xhrs = new Array(); 1.27 + 1.28 +function loadHandler() { 1.29 + ++counter; 1.30 + ok(true, "load handler should have been called."); 1.31 + if (counter == testCount) { 1.32 + SimpleTest.finish(); 1.33 + } 1.34 +} 1.35 + 1.36 +function testXHR(method, hasData, data) { 1.37 + ++testCount; 1.38 + var xhr = new XMLHttpRequest(); 1.39 + xhr.open(method, "file_XHR_pass1.xml"); 1.40 + xhr.onload = loadHandler; 1.41 + try { 1.42 + if (hasData) { 1.43 + xhr.send(data); 1.44 + } else { 1.45 + xhr.send(); 1.46 + } 1.47 + } catch(ex) { 1.48 + --testCount; 1.49 + ok(false, "Calling XMLHttpRequest.send failed: " + ex); 1.50 + } 1.51 + // Keep XHR alive. 1.52 + xhrs.push(xhr); 1.53 +} 1.54 + 1.55 +SimpleTest.waitForExplicitFinish(); 1.56 + 1.57 +testXHR("GET", false, null); 1.58 +testXHR("GET", true, null); 1.59 +testXHR("GET", true, "some data"); 1.60 + 1.61 +testXHR("POST", false, null); 1.62 +testXHR("POST", true, null); 1.63 +testXHR("POST", true, "some data"); 1.64 +</script> 1.65 +</pre> 1.66 +</body> 1.67 +</html> 1.68 +