[PALEMOON] Bug 1120429 - Remove unused code handling nodeAnnotationChanged

This commit is contained in:
janekptacijarabaci 2018-07-29 07:40:06 +02:00 • committed by Roy Tam
commit 17b9f0a915

View file

@ -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 * 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. * valid. That's the caller (a DownloadsPlacesView object) responsibility.
* *
* The caller is also responsible for "passing over" notification from both the * The caller is also responsible for "passing over" notifications. The
* download-view and the places-result-observer, in the following manner: * DownloadsPlacesView object implements onDataItemStateChanged and
* - The DownloadsPlacesView object implements onDataItemStateChanged and * onDataItemChanged of the DownloadsView pseudo interface, and registers as a
* onDataItemChanged of the DownloadsView pseudo interface. * Places result observer.
* - The DownloadsPlacesView object adds itself as a places result observer and
* calls this object's placesNodeAnnotationChanged from its callbacks.
* *
* @param [optional] aDataItem * @param [optional] aDataItem
* The data item of a the session download. Required if aPlacesNode is not set * 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() { _updateUI: function DES__updateUI() {
if (!this.active) if (!this.active)
throw new Error("Trying to _updateUI on an inactive download shell"); throw new Error("Trying to _updateUI on an inactive download shell");
@ -492,7 +480,13 @@ DownloadElementShell.prototype = {
this._metaData = null; this._metaData = null;
this._targetFileInfoFetched = false; 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 // For history downloads done in past releases, the downloads/metaData
// annotation is not set, and therefore we cannot tell the download // annotation is not set, and therefore we cannot tell the download
@ -503,43 +497,6 @@ DownloadElementShell.prototype = {
this._fetchTargetFileInfo(true); 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) { onStateChanged(aOldState) {
let metaData = this.getDownloadMetaData(); let metaData = this.getDownloadMetaData();
metaData.state = this.dataItem.state; metaData.state = this.dataItem.state;
@ -799,16 +756,6 @@ DownloadsPlacesView.prototype = {
return this._active; 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) { _getAnnotationsFor: function DPV_getAnnotationsFor(aURI) {
if (!this._cachedAnnotations) { if (!this._cachedAnnotations) {
this._cachedAnnotations = new Map(); this._cachedAnnotations = new Map();
@ -1236,12 +1183,7 @@ DownloadsPlacesView.prototype = {
this._removeHistoryDownloadFromView(aPlacesNode); this._removeHistoryDownloadFromView(aPlacesNode);
}, },
nodeAnnotationChanged: function DPV_nodeAnnotationChanged(aNode, aAnnoName) { nodeAnnotationChanged() {},
this._forEachDownloadElementShellForURI(aNode.uri, function(aDownloadElementShell) {
aDownloadElementShell.placesNodeAnnotationChanged(aAnnoName);
});
},
nodeIconChanged() {}, nodeIconChanged() {},
nodeTitleChanged() {}, nodeTitleChanged() {},
nodeKeywordChanged: function() {}, nodeKeywordChanged: function() {},