Bug 880661 - Corrected check for default handler existence. Added check for download's mimeinfo not nullness. r=margaret;
authorFederico Paolinelli <fedepaol@gmail.com>
Mon, 17 Jun 2013 13:06:53 -0400
changeset 146799 6f5a5f22d61d96cf5f1e0cc9dd135e0d2e779be7
parent 146798 8b4b7306f981ee04ddf0c109ad2c945d0bf32df1
child 146800 43ef3d954e3d6c6fae3059d54db28305513fb340
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs880661
milestone24.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 880661 - Corrected check for default handler existence. Added check for download's mimeinfo not nullness. r=margaret;
mobile/android/chrome/content/downloads.js
--- a/mobile/android/chrome/content/downloads.js
+++ b/mobile/android/chrome/content/downloads.js
@@ -192,21 +192,24 @@ AlertDownloadProgressListener.prototype 
         progressListener.onCancel(notificationName);
 
         if (aDownload.isPrivate) {
           let index = this._privateDownloads.indexOf(aDownload);
           if (index != -1) {
             this._privateDownloads.splice(index, 1);
           }
         }
+        // Checking existance of MimeInfo and if there is at least one application handler in addition
+        // to default one.
+        let existsAvailableHandler = (aDownload.MIMEInfo && aDownload.MIMEInfo.possibleApplicationHandlers.length > 1);
 
         // We want to show the download finished notification only if it is not automatically opened.
         // A download is automatically opened if it has a default handler and fennec is in foreground.
         if (state == Ci.nsIDownloadManager.DOWNLOAD_FINISHED &&
-            !(aDownload.MIMEInfo.hasDefaultHandler && Downloads.isForeground)) {
+            !(existsAvailableHandler && Downloads.isForeground)) {
           Downloads.showAlert(aDownload, Strings.browser.GetStringFromName("alertDownloadsDone2"),
                               aDownload.displayName);
         }
         break;
       }
     }
   },