Bug 1115971 - Don't fall back to the Places title for downloads without the target file name annotation. r=mak

This commit is contained in:
Paolo Amadini
2015-01-14 17:30:27 +00:00
parent 6ebe3e09a5
commit e74846851f

View File

@@ -58,8 +58,8 @@ const NOT_AVAILABLE = Number.MAX_VALUE;
* - 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, placesNodeTitleChanged and
* placeNodeAnnotationChanged from its callbacks.
* calls this object's placesNodeIconChanged and placesNodeAnnotationChanged
* from its callbacks.
*
* @param [optional] aDataItem
* The data item of a the session download. Required if aPlacesNode is not set
@@ -303,9 +303,9 @@ DownloadElementShell.prototype = {
* - fileName: the downloaded file name on the file system. Set if filePath
* is set.
* - displayName: the user-facing label for the download. This is always
* set. If available, it's set to the downloaded file name. If not,
* the places title for the download uri is used it's set. As a last
* resort, we fallback to the download uri.
* set. If available, it's set to the downloaded file name. If not, this
* means the download does not have Places metadata because it is very old,
* and in this rare case the download uri is used.
* - fileSize (only set for downloads which completed successfully):
* the downloaded file size. For downloads done after the landing of
* bug 826991, this value is "static" - that is, it does not necessarily
@@ -347,7 +347,7 @@ DownloadElementShell.prototype = {
this._extractFilePathAndNameFromFileURI(targetFileURI);
this._metaData.displayName = this._metaData.fileName;
} catch (ex) {
this._metaData.displayName = this._placesNode.title || this.downloadURI;
this._metaData.displayName = this.downloadURI;
}
}
}
@@ -520,15 +520,6 @@ DownloadElementShell.prototype = {
}
},
placesNodeTitleChanged() {
// If there's a file path, we use the leaf name for the title.
if (!this._dataItem && this.active &&
!this.getDownloadMetaData().filePath) {
this._metaData = null;
this._updateDisplayNameAndIcon();
}
},
placesNodeAnnotationChanged(aAnnoName) {
this._annotations.delete(aAnnoName);
if (!this._dataItem && this.active) {
@@ -1285,11 +1276,7 @@ DownloadsPlacesView.prototype = {
des => des.placesNodeAnnotationChanged(aAnnoName));
},
nodeTitleChanged(aNode, aNewTitle) {
this._forEachDownloadElementShellForURI(aNode.uri,
des => des.placesNodeTitleChanged());
},
nodeTitleChanged() {},
nodeKeywordChanged() {},
nodeDateAddedChanged() {},
nodeLastModifiedChanged() {},