tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug422537.html (1546B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=422537
      5 -->
      6 <head>
      7  <title>Test for bug 422537</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>        
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     10 </head>
     11 
     12 <body>
     13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=422537">Mozilla Bug 422537</a>
     14 <p id="display"></p>
     15 <div id="content" style="display: none">
     16  
     17 </div>
     18 <pre id="test">
     19 <script class="testbody" type="text/javascript">
     20 
     21 /** Test for Bug 422537 */
     22 var isupports_string = SpecialPowers.Cc["@mozilla.org/supports-string;1"]
     23                                    .createInstance(SpecialPowers.Ci.nsISupportsString);
     24 isupports_string.data = "foo";
     25 
     26 const url = "http://mochi.test:8888";
     27 var body = [
     28  document,
     29  "foo",
     30  isupports_string
     31 ];
     32 
     33 for (var i of body) {
     34  var xhr = new XMLHttpRequest();
     35  xhr.open("POST", url, true);
     36  if (i == isupports_string)
     37    SpecialPowers.wrap(xhr).send(i);
     38  else
     39    xhr.send(i);
     40  var chan = SpecialPowers.wrap(xhr).channel;
     41  if (!SpecialPowers.call_Instanceof(chan, SpecialPowers.Ci.nsIUploadChannel))
     42    throw "Must be an upload channel";
     43  var stream = chan.uploadStream;
     44  if (!stream || !SpecialPowers.call_Instanceof(stream, SpecialPowers.Ci.nsISeekableStream))
     45    throw "Stream must be seekable";
     46  // the following is a no-op, but should not throw an exception
     47  stream.seek(SpecialPowers.Ci.nsISeekableStream.NS_SEEK_CUR, 0);
     48 }
     49 
     50 ok(true, "xhr is seekable");
     51 
     52 </script>
     53 </pre>
     54 </body>
     55 </html>