test_fakepath.html (1104B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Test for Fakepath in HTMLInputElement</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="file" type="file"></input> 11 <input id="file_wd" type="file" webkitdirectory></input> 12 <script type="application/javascript"> 13 14 var url = SimpleTest.getTestFileURL("script_fakepath.js"); 15 script = SpecialPowers.loadChromeScript(url); 16 17 function onOpened(message) { 18 var e = document.getElementById("file"); 19 SpecialPowers.wrap(e).mozSetDndFilesAndDirectories(message.data); 20 ok(e.value, "C:\\fakepath\\prefs.js"); 21 22 e = document.getElementById("file_wd"); 23 SpecialPowers.wrap(e).mozSetDndFilesAndDirectories(message.data); 24 ok(e.value, "C:\\fakepath\\prefs.js"); 25 26 SimpleTest.finish(); 27 } 28 29 function run() { 30 script.addMessageListener("file.opened", onOpened); 31 script.sendAsyncMessage("file.open"); 32 } 33 34 SpecialPowers.pushPrefEnv({"set": [["dom.webkitBlink.dirPicker.enabled", true]]}, run); 35 36 SimpleTest.waitForExplicitFinish(); 37 38 </script> 39 </body> 40 </html>