Bug 827298 - Ensure all "Unknown size" downloads have an icon and Remove From History menuitem.

r=Mano
This commit is contained in:
Marco Bonardo 2013-01-07 23:38:27 +01:00
parent 28a68bbaad
commit 8ce6ba810e
2 changed files with 14 additions and 10 deletions

View File

@ -13,7 +13,7 @@ richlistitem.download {
.download-state:not(:-moz-any([state="2"], /* Failed */
[state="4"]) /* Paused */)
.downloadCancelMenuItem,
.download-state:not(:-moz-any([state="1"], /* Finished */
.download-state[state]:not(:-moz-any([state="1"], /* Finished */
[state="2"], /* Failed */
[state="3"], /* Canceled */
[state="6"], /* Blocked (parental) */
@ -26,8 +26,7 @@ richlistitem.download {
[state="4"], /* Paused */
[state="5"]) /* Starting (queued) */)
.downloadShowMenuItem,
.download-state[state="7"] .downloadCommandsSeparator,
.download-state:not([state]) .downloadCommandsSeparator
.download-state[state="7"] .downloadCommandsSeparator
{
display: none;
}

View File

@ -154,8 +154,13 @@ DownloadElementShell.prototype = {
get _icon() {
if (this._targetFileURI)
return "moz-icon://" + this._targetFileURI + "?size=32";
if (this._placesNode)
return this.placesNode.icon;
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";
}
if (this._dataItem)
throw new Error("Session-download items should always have a target file uri");
throw new Error("Unexpected download element state");