Bug 932843 - Allow the installation of operator packaged apps without network connection. r=fabrice

This commit is contained in:
Antonio M. Amaya 2013-11-01 02:58:28 +01:00
parent b38db01a4b
commit ad13cc58c1

View File

@ -2154,16 +2154,17 @@ this.DOMApplicationRegistry = {
queuedDownload: {},
queuedPackageDownload: {},
onInstallSuccessAck: function onInstallSuccessAck(aManifestURL) {
onInstallSuccessAck: function onInstallSuccessAck(aManifestURL,
aDontNeedNetwork) {
// If we are offline, register to run when we'll be online.
if (Services.io.offline) {
if ((Services.io.offline) && !aDontNeedNetwork) {
let onlineWrapper = {
observe: function(aSubject, aTopic, aData) {
Services.obs.removeObserver(onlineWrapper,
"network:offline-status-changed");
DOMApplicationRegistry.onInstallSuccessAck(aManifestURL);
}
}
};
Services.obs.addObserver(onlineWrapper,
"network:offline-status-changed", false);
return;
@ -2368,12 +2369,13 @@ this.DOMApplicationRegistry = {
aInstallSuccessCallback(app.manifest);
}
}
let dontNeedNetwork = false;
if (manifest.package_path) {
// If it is a local app then it must been installed from a local file
// instead of web.
let origPath = jsonManifest.package_path;
if (aData.app.localInstallPath) {
dontNeedNetwork = true;
jsonManifest.package_path = "file://" + aData.app.localInstallPath;
}
// origin for install apps is meaningless here, since it's app:// and this
@ -2390,7 +2392,7 @@ this.DOMApplicationRegistry = {
if (aData.forceSuccessAck) {
// If it's a local install, there's no content process so just
// ack the install.
this.onInstallSuccessAck(app.manifestURL);
this.onInstallSuccessAck(app.manifestURL, dontNeedNetwork);
}
},