tor-browser

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

test_bug578096.html (1347B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=578096
      5 -->
      6 <head>
      7  <title>Test for Bug 578096</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=578096">Mozilla Bug 578096</a>
     13 <p id="display"></p>
     14 <div id="content">
     15   <input type="file" id="file" onchange="fireXHR()">
     16 </div>
     17 <pre id="test">
     18 <script class="testbody" type="text/javascript">
     19 SimpleTest.waitForExplicitFinish();
     20 
     21 var url = SimpleTest.getTestFileURL("bug578096LoadChromeScript.js");
     22 var script = SpecialPowers.loadChromeScript(url);
     23 
     24 script.addMessageListener("file.created", function (message) {
     25  SpecialPowers.wrap(document.getElementById('file')).mozSetFileArray([message]);
     26 
     27  var xhr = new XMLHttpRequest();
     28  xhr.onreadystatechange = function(event) {
     29    if (xhr.readyState == 4) {
     30      script.sendAsyncMessage("file.remove", {});
     31    }
     32  }
     33 
     34  xhr.open('POST', window.location, true);
     35  xhr.send(document.getElementById('file').files[0]);
     36 });
     37 
     38 script.addMessageListener("file.removed", function (message) {
     39  ok(true, "We didn't throw! Yay!");
     40  script.destroy();
     41  SimpleTest.finish();
     42 });
     43 
     44 script.sendAsyncMessage("file.create", {});
     45 </script>
     46 </pre>
     47 </body>
     48 </html>