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 [Exposed=(Window,Worker)]
21 // This ChromeOnly constructor is used by the MockFilePicker for testing only.
23 constructor(DOMString path);
26 * The leaf name of the directory.
29 readonly attribute DOMString name;
32 [Exposed=(Window,Worker)]
33 partial interface Directory {
34 // Already defined in the main interface declaration:
35 //readonly attribute DOMString name;
38 * The path of the Directory (includes both its basename and leafname).
39 * The path begins with the name of the ancestor Directory that was
40 * originally exposed to content (say via a directory picker) and traversed
41 * to obtain this Directory. Full filesystem paths are not exposed to
42 * unprivilaged content.
45 readonly attribute DOMString path;
48 * Getter for the immediate children of this directory.
51 Promise<sequence<(File or Directory)>> getFilesAndDirectories();
54 Promise<sequence<File>> getFiles(optional boolean recursiveFlag = false);