diff --git a/dom/apps/src/AppsServiceChild.jsm b/dom/apps/src/AppsServiceChild.jsm index 5bf6a5aad74..3db76e9b985 100644 --- a/dom/apps/src/AppsServiceChild.jsm +++ b/dom/apps/src/AppsServiceChild.jsm @@ -334,6 +334,18 @@ this.DOMApplicationRegistry = { } }, + getAll: function(aCallback) { + if (!aCallback || typeof aCallback !== "function") { + return; + } + + let res = []; + for (let id in this.webapps) { + res.push(this.webapps[id]); + } + aCallback(res); + }, + /** * nsIAppsService API */ diff --git a/dom/apps/src/Webapps.js b/dom/apps/src/Webapps.js index 35a393907a7..06b04db6a6e 100644 --- a/dom/apps/src/Webapps.js +++ b/dom/apps/src/Webapps.js @@ -699,9 +699,7 @@ WebappsApplication.prototype = { * mozIDOMApplicationMgmt object */ function WebappsApplicationMgmt(aWindow) { - this.initDOMRequestHelper(aWindow, ["Webapps:GetAll:Return:OK", - "Webapps:GetAll:Return:KO", - "Webapps:Uninstall:Return:OK", + this.initDOMRequestHelper(aWindow, ["Webapps:Uninstall:Return:OK", "Webapps:Uninstall:Broadcast:Return:OK", "Webapps:Uninstall:Return:KO", "Webapps:Install:Return:OK", @@ -759,8 +757,12 @@ WebappsApplicationMgmt.prototype = { getAll: function() { let request = this.createRequest(); - cpmm.sendAsyncMessage("Webapps:GetAll", { oid: this._id, - requestID: this.getRequestId(request) }); + let window = this._window; + DOMApplicationRegistry.getAll((aApps) => { + Services.DOMRequest.fireSuccessAsync(request, + convertAppsArray(aApps, window)); + }); + return request; }, @@ -798,12 +800,6 @@ WebappsApplicationMgmt.prototype = { return; } switch (aMessage.name) { - case "Webapps:GetAll:Return:OK": - Services.DOMRequest.fireSuccess(req, convertAppsArray(msg.apps, this._window)); - break; - case "Webapps:GetAll:Return:KO": - Services.DOMRequest.fireError(req, "DENIED"); - break; case "Webapps:GetNotInstalled:Return:OK": Services.DOMRequest.fireSuccess(req, convertAppsArray(msg.apps, this._window)); break; diff --git a/dom/apps/src/Webapps.jsm b/dom/apps/src/Webapps.jsm index 37c86bf4cdd..98dbf234250 100755 --- a/dom/apps/src/Webapps.jsm +++ b/dom/apps/src/Webapps.jsm @@ -162,7 +162,7 @@ this.DOMApplicationRegistry = { this.messages = ["Webapps:Install", "Webapps:Uninstall", "Webapps:GetSelf", "Webapps:CheckInstalled", "Webapps:GetInstalled", "Webapps:GetNotInstalled", - "Webapps:Launch", "Webapps:GetAll", + "Webapps:Launch", "Webapps:InstallPackage", "Webapps:GetList", "Webapps:RegisterForMessages", "Webapps:UnregisterForMessages", @@ -1073,9 +1073,8 @@ this.DOMApplicationRegistry = { Services.prefs.setBoolPref("dom.mozApps.used", true); // We need to check permissions for calls coming from mozApps.mgmt. - // These are: getAll(), getNotInstalled(), applyDownload() and uninstall(). - if (["Webapps:GetAll", - "Webapps:GetNotInstalled", + // These are: getNotInstalled(), applyDownload() and uninstall(). + if (["Webapps:GetNotInstalled", "Webapps:ApplyDownload", "Webapps:Uninstall"].indexOf(aMessage.name) != -1) { if (!aMessage.target.assertPermission("webapps-manage")) { @@ -1120,9 +1119,6 @@ this.DOMApplicationRegistry = { case "Webapps:GetNotInstalled": this.getNotInstalled(msg, mm); break; - case "Webapps:GetAll": - this.doGetAll(msg, mm); - break; case "Webapps:InstallPackage": { #ifdef MOZ_WIDGET_ANDROID Services.obs.notifyObservers(mm, "webapps-runtime-install-package", JSON.stringify(msg)); @@ -3717,13 +3713,6 @@ this.DOMApplicationRegistry = { }); }, - doGetAll: function(aData, aMm) { - this.getAll(function (apps) { - aData.apps = apps; - aMm.sendAsyncMessage("Webapps:GetAll:Return:OK", aData); - }); - }, - getAll: function(aCallback) { debug("getAll"); let apps = [];