Bug 1892041 - Part 1: Update test262 features. r=spidermonkey-reviewers,dminor
[gecko.git] / dom / base / test / test_bug444722.html
blob84a7873d1885adda3b63bfcb3eda1d74d6c35e41
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">
16 </div>
17 <pre id="test">
18 <script class="testbody" type="text/javascript">
20 /** Test for Bug 444722 **/
21 var counter = 0;
22 var testCount = 0;
23 var xhrs = new Array();
25 function loadHandler() {
26 ++counter;
27 ok(true, "load handler should have been called.");
28 if (counter == testCount) {
29 SimpleTest.finish();
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();
44 } catch(ex) {
45 --testCount;
46 ok(false, "Calling XMLHttpRequest.send failed: " + ex);
48 // Keep XHR alive.
49 xhrs.push(xhr);
52 SimpleTest.waitForExplicitFinish();
54 testXHR("GET", false, null);
55 testXHR("GET", true, null);
56 testXHR("GET", true, "some data");
58 testXHR("POST", false, null);
59 testXHR("POST", true, null);
60 testXHR("POST", true, "some data");
61 </script>
62 </pre>
63 </body>
64 </html>