Bug 833659 - REINSTALL_FORBIDDEN error isn't triggering when installing a packaged app with a mini-manifest off of X origin when a hosted app was already installed from X origin r=ferjm a=sicking
authorFabrice Desré <fabrice@mozilla.com>
Thu, 24 Jan 2013 21:11:24 -0800
changeset 118331 63f6c3b4930a
parent 118330 8ab7e45fc123
child 118332 ed53e2df9157
push id355
push userfdesre@mozilla.com
push dateFri, 25 Jan 2013 05:11:32 +0000
reviewersferjm, sicking
bugs833659
milestone18.0
Bug 833659 - REINSTALL_FORBIDDEN error isn't triggering when installing a packaged app with a mini-manifest off of X origin when a hosted app was already installed from X origin r=ferjm a=sicking
dom/apps/src/Webapps.jsm
--- a/dom/apps/src/Webapps.jsm
+++ b/dom/apps/src/Webapps.jsm
@@ -1631,17 +1631,18 @@ this.DOMApplicationRegistry = {
       aMm.sendAsyncMessage("Webapps:Install:Return:KO", aData);
       Cu.reportError("Error installing packaged app from: " +
                      app.installOrigin + ": " + aError);
     }.bind(this);
 
     // Disallow reinstalls from the same manifest URL for now.
     // See https://bugzilla.mozilla.org/show_bug.cgi?id=821288
     if (this.getAppLocalIdByManifestURL(app.manifestURL) !==
-        Ci.nsIScriptSecurityManager.NO_APP_ID) {
+        Ci.nsIScriptSecurityManager.NO_APP_ID ||
+        this._appId(app.origin) !== null) {
       sendError("REINSTALL_FORBIDDEN");
       return;
     }
 
     let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
                 .createInstance(Ci.nsIXMLHttpRequest);
     xhr.open("GET", app.manifestURL, true);
     xhr.channel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING;