Bug 919076 - Change Downloads.jsm createNiceUnique to create files with mode 644. r=paolo, a=lsblakk
authorMonica Chew <mmc@mozilla.com>
Thu, 16 Jan 2014 08:57:17 -0800
changeset 167946 a8f56ea824c9a60c212b18d4e836d4858beff720
parent 167945 ca8ea758fb17a0e0b9be1e36bcd89a02217f3e17
child 167947 3108eef9574678bb012b532a6a9e73c3faf4b481
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaolo, lsblakk
bugs919076
milestone27.0
Bug 919076 - Change Downloads.jsm createNiceUnique to create files with mode 644. r=paolo, a=lsblakk
toolkit/mozapps/downloads/DownloadPaths.jsm
--- a/toolkit/mozapps/downloads/DownloadPaths.jsm
+++ b/toolkit/mozapps/downloads/DownloadPaths.jsm
@@ -36,34 +36,34 @@ this.DownloadPaths = {
    * NS_ERROR_FILE_TOO_BIG. Other exceptions, like NS_ERROR_FILE_ACCESS_DENIED,
    * can also be expected.
    *
    * @param aTemplateFile
    *        nsILocalFile whose leaf name is going to be used as a template. The
    *        provided object is not modified.
    * @returns A new instance of an nsILocalFile object pointing to the newly
    *          created empty file. On platforms that support permission bits, the
-   *          file is created with permissions 600.
+   *          file is created with permissions 644.
    */
   createNiceUniqueFile: function DP_createNiceUniqueFile(aTemplateFile) {
     // Work on a clone of the provided template file object.
     var curFile = aTemplateFile.clone().QueryInterface(Ci.nsILocalFile);
     var [base, ext] = DownloadPaths.splitBaseNameAndExtension(curFile.leafName);
     // Try other file names, for example "base(1).txt" or "base(1).tar.gz",
     // only if the file name initially set already exists.
     for (let i = 1; i < 10000 && curFile.exists(); i++) {
       curFile.leafName = base + "(" + i + ")" + ext;
     }
     // At this point we hand off control to createUnique, which will create the
     // file with the name we chose, if it is valid. If not, createUnique will
     // attempt to modify it again, for example it will shorten very long names
     // that can't be created on some platforms, and for which a normal call to
     // nsIFile.create would result in NS_ERROR_FILE_NOT_FOUND. This can result
     // very rarely in strange names like "base(9999).tar-1.gz" or "ba-1.gz".
-    curFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0600);
+    curFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0644);
     return curFile;
   },
 
   /**
    * Separates the base name from the extension in a file name, recognizing some
    *  double extensions like ".tar.gz".
    *
    * @param aLeafName