From 1eab01b243d9a4efb45bb73a1b228cd39436fba2 Mon Sep 17 00:00:00 2001
From: janekptacijarabaci <janekptacijarabaci@seznam.cz>
Date: Sun, 29 Jul 2018 07:40:06 +0200
Subject: [PALEMOON] Bug 1120429 - Remove unused code handling
 nodeAnnotationChanged

---
 .../downloads/content/allDownloadsViewOverlay.js   | 82 ++++------------------
 1 file changed, 12 insertions(+), 70 deletions(-)

diff --git a/application/palemoon/components/downloads/content/allDownloadsViewOverlay.js b/application/palemoon/components/downloads/content/allDownloadsViewOverlay.js
index a0493c5f4..97a9d242b 100644
--- a/application/palemoon/components/downloads/content/allDownloadsViewOverlay.js
+++ b/application/palemoon/components/downloads/content/allDownloadsViewOverlay.js
@@ -53,12 +53,10 @@ 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 placesNodeAnnotationChanged from its callbacks.
+ * The caller is also responsible for "passing over" notifications. The
+ * DownloadsPlacesView object implements onDataItemStateChanged and
+ * onDataItemChanged of the DownloadsView pseudo interface, and registers as a
+ * Places result observer.
  *
  * @param [optional] aDataItem
  *        The data item of a the session download. Required if aPlacesNode is not set
@@ -475,16 +473,6 @@ DownloadElementShell.prototype = {
     }
   },
 
-  _updateDisplayNameAndIcon: function DES__updateDisplayNameAndIcon() {
-    let metaData = this.getDownloadMetaData();
-    this._element.setAttribute("displayName", metaData.displayName);
-    if ("extendedDisplayName" in metaData)
-      this._element.setAttribute("extendedDisplayName", metaData.extendedDisplayName);
-    if ("extendedDisplayNameTip" in metaData)
-      this._element.setAttribute("extendedDisplayNameTip", metaData.extendedDisplayNameTip);
-    this._element.setAttribute("image", this._getIcon());
-  },
-
   _updateUI: function DES__updateUI() {
     if (!this.active)
       throw new Error("Trying to _updateUI on an inactive download shell");
@@ -492,7 +480,13 @@ DownloadElementShell.prototype = {
     this._metaData = null;
     this._targetFileInfoFetched = false;
 
-    this._updateDisplayNameAndIcon();
+    let metaData = this.getDownloadMetaData();
+    this._element.setAttribute("displayName", metaData.displayName);
+    if ("extendedDisplayName" in metaData)
+      this._element.setAttribute("extendedDisplayName", metaData.extendedDisplayName);
+    if ("extendedDisplayNameTip" in metaData)
+      this._element.setAttribute("extendedDisplayNameTip", metaData.extendedDisplayNameTip);
+    this._element.setAttribute("image", this._getIcon());
 
     // For history downloads done in past releases, the downloads/metaData
     // annotation is not set, and therefore we cannot tell the download
@@ -503,43 +497,6 @@ DownloadElementShell.prototype = {
       this._fetchTargetFileInfo(true);
   },
 
-  placesNodeAnnotationChanged: function DES_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)
-          metaData.fileSize = annotatedMetaData.fileSize;
-        else
-          delete metaData.fileSize;
-
-        if (metaData.state != annotatedMetaData.state) {
-          metaData.state = annotatedMetaData.state;
-          if (this._element.selected)
-            goUpdateDownloadCommands();
-        }
-
-        this._updateDownloadStatusUI();
-      }
-      else if (aAnnoName == DESTINATION_FILE_URI_ANNO) {
-        let metaData = this.getDownloadMetaData();
-        let targetFileURI = this._getAnnotation(DESTINATION_FILE_URI_ANNO);
-        [metaData.filePath, metaData.fileName] =
-            this._extractFilePathAndNameFromFileURI(targetFileURI);
-        metaData.displayName = metaData.fileName;
-        this._updateDisplayNameAndIcon();
-
-        if (this._targetFileInfoFetched) {
-          // This will also update the download commands if necessary.
-          this._targetFileInfoFetched = false;
-          this._fetchTargetFileInfo();
-        }
-      }
-    }
-  },
-
   onStateChanged(aOldState) {
     let metaData = this.getDownloadMetaData();
     metaData.state = this.dataItem.state;
@@ -799,16 +756,6 @@ DownloadsPlacesView.prototype = {
     return this._active;
   },
 
-  _forEachDownloadElementShellForURI:
-  function DPV__forEachDownloadElementShellForURI(aURI, aCallback) {
-    if (this._downloadElementsShellsForURI.has(aURI)) {
-      let downloadElementShells = this._downloadElementsShellsForURI.get(aURI);
-      for (let des of downloadElementShells) {
-        aCallback(des);
-      }
-    }
-  },
-
   _getAnnotationsFor: function DPV_getAnnotationsFor(aURI) {
     if (!this._cachedAnnotations) {
       this._cachedAnnotations = new Map();
@@ -1236,12 +1183,7 @@ DownloadsPlacesView.prototype = {
     this._removeHistoryDownloadFromView(aPlacesNode);
   },
 
-  nodeAnnotationChanged: function DPV_nodeAnnotationChanged(aNode, aAnnoName) {
-    this._forEachDownloadElementShellForURI(aNode.uri, function(aDownloadElementShell) {
-      aDownloadElementShell.placesNodeAnnotationChanged(aAnnoName);
-    });
-  },
-
+  nodeAnnotationChanged() {},
   nodeIconChanged() {},
   nodeTitleChanged() {},
   nodeKeywordChanged: function() {},
-- 
cgit v1.2.3