| <html> |
| <head> |
| <script src="/js-test-resources/js-test.js"></script> |
| <body> |
| |
| <script> |
| description("Test that accessing local file system metadata is not allowed"); |
| |
| function runTest() { |
| if (!window.internals) { |
| alert("This test depends on Internals"); |
| return; |
| } |
| |
| window.jsTestIsAsync = true; |
| |
| let path = location.pathname.split("/"); |
| let filename = path[path.length - 1]; |
| let targetFileName = internals.createTemporaryFile(`${filename}`, ""); |
| let targetDirectory = targetFileName.substring(0, targetFileName.length - filename); |
| |
| let input = document.createElement("input"); |
| input.type = "file"; |
| |
| let file = new File([], targetFileName, {"type":"text/plain"}); |
| let directory = new File([], targetDirectory, {"type":"text/plain"}); |
| |
| dataTransfer = new DataTransfer(); |
| dataTransfer.items.add(file) |
| dataTransfer.items.add(directory) |
| input.files = dataTransfer.files; |
| |
| let resultCount = 0; |
| |
| var functionOnSuccess = function (file) |
| { |
| testFailed("Received file"); |
| if (resultCount == 2) |
| finishJSTest() |
| resultCount++; |
| } |
| |
| var functionOnError = function (value) |
| { |
| testPassed("Should not receive file"); |
| if (resultCount == 2) |
| finishJSTest() |
| resultCount++; |
| } |
| |
| input.webkitEntries.forEach((entry) => { |
| entry.file(functionOnSuccess, functionOnError) |
| entry.getParent(functionOnSuccess, functionOnError) |
| if (entry.isDirectory) |
| entry.createReader().readEntries(functionOnSuccess, functionOnError) |
| }); |
| } |
| |
| runTest(); |
| |
| </script> |
| </body> |
| </html> |