tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

Directory.webidl (1909B)


      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/.
      5 */
      6 
      7 /*
      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
     13 * not allowed.
     14 *
     15 * http://w3c.github.io/filesystem-api/#idl-def-Directory
     16 * https://microsoftedge.github.io/directory-upload/proposal.html#directory-interface
     17 */
     18 
     19 [Exposed=(Window,Worker)]
     20 interface Directory {
     21  // This ChromeOnly constructor is used by the MockFilePicker for testing only.
     22  [Throws, ChromeOnly]
     23  constructor(DOMString path);
     24 
     25  /*
     26   * The leaf name of the directory.
     27   */
     28  [Throws]
     29  readonly attribute DOMString name;
     30 };
     31 
     32 [Exposed=(Window,Worker)]
     33 partial interface Directory {
     34  // Already defined in the main interface declaration:
     35  //readonly attribute DOMString name;
     36 
     37  /*
     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.
     43   */
     44  [Throws]
     45  readonly attribute DOMString path;
     46 
     47  /*
     48   * Getter for the immediate children of this directory.
     49   */
     50  [NewObject]
     51  Promise<sequence<(File or Directory)>> getFilesAndDirectories();
     52 
     53  [NewObject]
     54  Promise<sequence<File>> getFiles(optional boolean recursiveFlag = false);
     55 };