From 88e034bf8fe166ad89aee092fbb5f4483d92df7b Mon Sep 17 00:00:00 2001 From: "edward.lee@engineering.uiuc.edu" Date: Tue, 15 Apr 2008 22:28:59 -0700 Subject: [PATCH] Bug 429144 - If downloaded file is removed, but saved dir still exists, then "Open Containing Folder" menu item should be disabled. r=sdwilsh, a1.9=beltzner --- toolkit/mozapps/downloads/content/downloads.js | 8 ++++++-- .../downloads/tests/browser/browser_multi_select.js | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/toolkit/mozapps/downloads/content/downloads.js b/toolkit/mozapps/downloads/content/downloads.js index b534fc0ec234..222739938440 100644 --- a/toolkit/mozapps/downloads/content/downloads.js +++ b/toolkit/mozapps/downloads/content/downloads.js @@ -669,9 +669,14 @@ var gDownloadViewController = { switch (aCommand) { case "cmd_cancel": return dl.inProgress; - case "cmd_open": + case "cmd_open": { let file = getLocalFileFromNativePathOrUrl(dl.getAttribute("file")); return dl.openable && file.exists(); + } + case "cmd_show": { + let file = getLocalFileFromNativePathOrUrl(dl.getAttribute("file")); + return file.exists(); + } case "cmd_pause": download = gDownloadManager.getDownload(dl.getAttribute("dlid")); return dl.inProgress && !dl.paused && download.resumable; @@ -686,7 +691,6 @@ var gDownloadViewController = { case "cmd_removeFromList": case "cmd_retry": return dl.removable; - case "cmd_show": case "cmd_copyLocation": return true; } diff --git a/toolkit/mozapps/downloads/tests/browser/browser_multi_select.js b/toolkit/mozapps/downloads/tests/browser/browser_multi_select.js index f11badf6700b..395055053f9f 100644 --- a/toolkit/mozapps/downloads/tests/browser/browser_multi_select.js +++ b/toolkit/mozapps/downloads/tests/browser/browser_multi_select.js @@ -137,7 +137,7 @@ function test() resume: [0, "Resumed no downloads"], cancel: [0, "Canceled no downloads"], open: [0, "Opened no downloads"], - show: [1, "Showed one download"], + show: [0, "Showed no downloads"], retry: [1, "Retried one download"], openReferrer: [1, "Opened one referrer"], copyLocation: ["http://ed.agadak.net/file", "Copied one location"], @@ -148,7 +148,7 @@ function test() resume: [0, "Resumed neither download"], cancel: [0, "Canceled neither download"], open: [0, "Opened neither download"], - show: [2, "Showed both downloads"], + show: [0, "Showed neither download"], retry: [2, "Retried both downloads"], openReferrer: [2, "Opened both referrers"], copyLocation: ["http://mozilla.org/file\nhttp://mozilla.com/file", "Copied both locations"],