Bug 1170836 - Importing certified themes in dev mode doesn't work r=ferjm a=ryanvm

This commit is contained in:
Fabrice Desré 2015-06-09 11:22:07 -07:00
parent bdb426b07d
commit 0c44af0c9e

View File

@ -389,6 +389,11 @@ this.ImportExport = {
meta.installerIsBrowser = false;
meta.role = manifest.role;
let devMode = false;
try {
devMode = Services.prefs.getBoolPref("dom.apps.developer_mode");
} catch(e) {}
// Set the appropriate metadata for hosted and packaged apps.
if (isPackage) {
meta.origin = "app://" + meta.id;
@ -398,12 +403,10 @@ this.ImportExport = {
yield DOMApplicationRegistry._openPackage(appFile, meta, false);
let maxStatus = isSigned ? Ci.nsIPrincipal.APP_STATUS_PRIVILEGED
: Ci.nsIPrincipal.APP_STATUS_INSTALLED;
try {
// Anything is possible in developer mode.
if (Services.prefs.getBoolPref("dom.apps.developer_mode")) {
maxStatus = Ci.nsIPrincipal.APP_STATUS_CERTIFIED;
}
} catch(e) {};
// Anything is possible in developer mode.
if (devMode) {
maxStatus = Ci.nsIPrincipal.APP_STATUS_CERTIFIED;
}
meta.appStatus = AppsUtils.getAppManifestStatus(manifest);
debug("Signed app? " + isSigned);
if (meta.appStatus > maxStatus) {
@ -412,12 +415,12 @@ this.ImportExport = {
// Custom origin.
// We unfortunately can't reuse _checkOrigin here.
if (isSigned &&
meta.appStatus == Ci.nsIPrincipal.APP_STATUS_PRIVILEGED &&
if ((isSigned || devMode) &&
meta.appStatus >= Ci.nsIPrincipal.APP_STATUS_PRIVILEGED &&
manifest.origin) {
let uri;
try {
uri = Services.io.newURI(aManifest.origin, null, null);
uri = Services.io.newURI(manifest.origin, null, null);
} catch(e) {
throw "InvalidOrigin";
}