Bug 1021345 - Allow apps to be installed from the Marketplace staging server. r=fabrice

This commit is contained in:
Marco Castelluccio 2014-07-23 13:20:25 +02:00
Родитель cbbe8c75a1
Коммит 3236b9594b
19 изменённых файлов: 107 добавлений и 2 удалений

Двоичные данные
build/pgo/certs/cert8.db

Двоичный файл не отображается.

Двоичные данные
build/pgo/certs/key3.db

Двоичный файл не отображается.

Просмотреть файл

@ -217,3 +217,4 @@ http://example.fi:80 privileged
# Hosts for testing marketplace apps installations
https://marketplace.firefox.com:443 privileged
https://marketplace-dev.allizom.org:443 privileged
https://marketplace.allizom.org:443 privileged

Просмотреть файл

@ -15,6 +15,7 @@ const APP_TRUSTED_ROOTS= ["AppMarketplaceProdPublicRoot",
"AppMarketplaceProdReviewersRoot",
"AppMarketplaceDevPublicRoot",
"AppMarketplaceDevReviewersRoot",
"AppMarketplaceStageRoot",
"AppXPCShellRoot"];
this.TrustedRootCertificate = {

Просмотреть файл

@ -3244,6 +3244,12 @@ this.DOMApplicationRegistry = {
? Ci.nsIX509CertDB.AppMarketplaceDevReviewersRoot
: Ci.nsIX509CertDB.AppMarketplaceDevPublicRoot;
break;
// The staging server uses the same certificate for both
// public and unreviewed apps.
case "https://marketplace.allizom.org":
root = Ci.nsIX509CertDB.AppMarketplaceStageRoot;
break;
}
}

Просмотреть файл

@ -0,0 +1 @@
{"name": "Flashlight (Linterna)", "icons": {"60": "/img/icons/mortar-60.png", "128": "/img/icons/mortar-128.png", "48": "/img/icons/mortar-48.png", "16": "/img/icons/mortar-16.png"}, "version": "2.0", "package_path": "marketplace_stage_app.zip", "size": 202602, "release_notes": "", "locales": {"es": {"description": "Una simple linterna que puedes utilizar en cualquier lugar sin conexi\u00f3n a internet y con opciones geniales: * Modo Linterna - * Modo Disco - * Modo Colores", "developer": {"url": "https://twitter.com/tecnowilliam", "name": "William Vargas"}}}, "developer": {"url": "https://twitter.com/tecnowilliam", "name": "William Vargas"}}

Просмотреть файл

@ -0,0 +1 @@
Content-Type: application/x-web-app-manifest+json

Двоичные данные
dom/apps/tests/marketplace/marketplace_stage_app.zip Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1 @@
{"name": "KitchenSink", "icons": {"128": "/img/icons/logo-128.png", "32": "/img/icons/logo-32.png", "64": "/img/icons/logo-64.png", "256": "/img/icons/logo-256.png", "16": "/img/icons/logo-16.png"}, "version": "0.2.2", "package_path": "marketplace_stage_privileged_app.zip", "size": 253493, "release_notes": "Fixed the browser API test and its documentation link.", "developer": {"url": "http://www.mozillalabs.com", "name": "Piotr Zalewa"}}

Просмотреть файл

@ -0,0 +1 @@
Content-Type: application/x-web-app-manifest+json

Двоичные данные
dom/apps/tests/marketplace/marketplace_stage_privileged_app.zip Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1 @@
{"name": "premium packaged app", "icons": {"128": "/qalogo.png"}, "version": "1.5", "package_path": "marketplace_stage_reviewers_app.zip", "size": 21065, "release_notes": "", "developer": {"url": "https://mozilla.org", "name": "Mozilla QA"}}

Просмотреть файл

@ -0,0 +1 @@
Content-Type: application/x-web-app-manifest+json

