dom/webidl/File.webidl
author Wes Kocher <wkocher@mozilla.com>
Thu, 02 Mar 2017 14:57:21 -0800
changeset 392283 63c4e77cfe90e90d35d85e1a4821015823c4ecee
parent 392275 429ff39f3d28b195fb5ee1467cd8126bab3d89b8
child 392446 e769531b24333372cf6e28c6c495abb069136060
permissions -rw-r--r--
Backed out 2 changesets (bug 1334975, bug 1335539) for merge conflicts a=backout Backed out changeset 429ff39f3d28 (bug 1335539) Backed out changeset eea959a93ce4 (bug 1334975) MozReview-Commit-ID: GlvA0B0vHRT

/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * The origin of this IDL file is
 * https://w3c.github.io/FileAPI/#file
 */

interface nsIFile;

[Constructor(sequence<BlobPart> fileBits,
             USVString fileName, optional FilePropertyBag options),
 Exposed=(Window,Worker)]
interface File : Blob {
  readonly attribute DOMString name;

  [GetterThrows]
  readonly attribute long long lastModified;
};

dictionary FilePropertyBag {
  DOMString type = "";
  long long lastModified;
};

dictionary ChromeFilePropertyBag : FilePropertyBag {
  DOMString name = "";
};

// Mozilla extensions
partial interface File {
  [GetterThrows, Deprecated="FileLastModifiedDate"]
  readonly attribute Date lastModifiedDate;

  [BinaryName="relativePath", Func="mozilla::dom::Directory::WebkitBlinkDirectoryPickerEnabled"]
  readonly attribute USVString webkitRelativePath;

  [GetterThrows, ChromeOnly, NeedsCallerType]
  readonly attribute DOMString mozFullPath;
};

// Mozilla extensions - main-thread only
[Exposed=(Window)]
partial interface File {
  [ChromeOnly, Throws, NeedsCallerType]
  static Promise<File> createFromNsIFile(nsIFile file,
                                         optional ChromeFilePropertyBag options);

  [ChromeOnly, Throws, NeedsCallerType]
  static Promise<File> createFromFileName(USVString fileName,
                                          optional ChromeFilePropertyBag options);
};