Bug 826948 - preloaded external packaged app requires hard-to-determine package_path property [r=myk, a=blocking-basecamp]
authorFabrice Desré <fabrice@mozilla.com>
Mon, 07 Jan 2013 09:10:32 -0800
changeset 117999 a6225e40ffcbad3f9ed8815debbb2144af43cd1f
parent 117998 5d8d80878fdf375b88b6c72e185082a015df58ad
child 118000 009f6d92a30267cc1aea050eb13bbecbed5e5f21
push id151
push userfdesre@mozilla.com
push dateTue, 08 Jan 2013 11:43:22 +0000
reviewersmyk, blocking-basecamp
bugs826948
milestone18.0
Bug 826948 - preloaded external packaged app requires hard-to-determine package_path property [r=myk, a=blocking-basecamp]
dom/apps/src/Webapps.jsm
--- a/dom/apps/src/Webapps.jsm
+++ b/dom/apps/src/Webapps.jsm
@@ -1129,16 +1129,22 @@ this.DOMApplicationRegistry = {
 
       // if the app manifestURL has a app:// scheme, we can't have an
       // update.
       if (app.manifestURL.startsWith("app://")) {
         aMm.sendAsyncMessage("Webapps:CheckForUpdate:Return:KO", aData);
         return;
       }
 
+      // Store the new update manifest.
+      let dir = FileUtils.getDir(DIRECTORY_NAME, ["webapps", id], true, true);
+      let manFile = dir.clone();
+      manFile.append("update.webapp");
+      this._writeFile(manFile, JSON.stringify(aManifest), function() { });
+
       let manifest = new ManifestHelper(aManifest, app.manifestURL);
       // A package is available: set downloadAvailable to fire the matching
       // event.
       app.downloadAvailable = true;
       app.downloadSize = manifest.size;
       aData.event = "downloadavailable";
       aData.app = {
         downloadAvailable: true,
@@ -1285,17 +1291,17 @@ this.DOMApplicationRegistry = {
         if (!AppsUtils.checkManifest(manifest)) {
           sendError("INVALID_MANIFEST");
         } else if (!AppsUtils.checkInstallAllowed(manifest, app.installOrigin)) {
           sendError("INSTALL_FROM_DENIED");
         } else {
           app.etag = xhr.getResponseHeader("Etag");
           app.lastCheckedUpdate = Date.now();
           if (app.origin.startsWith("app://")) {
-            updatePackagedApp(manifest);
+            updatePackagedApp.call(this, manifest);
           } else {
             updateHostedApp.call(this, manifest);
           }
         }
         this._saveApps();
       } else if (xhr.status == 304) {
         // The manifest has not changed. We just update lastCheckedUpdate.
         app.lastCheckedUpdate = Date.now();