Двоичные данные
dom/apps/tests/marketplace/marketplace_stage_reviewers_app.zip Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -34,6 +34,9 @@ let gMarketplaceAppsPath = gMarketplaceInstallOrigin + "tests/dom/apps/tests/mar
let gMarketplaceDevInstallOrigin = "https://marketplace-dev.allizom.org/";
let gMarketplaceDevAppsPath = gMarketplaceDevInstallOrigin + "tests/dom/apps/tests/marketplace/";
let gMarketplaceStageInstallOrigin = "https://marketplace.allizom.org/";
let gMarketplaceStageAppsPath = gMarketplaceStageInstallOrigin + "tests/dom/apps/tests/marketplace/";
SimpleTest.waitForExplicitFinish();
function checkAppOnInstallSuccess(aExpected) {
@ -254,6 +257,83 @@ PackagedTestHelper.setSteps([
checkAppOnInstallError("INVALID_SIGNATURE");
installApp(gMarketplaceDevInstallOrigin, gMarketplaceDevAppsPath + "marketplace_dev_reviewers_app.webapp");
},
function() {
let signedAppOrigins = SpecialPowers.getCharPref("dom.mozApps.signed_apps_installable_from");
signedAppOrigins = signedAppOrigins.concat("," + gMarketplaceStageInstallOrigin.slice(0,-1));
SpecialPowers.pushPrefEnv({
set: [['dom.mozApps.signed_apps_installable_from', signedAppOrigins]]
}, PackagedTestHelper.next);
},
function() {
info("== TEST == Marketplace-stage packaged app from https://marketplace.firefox.com/");
checkAppOnInstallError("INVALID_SIGNATURE");
installApp(gMarketplaceInstallOrigin, gMarketplaceAppsPath + "marketplace_stage_app.webapp");
},
function() {
info("== TEST == Marketplace-stage packaged app from https://marketplace.allizom.org/");
let miniManifestURL = gMarketplaceStageAppsPath + "marketplace_stage_app.webapp";
let expected = {
name: "Flashlight (Linterna)",
manifestURL: miniManifestURL,
installOrigin: gMarketplaceStageInstallOrigin.slice(0, -1),
progress: 0,
installState: "installed",
downloadAvailable: false,
downloading: false,
readyToApplyDownload: false,
launch_path: "/index.html",
version: "2.0",
};
checkAppOnInstallSuccess(expected);
installApp(gMarketplaceStageInstallOrigin, miniManifestURL);
},
function() {
info("== TEST == Marketplace-stage privileged app from https://marketplace.firefox.com/");
checkAppOnInstallError("INVALID_SIGNATURE");
installApp(gMarketplaceInstallOrigin, gMarketplaceAppsPath + "marketplace_stage_privileged_app.webapp");
},
function() {
info("== TEST == Marketplace-stage privileged app from https://marketplace.allizom.org/");
let miniManifestURL = gMarketplaceStageAppsPath + "marketplace_stage_privileged_app.webapp";
let expected = {
name: "KitchenSink",
manifestURL: miniManifestURL,
installOrigin: gMarketplaceStageInstallOrigin.slice(0, -1),
progress: 0,
installState: "installed",
downloadAvailable: false,
downloading: false,
readyToApplyDownload: false,
launch_path: "/index.html",
version: "0.2.2",
};
checkAppOnInstallSuccess(expected);
installApp(gMarketplaceStageInstallOrigin, miniManifestURL);
},
function() {
info("== TEST == Marketplace-stage reviewers packaged app from https://marketplace.firefox.com/");
checkAppOnInstallError("INVALID_SIGNATURE");
installApp(gMarketplaceInstallOrigin, gMarketplaceAppsPath + "marketplace_stage_reviewers_app.webapp");
},
function() {
info("== TEST == Marketplace-stage reviewers packaged app from https://marketplace.allizom.org/");
let miniManifestURL = gMarketplaceStageAppsPath + "marketplace_stage_reviewers_app.webapp";
let expected = {
name: "premium packaged app",
manifestURL: miniManifestURL,
installOrigin: gMarketplaceStageInstallOrigin.slice(0, -1),
progress: 0,
installState: "installed",
downloadAvailable: false,
downloading: false,
readyToApplyDownload: false,
launch_path: "/webapi_permissions_test.html",
version: "1.5",
};
checkAppOnInstallSuccess(expected);
installApp(gMarketplaceStageInstallOrigin, miniManifestURL);
},
function() {
PackagedTestHelper.finish();
}

Просмотреть файл

@ -22,6 +22,7 @@
#include "marketplace-prod-reviewers.inc"
#include "marketplace-dev-public.inc"
#include "marketplace-dev-reviewers.inc"
#include "marketplace-stage.inc"
#include "xpcshell.inc"
using namespace mozilla::pkix;
@ -68,6 +69,11 @@ AppTrustDomain::SetTrustedRoot(AppTrustedRoot trustedRoot)
trustedDER.len = mozilla::ArrayLength(marketplaceDevReviewersRoot);
break;
case nsIX509CertDB::AppMarketplaceStageRoot:
trustedDER.data = const_cast<uint8_t*>(marketplaceStageRoot);
trustedDER.len = mozilla::ArrayLength(marketplaceStageRoot);
break;
case nsIX509CertDB::AppXPCShellRoot:
trustedDER.data = const_cast<uint8_t*>(xpcshellRoot);
trustedDER.len = mozilla::ArrayLength(xpcshellRoot);

Просмотреть файл

@ -17,6 +17,9 @@ marketplace-dev-public.inc: marketplace-dev-public.crt $(GEN_CERT_HEADER)
marketplace-dev-reviewers.inc: marketplace-dev-reviewers.crt $(GEN_CERT_HEADER)
$(PYTHON) $(GEN_CERT_HEADER) marketplaceDevReviewersRoot $< > $@
marketplace-stage.inc: marketplace-stage.crt $(GEN_CERT_HEADER)
$(PYTHON) $(GEN_CERT_HEADER) marketplaceStageRoot $< > $@
xpcshell.inc: $(srcdir)/../manager/ssl/tests/unit/test_signed_apps/trusted_ca1.der $(GEN_CERT_HEADER)
$(PYTHON) $(GEN_CERT_HEADER) xpcshellRoot $< > $@
@ -25,5 +28,6 @@ export:: \
marketplace-prod-reviewers.inc \
marketplace-dev-public.inc \
marketplace-dev-reviewers.inc \
marketplace-stage.inc \
xpcshell.inc \
$(NULL)

Двоичные данные
security/apps/marketplace-stage.crt Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -19,7 +19,7 @@ interface nsIX509CertList;
typedef uint32_t AppTrustedRoot;
[scriptable, function, uuid(5984db62-d0e5-4671-a082-799cf7271e24)]
[scriptable, function, uuid(fc2b60e5-9a07-47c2-a2cd-b83b68a660ac)]
interface nsIOpenSignedAppFileCallback : nsISupports
{
void openSignedAppFileFinished(in nsresult rv,
@ -299,7 +299,8 @@ interface nsIX509CertDB : nsISupports {
const AppTrustedRoot AppMarketplaceProdReviewersRoot = 2;
const AppTrustedRoot AppMarketplaceDevPublicRoot = 3;
const AppTrustedRoot AppMarketplaceDevReviewersRoot = 4;
const AppTrustedRoot AppXPCShellRoot = 5;
const AppTrustedRoot AppMarketplaceStageRoot = 5;
const AppTrustedRoot AppXPCShellRoot = 6;
void openSignedAppFileAsync(in AppTrustedRoot trustedRoot,
in nsIFile aJarFile,
in nsIOpenSignedAppFileCallback callback);