content/base/test/test_bug444722.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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 type="text/javascript" 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();
    30   }
    31 }
    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 }
    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>

mercurial