Bug 927108 - Fix certified app actor installation r=paul
authorAlexandre Poirot <poirot.alex@gmail.com>
Sat, 19 Oct 2013 21:03:30 +0200
changeset 151799 69a2b8bb41beb1bf32ca9bcf5c46edcd0c803bfa
parent 151798 0117133ba8efeec277059f2f214b1fff55b5dd77
child 151800 54da01870611dd2c226180786f9a222ca1b244be
push id3178
push userapoirot@mozilla.com
push dateWed, 23 Oct 2013 13:24:59 +0000
treeherderfx-team@69a2b8bb41be [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaul
bugs927108
milestone27.0a1
Bug 927108 - Fix certified app actor installation r=paul
toolkit/devtools/apps/tests/Makefile.in
toolkit/devtools/apps/tests/data/app-certified.zip
toolkit/devtools/apps/tests/test_webapps_actor.html
toolkit/devtools/server/actors/webapps.js
--- a/toolkit/devtools/apps/tests/Makefile.in
+++ b/toolkit/devtools/apps/tests/Makefile.in
@@ -9,12 +9,14 @@ MOCHITEST_FILES = \
     debugger-protocol-helper.js \
     redirect.sjs \
     $(NULL)
 
 MOCHITEST_DATA_FILES = \
     data/app-redirect.zip \
     data/app-updated.zip \
     data/app.zip \
+    data/app-certified.zip \
     $(NULL)
+
 MOCHITEST_DATA_DEST = $(MOCHITEST_DEST)/data
 INSTALL_TARGETS += MOCHITEST_DATA
 endif
new file mode 100644
index 0000000000000000000000000000000000000000..3dbdedb8cafbc21377cecd74db25d8bea24cdda6
GIT binary patch
literal 501
zc$^FHW@Zs#U|`^2IFdTgi7D`)iaU@O3&dOuG7On{DXA5D86~+np&^_M%pVri2ZC^E
z1vdjD%L`@(1~9QX(C4JT-bx*h&=VRb&u)CYsWEV6r)HU%>P%J3m1SnX45V~UrB0qQ
zKPdC~(ghD@#7v4`5-=$$X3>O*fCa}>7xPbK)MA;<#1H^?N&{1X^TH1+W~Tvp^+3!I
zbV_bwUS?Wqafx1eYEoiB0oXkg_QwW+Fq(Tz&l++aHsEo%cz3zLEa%<nXGM33Uk%H4
zT*MKr%DJ@Mf9{2!_CMw`G<XRo^IH@YR&uE;7{7_~ib)nMp1HMCI$XT=;Gur`l@1r5
z7oD1TPwMmC6UCFmFCKZV`rBmQU2|)-kM;*Y@LC6WGcw6B;|e<o1`uEb;w_CJ7IH|k
oLP8SF)yU>y1^}{o-9Qo}I9MUUfng{s8%QG)5H1DMRv;4?03J-2=>Px#
--- a/toolkit/devtools/apps/tests/test_webapps_actor.html
+++ b/toolkit/devtools/apps/tests/test_webapps_actor.html
@@ -150,16 +150,36 @@ var steps = [
         }
         ok(!("error" in aResponse), "app installed without any error");
         is(aApp.manifest.name, "updated-name", "app name on update is correct");
         next();
       }
     );
   },
   function() {
+    ok(true, "== TEST == Install certified app");
+    let appId = "test-certified-id";
+    let url = SimpleTest.getTestFileURL("data/app-certified.zip");
+    installTestApp(url, appId,
+      function (aResponse, aApp) {
+        ok(true, "Installed");
+        is(aResponse.appId, appId, "Got same app id");
+        if ("error" in aResponse) {
+          ok(false, "Error: " + aResponse.error);
+        }
+        if ("message" in aResponse) {
+          ok(false, "Error message: " + aResponse.message);
+        }
+        ok(!("error" in aResponse), "app installed without any error");
+        is(aApp.manifest.name, "Certified app", "app name is correct");
+        next();
+      }
+    );
+  },
+  function() {
     ok(true, "all done!\n");
     mm.sendAsyncMessage("cleanup");
     SpecialPowers.popPrefEnv(finish);
   }
 ];
 
 addLoadEvent(start);
 
--- a/toolkit/devtools/server/actors/webapps.js
+++ b/toolkit/devtools/server/actors/webapps.js
@@ -384,23 +384,16 @@ WebappsActor.prototype = {
           try {
             manifest = JSON.parse(jsonString);
           } catch(e) {
             self._sendError(deferred, "Error Parsing manifest.webapp: " + e, aId);
           }
 
           let appType = self._getAppType(manifest.type);
 
-          // In production builds, don't allow installation of certified apps.
-          if (!DOMApplicationRegistry.allowSideloadingCertified &&
-              appType == Ci.nsIPrincipal.APP_STATUS_CERTIFIED) {
-            self._sendError(deferred, "Installing certified apps is not allowed.", aId);
-            return;
-          }
-
           // Privileged and certified packaged apps can setup a custom origin
           // via `origin` manifest property
           let id = aId;
           if (appType >= Ci.nsIPrincipal.APP_STATUS_PRIVILEGED &&
               manifest.origin !== undefined) {
             let uri;
             try {
               uri = Services.io.newURI(manifest.origin, null, null);