Backed out changeset e9429bd59114 (bug 873567) for mochitest-2 failures.
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 01 Aug 2013 21:43:53 -0400
changeset 153347 b82c0f866f6487fc36e97e2015065818d47d4742
parent 153346 72386d4f6797c79ef001a55a9bda50a0aad0bd9e
child 153348 f57e629bb4c3c84c8cef412989b6c577b52c6dae
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs873567
milestone25.0a1
backs oute9429bd59114395168cb081712395bfe0a5cc488
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
Backed out changeset e9429bd59114 (bug 873567) for mochitest-2 failures. CLOSED TREE
dom/apps/src/Webapps.jsm
dom/apps/tests/Makefile.in
--- a/dom/apps/src/Webapps.jsm
+++ b/dom/apps/src/Webapps.jsm
@@ -1915,80 +1915,27 @@ this.DOMApplicationRegistry = {
     }
     aData.mm.sendAsyncMessage("Webapps:Install:Return:KO", aData);
   },
 
   // This function is called after we called the onsuccess callback on the
   // content side. This let the webpage the opportunity to set event handlers
   // on the app before we start firing progress events.
   queuedDownload: {},
-  queuedPackageDownload: {},
 
   onInstallSuccessAck: function onInstallSuccessAck(aManifestURL) {
-    let cacheDownload = this.queuedDownload[aManifestURL];
-    if (cacheDownload) {
-      this.startOfflineCacheDownload(cacheDownload.manifest,
-                                     cacheDownload.app,
-                                     cacheDownload.profileDir,
-                                     cacheDownload.offlineCacheObserver);
-      delete this.queuedDownload[aManifestURL];
-
+    let download = this.queuedDownload[aManifestURL];
+    if (!download) {
       return;
     }
-
-    let packageDownload = this.queuedPackageDownload[aManifestURL];
-    if (packageDownload) {
-      let manifest = packageDownload.manifest;
-      let appObject = packageDownload.app;
-      let installSuccessCallback = packageDownload.callback;
-
-      delete this.queuedPackageDownload[aManifestURL];
-
-      this.downloadPackage(manifest, appObject, false, (function(aId, aManifest) {
-        // Move the zip out of TmpD.
-        let app = DOMApplicationRegistry.webapps[aId];
-        let zipFile = FileUtils.getFile("TmpD", ["webapps", aId, "application.zip"], true);
-        let dir = this._getAppDir(aId);
-        zipFile.moveTo(dir, "application.zip");
-        let tmpDir = FileUtils.getDir("TmpD", ["webapps", aId], true, true);
-        try {
-          tmpDir.remove(true);
-        } catch(e) { }
-
-        // Save the manifest
-        let manFile = dir.clone();
-        manFile.append("manifest.webapp");
-        this._writeFile(manFile, JSON.stringify(aManifest), function() { });
-        // Set state and fire events.
-        app.installState = "installed";
-        app.downloading = false;
-        app.downloadAvailable = false;
-        this._saveApps((function() {
-          this.updateAppHandlers(null, aManifest, appObject);
-          this.broadcastMessage("Webapps:AddApp", { id: aId, app: appObject });
-
-          if (supportUseCurrentProfile()) {
-            // Update the permissions for this app.
-            PermissionsInstaller.installPermissions({ manifest: aManifest,
-                                                      origin: appObject.origin,
-                                                      manifestURL: appObject.manifestURL },
-                                                    true);
-          }
-          debug("About to fire Webapps:PackageEvent 'installed'");
-          this.broadcastMessage("Webapps:PackageEvent",
-                                { type: "installed",
-                                  manifestURL: appObject.manifestURL,
-                                  app: app,
-                                  manifest: aManifest });
-          if (installSuccessCallback) {
-            installSuccessCallback(aManifest);
-          }
-        }).bind(this));
-      }).bind(this));
-    }
+    this.startOfflineCacheDownload(download.manifest,
+                                   download.app,
+                                   download.profileDir,
+                                   download.offlineCacheObserver);
+    delete this.queuedDownload[aManifestURL];
   },
 
   confirmInstall: function(aData, aFromSync, aProfileDir,
                            aOfflineCacheObserver,
                            aInstallSuccessCallback) {
     let isReinstall = false;
     let app = aData.app;
     app.removable = true;
@@ -2116,22 +2063,57 @@ this.DOMApplicationRegistry = {
         aInstallSuccessCallback(app.manifest);
       }
     }
 
     if (manifest.package_path) {
       // origin for install apps is meaningless here, since it's app:// and this
       // can't be used to resolve package paths.
       manifest = new ManifestHelper(jsonManifest, app.manifestURL);
-
-      this.queuedPackageDownload[app.manifestURL] = {
-        manifest: manifest,
-        app: appObject,
-        callback: aInstallSuccessCallback
-      }
+      this.downloadPackage(manifest, appObject, false, (function(aId, aManifest) {
+        // Success! Move the zip out of TmpD.
+        let app = DOMApplicationRegistry.webapps[aId];
+        let zipFile = FileUtils.getFile("TmpD", ["webapps", aId, "application.zip"], true);
+        let dir = this._getAppDir(id);
+        zipFile.moveTo(dir, "application.zip");
+        let tmpDir = FileUtils.getDir("TmpD", ["webapps", aId], true, true);
+        try {
+          tmpDir.remove(true);
+        } catch(e) { }
+
+        // Save the manifest
+        let manFile = dir.clone();
+        manFile.append("manifest.webapp");
+        this._writeFile(manFile, JSON.stringify(aManifest), function() { });
+        // Set state and fire events.
+        app.installState = "installed";
+        app.downloading = false;
+        app.downloadAvailable = false;
+        this._saveApps((function() {
+          this.updateAppHandlers(null, aManifest, appObject);
+          this.broadcastMessage("Webapps:AddApp", { id: aId, app: appObject });
+
+          if (supportUseCurrentProfile()) {
+            // Update the permissions for this app.
+            PermissionsInstaller.installPermissions({ manifest: aManifest,
+                                                      origin: appObject.origin,
+                                                      manifestURL: appObject.manifestURL },
+                                                    true);
+          }
+          debug("About to fire Webapps:PackageEvent 'installed'");
+          this.broadcastMessage("Webapps:PackageEvent",
+                                { type: "installed",
+                                  manifestURL: appObject.manifestURL,
+                                  app: app,
+                                  manifest: aManifest });
+          if (aInstallSuccessCallback) {
+            aInstallSuccessCallback(aManifest);
+          }
+        }).bind(this));
+      }).bind(this));
     }
   },
 
   _nextLocalId: function() {
     let id = Services.prefs.getIntPref("dom.mozApps.maxLocalId") + 1;
     Services.prefs.setIntPref("dom.mozApps.maxLocalId", id);
     Services.prefs.savePrefFile(null);
     return id;
--- a/dom/apps/tests/Makefile.in
+++ b/dom/apps/tests/Makefile.in
@@ -13,19 +13,24 @@ include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_FILES = \
   file_app.sjs \
   file_app.template.html \
   file_cached_app.template.webapp \
   file_cached_app.template.appcache \
   file_hosted_app.template.webapp \
   test_app_update.html \
+  $(NULL)
+
+ifdef MOZ_B2G
+MOCHITEST_FILES += \
   file_packaged_app.sjs \
   file_packaged_app.template.webapp \
   file_packaged_app.template.html \
   test_packaged_app_install.html \
   $(NULL)
+endif
 
 MOCHITEST_CHROME_FILES = \
   test_apps_service.xul \
   $(NULL)
 
 include $(topsrcdir)/config/rules.mk