Bug 966141 - Route IPC messages manually in DownloadsAPI.jsm. r=fabrice

This commit is contained in:
Reuben Morais 2014-02-19 11:43:28 -05:00
Родитель 3bc3f426eb
Коммит 37a5108f33
1 изменённых файлов: 19 добавлений и 8 удалений

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

@ -148,14 +148,25 @@ let DownloadsAPI = {
}
debug("message: " + aMessage.name);
// Removing 'Downloads:' and turning first letter to lower case to
// build the function name from the message name.
let c = aMessage.name[10].toLowerCase();
let methodName = c + aMessage.name.substring(11);
if (this[methodName] && typeof this[methodName] === "function") {
this[methodName](aMessage.data, aMessage.target);
} else {
debug("Unimplemented method: " + methodName);
switch (aMessage.name) {
case "Downloads:GetList":
this.getList(aMessage.data, aMessage.target);
break;
case "Downloads:ClearAllDone":
this.clearAllDone(aMessage.data, aMessage.target);
break;
case "Downloads:Remove":
this.remove(aMessage.data, aMessage.target);
break;
case "Downloads:Pause":
this.pause(aMessage.data, aMessage.target);
break;
case "Downloads:Resume":
this.resume(aMessage.data, aMessage.target);
break;
default:
debug("Invalid message: " + aMessage.name);
}
},