content/html/content/test/test_input_files_not_nsIFile.html

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <head>
     4   <title>Test for &lt;input type='file'&gt; handling when its "files" do not implement nsIFile</title>
     5   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     6   <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     7   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     8 </head>
     9 <body>
    11 <div id="content">
    12   <input id='a' type='file'>
    13 </div>
    14 <button id='b' onclick="document.getElementById('a').click();">Show Filepicker</button>
    16 <input type="file" id="file" />
    17 <pre id="test">
    18 <script type="application/javascript">
    20 SimpleTest.waitForExplicitFinish();
    22 var MockFilePicker = SpecialPowers.MockFilePicker;
    23 MockFilePicker.init(window);
    25 SimpleTest.waitForFocus(function() {
    26   MockFilePicker.useBlobFile();
    27   MockFilePicker.returnValue = MockFilePicker.returnOK;
    29   var b = document.getElementById('b');
    30   b.focus(); // Be sure the element is visible.
    32   document.getElementById('a').addEventListener("change", function(aEvent) {
    33     ok(true, "change event correctly sent");
    35     SimpleTest.executeSoon(function() {
    36       MockFilePicker.cleanup();
    37       SimpleTest.finish();
    38     });
    39   }, false);
    41   b.click();
    42 });
    44 </script>
    45 </pre>
    46 </body>
    47 </html>

mercurial