From 8ce6ba810e47e496fd163795ddfd6d6351afe470 Mon Sep 17 00:00:00 2001 From: Marco Bonardo Date: Mon, 7 Jan 2013 23:38:27 +0100 Subject: [PATCH] Bug 827298 - Ensure all "Unknown size" downloads have an icon and Remove From History menuitem. r=Mano --- .../downloads/content/allDownloadsViewOverlay.css | 15 +++++++-------- .../downloads/content/allDownloadsViewOverlay.js | 9 +++++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/browser/components/downloads/content/allDownloadsViewOverlay.css b/browser/components/downloads/content/allDownloadsViewOverlay.css index 45c511881548..a9ae3c2b0a7f 100644 --- a/browser/components/downloads/content/allDownloadsViewOverlay.css +++ b/browser/components/downloads/content/allDownloadsViewOverlay.css @@ -13,12 +13,12 @@ richlistitem.download { .download-state:not(:-moz-any([state="2"], /* Failed */ [state="4"]) /* Paused */) .downloadCancelMenuItem, -.download-state:not(:-moz-any([state="1"], /* Finished */ - [state="2"], /* Failed */ - [state="3"], /* Canceled */ - [state="6"], /* Blocked (parental) */ - [state="8"], /* Blocked (dirty) */ - [state="9"]) /* Blocked (policy) */) +.download-state[state]:not(:-moz-any([state="1"], /* Finished */ + [state="2"], /* Failed */ + [state="3"], /* Canceled */ + [state="6"], /* Blocked (parental) */ + [state="8"], /* Blocked (dirty) */ + [state="9"]) /* Blocked (policy) */) .downloadRemoveFromHistoryMenuItem, .download-state:not(:-moz-any([state="-1"],/* Starting (initial) */ [state="0"], /* Downloading */ @@ -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; } diff --git a/browser/components/downloads/content/allDownloadsViewOverlay.js b/browser/components/downloads/content/allDownloadsViewOverlay.js index 21a54362c9a7..f1933ad63e42 100644 --- a/browser/components/downloads/content/allDownloadsViewOverlay.js +++ b/browser/components/downloads/content/allDownloadsViewOverlay.js @@ -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");