1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
8 * All functions on Directory that accept DOMString arguments for file or
9 * directory names only allow relative path to current directory itself. The
10 * path should be a descendent path like "path/to/file.txt" and not contain a
11 * segment of ".." or ".". So the paths aren't allowed to walk up the directory
12 * tree. For example, paths like "../foo", "..", "/foo/bar" or "foo/../bar" are
15 * http://w3c.github.io/filesystem-api/#idl-def-Directory
16 * https://microsoftedge.github.io/directory-upload/proposal.html#directory-interface
19 // This chromeConstructor is used by the MockFilePicker for testing only.
20 [ChromeConstructor(DOMString path),
21 Exposed=(Window,Worker)]
24 * The leaf name of the directory.
27 readonly attribute DOMString name;
30 [Exposed=(Window,Worker)]
31 partial interface Directory {
32 // Already defined in the main interface declaration:
33 //readonly attribute DOMString name;
36 * The path of the Directory (includes both its basename and leafname).
37 * The path begins with the name of the ancestor Directory that was
38 * originally exposed to content (say via a directory picker) and traversed
39 * to obtain this Directory. Full filesystem paths are not exposed to
40 * unprivilaged content.
43 readonly attribute DOMString path;
46 * Getter for the immediate children of this directory.
49 Promise<sequence<(File or Directory)>> getFilesAndDirectories();
52 Promise<sequence<File>> getFiles(optional boolean recursiveFlag = false);