Bug 1282050 - Fix the updating of download commands in the Library. r=jaws

MozReview-Commit-ID: 7zSMcKe2REi

--HG--
extra : rebase_source : a6bcdf4ff3d6d031c0b5438257e485afc6c65430
This commit is contained in:
Paolo Amadini 2016-07-15 15:09:10 +01:00
Родитель 8f83bf2ffc
Коммит e3a101f136
1 изменённых файлов: 7 добавлений и 5 удалений

Просмотреть файл

@ -302,8 +302,11 @@ HistoryDownloadElementShell.prototype = {
if (this.element.selected) {
goUpdateDownloadCommands();
} else {
// If a state change occurs in an item that is not currently selected,
// this is the only command that may be affected.
goUpdateCommand("downloadsCmd_clearDownloads");
}
goUpdateCommand("downloadsCmd_clearDownloads");
},
onChanged() {
@ -1136,8 +1139,7 @@ DownloadsPlacesView.prototype = {
// nsIController
supportsCommand(aCommand) {
// Firstly, determine if this is a command that we can handle.
if (!aCommand.startsWith("cmd_") &&
!aCommand.startsWith("downloadsCmd_")) {
if (!DownloadsViewUI.isCommandName(aCommand)) {
return false;
}
if (!(aCommand in this) &&
@ -1418,11 +1420,11 @@ for (let methodName of ["load", "applyFilter", "selectNode", "selectItems"]) {
function goUpdateDownloadCommands() {
function updateCommandsForObject(object) {
for (let name in object) {
if (name.startsWith("cmd_") || name.startsWith("downloadsCmd_")) {
if (DownloadsViewUI.isCommandName(name)) {
goUpdateCommand(name);
}
}
}
updateCommandsForObject(this);
updateCommandsForObject(DownloadsPlacesView.prototype);
updateCommandsForObject(HistoryDownloadElementShell.prototype);
}