B2G/gecko/browser/components/downloads/src/DownloadsCommon.jsm
/**
   * Returns the nsILocalFile for the download target.
   *
   * @throws if the native path is not valid.  This can happen if the same
   *         profile is used on different platforms, for example if a native
   *         Windows path is stored and then the item is accessed on a Mac.
   */
Returns the nsILocalFile for the download target.
@throws if the native path is not valid.  This can happen if the same
profile is used on different platforms, for example if a native
Windows path is stored and then the item is accessed on a Mac.
Returns the nsILocalFile for the download target . @throws if the native path is not valid . This can happen if the same profile is used on different platforms for example if a native Windows path is stored and then the item is accessed on a Mac .
get localFile()
  {
    if (this.file.startsWith("file:")) {
      let fileUrl = NetUtil.newURI(this.file).QueryInterface(Ci.nsIFileURL);
      return fileUrl.file.clone().QueryInterface(Ci.nsILocalFile);
    } else {
      return new DownloadsLocalFileCtor(this.file);
    }
  }
get localFile ( ) { if ( this . file . startsWith ( "file:" ) ) { let fileUrl = NetUtil . newURI ( this . file ) . QueryInterface ( Ci . nsIFileURL ) ; return fileUrl . file . clone ( ) . QueryInterface ( Ci . nsILocalFile ) ; } else { return new DownloadsLocalFileCtor ( this . file ) ; } }
Returns the nsILocalFile for the download target.
Returns the nsILocalFile for the download target .
// The download database may contain targets stored as file URLs or native // paths.  This can still be true for previously stored items, even if new // items are stored using their file URL.  See also bug 239948 comment 12. // Assume the file URL we obtained from the downloads database or from the // "spec" property of the target has the UTF-8 charset. // The downloads database contains a native path.  Try to create a local // file, though this may throw an exception if the path is invalid.