tor-browser

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

test_bug1319088.html (1403B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Test for bug 1319088</title>
      5  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      7 </head>
      8 
      9 <body>
     10 <input id="input" type="file"></input>
     11 
     12 <script type="application/javascript">
     13 
     14 function testSetup() {
     15  SpecialPowers.pushPrefEnv({"set": [["dom.webkitBlink.dirPicker.enabled", true]]}, next);
     16 }
     17 
     18 function populateInputFile() {
     19  var url = SimpleTest.getTestFileURL("script_fileList.js");
     20  var script = SpecialPowers.loadChromeScript(url);
     21 
     22  function onOpened(message) {
     23    var input = document.getElementById("input");
     24    SpecialPowers.wrap(input).mozSetFileArray([message.file]);
     25 
     26    script.destroy();
     27    next();
     28  }
     29 
     30  script.addMessageListener("file.opened", onOpened);
     31  script.sendAsyncMessage("file.open");
     32 }
     33 
     34 function checkBug() {
     35  var input = document.getElementById("input");
     36  is(input.files[0].webkitRelativePath, "", "No relative path!");
     37 
     38  let form = document.createElement("form");
     39  form.appendChild(input);
     40 
     41  is(input.files[0].webkitRelativePath, "", "No relative path!");
     42  SimpleTest.finish();
     43 }
     44 
     45 var tests = [
     46  testSetup,
     47  populateInputFile,
     48  checkBug,
     49 ];
     50 
     51 function next() {
     52  if (!tests.length) {
     53    SimpleTest.finish();
     54    return;
     55  }
     56 
     57  var test = tests.shift();
     58  test();
     59 }
     60 
     61 SimpleTest.waitForExplicitFinish();
     62 next();
     63 </script>
     64 </body>
     65 </html>