tor-browser

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

test_bug1317725.html (1254B)


      1 <!--
      2  Any copyright is dedicated to the Public Domain.
      3  http://creativecommons.org/publicdomain/zero/1.0/
      4 -->
      5 <!DOCTYPE HTML>
      6 <html>
      7 <head>
      8  <title>Test for bug 1317725</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     11 </head>
     12 <body>
     13 
     14 <input type="file" id="file" />
     15 
     16 <script class="testbody" type="text/javascript">
     17 
     18 SimpleTest.waitForExplicitFinish();
     19 
     20 var url = SimpleTest.getTestFileURL("script_createFile.js");
     21 script = SpecialPowers.loadChromeScript(url);
     22 
     23 function onOpened(message) {
     24  var input = document.getElementById('file');
     25  SpecialPowers.wrap(input).mozSetFileArray([message.data]);
     26 
     27  var worker = new Worker("test_bug1317725.js");
     28  worker.onerror = function(e) {
     29    ok(false, "We should not see any error.");
     30    SimpleTest.finish();
     31  }
     32 
     33  worker.onmessage = function(e) {
     34    ok(e.data, "Everything seems OK on the worker-side.");
     35    SimpleTest.finish();
     36  }
     37 
     38  is(input.files.length, 1, "We have something");
     39  ok(input.files[0] instanceof Blob, "We have one Blob");
     40  worker.postMessage(input.files[0]);
     41 }
     42 
     43 script.addMessageListener("file.opened", onOpened);
     44 script.sendAsyncMessage("file.open");
     45 
     46 </script>
     47 </pre>
     48 </body>
     49 </html>