Bug 1114637 - Don't display "Unix error 1 during operation setPermissions" when a download terminates on Firefox for Android. r=paolo
authorGanesh Sahukari <sahukariganesh2@gmail.com>
Wed, 14 Jan 2015 21:06:00 +0000
changeset 224324 0f3b187814d7df01b8155ac8ee14fdd2ab87a6bf
parent 224323 def4cd55d1f99ff281d5e4fdc732b49df6cf6df5
child 224325 a9240b1eb2fb0096c82d9c0874096a228f7e707c
push id54190
push userkwierso@gmail.com
push dateSat, 17 Jan 2015 02:06:29 +0000
treeherdermozilla-inbound@369a8f14ccf8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaolo
bugs1114637
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1114637 - Don't display "Unix error 1 during operation setPermissions" when a download terminates on Firefox for Android. r=paolo
toolkit/components/jsdownloads/src/DownloadIntegration.jsm
--- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
+++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
@@ -657,17 +657,22 @@ this.DownloadIntegration = {
         let unixMode = isTemporaryDownload ? 0o400 : 0o666;
         // On Unix, the umask of the process is respected.  This call has no
         // effect on Windows.
         yield OS.File.setPermissions(aDownload.target.path, { unixMode });
       } catch (ex) {
         // We should report errors with making the permissions less restrictive
         // or marking the file as read-only on Unix and Mac, but this should not
         // prevent the download from completing.
-        Cu.reportError(ex);
+        // The setPermissions API error EPERM is expected to occur when working
+        // on a file system that does not support file permissions, like FAT32,
+        // thus we don't report this error.
+        if (!(ex instanceof OS.File.Error) || ex.unixErrno != OS.Constants.libc.EPERM) {
+          Cu.reportError(ex);
+        }
       }
 
       gDownloadPlatform.downloadDone(NetUtil.newURI(aDownload.source.url),
                                      new FileUtils.File(aDownload.target.path),
                                      aDownload.contentType,
                                      aDownload.source.isPrivate);
       this.downloadDoneCalled = true;
     }.bind(this));