diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/filesystem/compat/tests/test_no_dnd.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/filesystem/compat/tests/test_no_dnd.html')
-rw-r--r-- | dom/filesystem/compat/tests/test_no_dnd.html | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/dom/filesystem/compat/tests/test_no_dnd.html b/dom/filesystem/compat/tests/test_no_dnd.html new file mode 100644 index 0000000000..c49dd5d40f --- /dev/null +++ b/dom/filesystem/compat/tests/test_no_dnd.html @@ -0,0 +1,84 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test for Blink FileSystem API - no DND == no webkitEntries</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> + +<body> +<script type="application/javascript"> +var fileEntry; +var directoryEntry; +var script; +var entries; + +function setup_tests() { + SpecialPowers.pushPrefEnv({"set": [["dom.webkitBlink.dirPicker.enabled", true], + ["dom.filesystem.pathcheck.disabled", true], + ["dom.webkitBlink.filesystem.enabled", true]]}, next); +} + +function populate_entries() { + entries = document.createElement("input"); + entries.setAttribute("type", "file"); + document.body.appendChild(entries); + + var url = SimpleTest.getTestFileURL("script_entries.js"); + script = SpecialPowers.loadChromeScript(url); + + function onOpened(message) { + for (var i = 0 ; i < message.data.length; ++i) { + if (message.data[i] instanceof File) { + SpecialPowers.wrap(entries).mozSetFileArray([message.data[i]]); + next(); + } + } + } + + script.addMessageListener("entries.opened", onOpened); + script.sendAsyncMessage("entries.open"); +} + +function test_entries() { + ok("webkitEntries" in entries, "HTMLInputElement.webkitEntries"); + is(entries.webkitEntries.length, 0, "HTMLInputElement.webkitEntries.length == 0"); + is(entries.files.length, 1, "HTMLInputElement.files is still populated"); + + next(); +} + +function cleanUpTestingFiles() { + script.addMessageListener("entries.deleted", function onDeleted() { + script.removeMessageListener("entries.deleted"); + script.destroy(); + next(); + }); + + script.sendAsyncMessage("entries.delete"); +} + +var tests = [ + setup_tests, + populate_entries, + + test_entries, + + cleanUpTestingFiles, +]; + +function next() { + if (!tests.length) { + SimpleTest.finish(); + return; + } + + var test = tests.shift(); + test(); +} + +SimpleTest.waitForExplicitFinish(); +next(); +</script> +</body> +</html> |