Bug 1115972 - Don't fall back to the Places icon for downloads without the target file name annotation. r=mak
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Wed, 14 Jan 2015 17:30:27 +0000
changeset 223824 bfc02c86998dc16c84098a43fada66e2d8f61718
parent 223823 76c43f71b2d7166786c7296c45db567684a85f8c
child 223825 9c9d441e616ec56542db6a5cd2d8f67c6954cec3
push id28109
push userryanvm@gmail.com
push dateWed, 14 Jan 2015 21:31:26 +0000
treeherdermozilla-central@c1f6345f2803 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1115972
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 1115972 - Don't fall back to the Places icon for downloads without the target file name annotation. r=mak
browser/components/downloads/content/allDownloadsViewOverlay.js
--- a/browser/components/downloads/content/allDownloadsViewOverlay.js
+++ b/browser/components/downloads/content/allDownloadsViewOverlay.js
@@ -53,18 +53,17 @@ const NOT_AVAILABLE = Number.MAX_VALUE;
  * The shell doesn't take care of inserting the item, or removing it when it's no longer
  * valid. That's the caller (a DownloadsPlacesView object) responsibility.
  *
  * The caller is also responsible for "passing over" notification from both the
  * download-view and the places-result-observer, in the following manner:
  *  - The DownloadsPlacesView object implements onDataItemStateChanged and
  *    onDataItemChanged of the DownloadsView pseudo interface.
  *  - The DownloadsPlacesView object adds itself as a places result observer and
- *    calls this object's placesNodeIconChanged and placesNodeAnnotationChanged
- *    from its callbacks.
+ *    calls this object's placesNodeAnnotationChanged from its callbacks.
  *
  * @param [optional] aDataItem
  *        The data item of a the session download. Required if aPlacesNode is not set
  * @param [optional] aPlacesNode
  *        The places node for a past download. Required if aDataItem is not set.
  * @param [optional] aAnnotations
  *        Map containing annotations values, to speed up the initial loading.
  */
@@ -170,23 +169,20 @@ DownloadElementShell.prototype = {
 
   _getIcon() {
     let metaData = this.getDownloadMetaData();
     if ("filePath" in metaData) {
       return "moz-icon://" + metaData.filePath + "?size=32";
     }
 
     if (this._placesNode) {
-      // Try to extract an extension from the uri.
-      let ext = this._downloadURIObj.QueryInterface(Ci.nsIURL).fileExtension;
-      if (ext) {
-        return "moz-icon://." + ext + "?size=32";
-      }
-      return this._placesNode.icon || "moz-icon://.unknown?size=32";
+      return "moz-icon://.unknown?size=32";
     }
+
+    // Assert unreachable.
     if (this._dataItem) {
       throw new Error("Session-download items should always have a target file uri");
     }
 
     throw new Error("Unexpected download element state");
   },
 
   // Helper for getting a places annotation set for the download.
@@ -509,22 +505,16 @@ DownloadElementShell.prototype = {
     // state without the target file information.
     if (this._dataItem || this.getDownloadMetaData().state !== undefined) {
       this._updateDownloadStatusUI();
     } else {
       this._fetchTargetFileInfo(true);
     }
   },
 
-  placesNodeIconChanged() {
-    if (!this._dataItem) {
-      this._element.setAttribute("image", this._getIcon());
-    }
-  },
-
   placesNodeAnnotationChanged(aAnnoName) {
     this._annotations.delete(aAnnoName);
     if (!this._dataItem && this.active) {
       if (aAnnoName == DOWNLOAD_META_DATA_ANNO) {
         let metaData = this.getDownloadMetaData();
         let annotatedMetaData = this._getAnnotatedMetaData();
         metaData.endTime = annotatedMetaData.endTime;
         if ("fileSize" in annotatedMetaData) {
@@ -1261,26 +1251,22 @@ DownloadsPlacesView.prototype = {
   nodeInserted(aParent, aPlacesNode) {
     this._addDownloadData(null, aPlacesNode);
   },
 
   nodeRemoved(aParent, aPlacesNode, aOldIndex) {
     this._removeHistoryDownloadFromView(aPlacesNode);
   },
 
-  nodeIconChanged(aNode) {
-    this._forEachDownloadElementShellForURI(aNode.uri,
-                                            des => des.placesNodeIconChanged());
-  },
-
   nodeAnnotationChanged(aNode, aAnnoName) {
     this._forEachDownloadElementShellForURI(aNode.uri,
                                             des => des.placesNodeAnnotationChanged(aAnnoName));
   },
 
+  nodeIconChanged() {},
   nodeTitleChanged() {},
   nodeKeywordChanged() {},
   nodeDateAddedChanged() {},
   nodeLastModifiedChanged() {},
   nodeHistoryDetailsChanged() {},
   nodeTagsChanged() {},
   sortingChanged() {},
   nodeMoved() {},