mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 760365. Preload appcache into webapp's profile during installation. r=marco
Linux profile creation by Marco, r=felipe
This commit is contained in:
parent
8d23fa6f5f
commit
585babe305
@ -42,10 +42,10 @@ let WebappsInstaller = {
|
||||
shell.install();
|
||||
} catch (ex) {
|
||||
Cu.reportError("Error installing app: " + ex);
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
return true;
|
||||
return shell;
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,12 +107,16 @@ function NativeApp(aData) {
|
||||
}
|
||||
this.shortDescription = sanitize(shortDesc);
|
||||
|
||||
this.appcacheDefined = (app.manifest.appcache_path != undefined);
|
||||
|
||||
this.manifest = app.manifest;
|
||||
|
||||
this.profileFolder = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||
// The app registry is the Firefox profile from which the app
|
||||
// was installed.
|
||||
this.registryFolder = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||
|
||||
this.webappJson = {
|
||||
"registryDir": this.profileFolder.path,
|
||||
"registryDir": this.registryFolder.path,
|
||||
"app": app
|
||||
};
|
||||
|
||||
@ -170,6 +174,7 @@ WinNativeApp.prototype = {
|
||||
this._createConfigFiles();
|
||||
this._createShortcutFiles();
|
||||
this._writeSystemKeys();
|
||||
this._createAppProfile();
|
||||
} catch (ex) {
|
||||
this._removeInstallation();
|
||||
throw(ex);
|
||||
@ -280,6 +285,20 @@ WinNativeApp.prototype = {
|
||||
this.uninstallDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates the profile to be used for this app.
|
||||
*/
|
||||
_createAppProfile: function() {
|
||||
if (!this.appcacheDefined)
|
||||
return;
|
||||
|
||||
let profSvc = Cc["@mozilla.org/toolkit/profile-service;1"]
|
||||
.getService(Ci.nsIToolkitProfileService);
|
||||
|
||||
this.appProfile = profSvc.createDefaultProfileForApp(this.installDir.leafName,
|
||||
null, null);
|
||||
},
|
||||
|
||||
/**
|
||||
* Copy the pre-built files into their destination folders.
|
||||
*/
|
||||
@ -495,6 +514,7 @@ MacNativeApp.prototype = {
|
||||
this._createDirectoryStructure();
|
||||
this._copyPrebuiltFiles();
|
||||
this._createConfigFiles();
|
||||
this._createAppProfile();
|
||||
} catch (ex) {
|
||||
this._removeInstallation(false);
|
||||
throw(ex);
|
||||
@ -533,6 +553,17 @@ MacNativeApp.prototype = {
|
||||
this.resourcesDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
|
||||
},
|
||||
|
||||
_createAppProfile: function() {
|
||||
if (!this.appcacheDefined)
|
||||
return;
|
||||
|
||||
let profSvc = Cc["@mozilla.org/toolkit/profile-service;1"]
|
||||
.getService(Ci.nsIToolkitProfileService);
|
||||
|
||||
this.appProfile = profSvc.createDefaultProfileForApp(this.appProfileDir.leafName,
|
||||
null, null);
|
||||
},
|
||||
|
||||
_copyPrebuiltFiles: function() {
|
||||
let webapprt = this.runtimeFolder.clone();
|
||||
webapprt.append("webapprt-stub");
|
||||
@ -695,6 +726,7 @@ LinuxNativeApp.prototype = {
|
||||
this._createDirectoryStructure();
|
||||
this._copyPrebuiltFiles();
|
||||
this._createConfigFiles();
|
||||
this._createAppProfile();
|
||||
} catch (ex) {
|
||||
this._removeInstallation();
|
||||
throw(ex);
|
||||
@ -724,6 +756,17 @@ LinuxNativeApp.prototype = {
|
||||
webapprtPre.copyTo(this.installDir, this.webapprt.leafName);
|
||||
},
|
||||
|
||||
_createAppProfile: function() {
|
||||
if (!this.appcacheDefined)
|
||||
return;
|
||||
|
||||
let profSvc = Cc["@mozilla.org/toolkit/profile-service;1"]
|
||||
.getService(Ci.nsIToolkitProfileService);
|
||||
|
||||
return profSvc.createDefaultProfileForApp(this.installDir.leafName,
|
||||
null, null);
|
||||
},
|
||||
|
||||
_createConfigFiles: function() {
|
||||
// ${InstallDir}/webapp.json
|
||||
let configJson = this.installDir.clone();
|
||||
|
@ -109,8 +109,14 @@ let webappsUI = {
|
||||
label: bundle.getString("webapps.install"),
|
||||
accessKey: bundle.getString("webapps.install.accesskey"),
|
||||
callback: function(notification) {
|
||||
if (WebappsInstaller.install(aData)) {
|
||||
DOMApplicationRegistry.confirmInstall(aData);
|
||||
let app = WebappsInstaller.install(aData);
|
||||
if (app) {
|
||||
let localDir = null;
|
||||
if (app.appcacheDefined && app.appProfile) {
|
||||
localDir = app.appProfile.localDir;
|
||||
}
|
||||
|
||||
DOMApplicationRegistry.confirmInstall(aData, false, localDir);
|
||||
} else {
|
||||
DOMApplicationRegistry.denyInstall(aData);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user