bug 963898 - access DOMApplicationRegistry.webapps directly when autouninstalling webapp; r=mfinkle
authorMyk Melez <myk@mozilla.org>
Thu, 30 Jan 2014 10:00:42 -0800
changeset 166014 efcbcdb857e2edbc0380c233f317e0bf4760fcde
parent 166013 0b7f622775b9462acf23174aa26651961066bdbd
child 166015 65dbffad01e1d258d6819faaf728e099635991b6
push id39099
push usermyk@mozilla.com
push dateThu, 30 Jan 2014 18:02:05 +0000
treeherdermozilla-inbound@efcbcdb857e2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs963898
milestone29.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 963898 - access DOMApplicationRegistry.webapps directly when autouninstalling webapp; r=mfinkle
mobile/android/modules/WebappManager.jsm
--- a/mobile/android/modules/WebappManager.jsm
+++ b/mobile/android/modules/WebappManager.jsm
@@ -200,36 +200,30 @@ this.WebappManager = {
           message.isPackage = true;
           DOMApplicationRegistry.doInstallPackage(message, mm);
           break;
       }
     });
   },
 
   autoUninstall: function(aData) {
-    let mm = {
-      sendAsyncMessage: function (aMessageName, aData) {
-        // TODO hook this back to Java to report errors.
-        dump("autoUninstall sendAsyncMessage " + aMessageName + ": " + JSON.stringify(aData));
-      }
-    };
-
     DOMApplicationRegistry.registryReady.then(() => {
-      let installed = {};
-      DOMApplicationRegistry.doGetAll(installed, mm);
-
-      for (let app in installed.apps) {
-        if (aData.apkPackageNames.indexOf(installed.apps[app].apkPackageName) > -1) {
-          let appToRemove = installed.apps[app];
-          dump("should remove: " + appToRemove.name);
-          DOMApplicationRegistry.uninstall(appToRemove.manifestURL, function() {
-            dump(appToRemove.name + " uninstalled");
-          }, function() {
-            dump(appToRemove.name + " did not uninstall");
-          });
+      for (let id in DOMApplicationRegistry.webapps) {
+        let app = DOMApplicationRegistry.webapps[id];
+        if (aData.apkPackageNames.indexOf(app.apkPackageName) > -1) {
+          dump("attempting to uninstall " + app.name);
+          DOMApplicationRegistry.uninstall(
+            app.manifestURL,
+            function() {
+              dump("success uninstalling " + app.name);
+            },
+            function(error) {
+              dump("error uninstalling " + app.name + ": " + error);
+            }
+          );
         }
       }
     });
   },
 
   writeDefaultPrefs: function(aProfile, aManifest) {
       // build any app specific default prefs
       let prefs = [];