Bug 1191579 - Remove useless getAll() implementation in Webapps.jsm
authorFabrice Desré <fabrice@mozilla.com>
Thu, 06 Aug 2015 07:43:59 -0700
changeset 289931 30517a538f0fd04091e46423b10ba38f7c2896ab
parent 289930 a5a0deb30235374c8231a80b507c5374abcd3b34
child 289932 4063c307c1db9a25485367489662ae623ae3f800
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1191579
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1191579 - Remove useless getAll() implementation in Webapps.jsm
dom/apps/Webapps.jsm
toolkit/devtools/server/actors/webapps.js
--- a/dom/apps/Webapps.jsm
+++ b/dom/apps/Webapps.jsm
@@ -733,17 +733,21 @@ this.DOMApplicationRegistry = {
           }
         }
       }
     }.bind(this)).then(null, Cu.reportError);
   },
 
   loadAndUpdateApps: function() {
     return Task.spawn(function*() {
-      let runUpdate = AppsUtils.isFirstRun(Services.prefs);
+      let runUpdate = false;
+      try {
+        runUpdate = AppsUtils.isFirstRun(Services.prefs);
+      } catch(e) {}
+
       let loadAppPermission = Services.prefs.getBoolPref("dom.apps.reset-permissions");
 
       yield this.loadCurrentRegistry();
 
       // Sanity check and roll back previous incomplete app updates.
       for (let id in this.webapps) {
         let oldDir = FileUtils.getDir(DIRECTORY_NAME, ["webapps", id + ".old"], false, true);
         if (oldDir.exists()) {
@@ -796,17 +800,17 @@ this.DOMApplicationRegistry = {
           }
           this.updateOfflineCacheForApp(id);
           this.updatePermissionsForApp(id, isPreinstalled);
         }
         // Need to update the persisted list of apps since
         // installPreinstalledApp() removes the ones failing to install.
         this._saveApps();
 
-	Services.prefs.setBoolPref("dom.apps.reset-permissions", true);
+        Services.prefs.setBoolPref("dom.apps.reset-permissions", true);
       }
 
       // DataStores must be initialized at startup.
       for (let id in this.webapps) {
         yield this.updateDataStoreForApp(id);
       }
 
       yield this.registerAppsHandlers(runUpdate);
@@ -4330,37 +4334,16 @@ this.DOMApplicationRegistry = {
       }
       loadIcon(url);
     }).catch(() => {
       sendError("FETCH_ICON_FAILED");
       return;
     });
   },
 
-  getAll: function(aCallback) {
-    debug("getAll");
-    let apps = [];
-    let tmp = [];
-
-    for (let id in this.webapps) {
-      let app = AppsUtils.cloneAppObject(this.webapps[id]);
-      if (!this._isLaunchable(app))
-        continue;
-
-      apps.push(app);
-      tmp.push({ id: id });
-    }
-
-    this._readManifests(tmp).then((aResult) => {
-      for (let i = 0; i < aResult.length; i++)
-        apps[i].manifest = aResult[i].manifest;
-      aCallback(apps);
-    });
-  },
-
   /* Check if |data| is actually a receipt */
   isReceipt: function(data) {
     try {
       // The receipt data shouldn't be too big (allow up to 1 MiB of data)
       const MAX_RECEIPT_SIZE = 1048576;
 
       if (data.length > MAX_RECEIPT_SIZE) {
         return "RECEIPT_TOO_BIG";
--- a/toolkit/devtools/server/actors/webapps.js
+++ b/toolkit/devtools/server/actors/webapps.js
@@ -209,16 +209,19 @@ function WebappsActor(aConnection) {
   // Load actor dependencies lazily as this actor require extra environnement
   // preparation to work (like have a profile setup in xpcshell tests)
 
   Cu.import("resource://gre/modules/Webapps.jsm");
   Cu.import("resource://gre/modules/AppsUtils.jsm");
   Cu.import("resource://gre/modules/FileUtils.jsm");
   Cu.import("resource://gre/modules/MessageBroadcaster.jsm");
 
+  this.appsChild = {};
+  Cu.import("resource://gre/modules/AppsServiceChild.jsm", this.appsChild);
+
   // Keep reference of already connected app processes.
   // values: app frame message manager
   this._connectedApps = new Set();
 
   this.conn = aConnection;
   this._uploads = [];
   this._actorPool = new ActorPool(this.conn);
   this.conn.addActorPool(this._actorPool);
@@ -683,18 +686,17 @@ WebappsActor.prototype = {
 
     return this.installHostedApp(appDir, appId, receipts, manifest, metadata);
   },
 
   getAll: function wa_actorGetAll(aRequest) {
     debug("getAll");
 
     let deferred = promise.defer();
-    let reg = DOMApplicationRegistry;
-    reg.getAll(apps => {
+    this.appsChild.DOMApplicationRegistry.getAll(apps => {
       deferred.resolve({ apps: this._filterAllowedApps(apps) });
     });
 
     return deferred.promise;
   },
 
   getApp: function wa_actorGetApp(aRequest) {
     debug("getApp");