Bug 1022791 - Keep previous values for PROMPT permissions on system updates. r=fabrice

This commit is contained in:
Antonio M. Amaya 2014-11-03 02:24:00 -05:00
Родитель 05bde660f6
Коммит 4086676d8a
2 изменённых файлов: 10 добавлений и 9 удалений

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

@ -42,8 +42,8 @@ this.PermissionsInstaller = {
* A function called if an error occurs
* @returns void
**/
installPermissions: function installPermissions(aApp, aIsReinstall, aOnError,
aIsSystemUpdate) {
installPermissions: function installPermissions(aApp, aIsReinstall,
aOnError) {
try {
let newManifest =
new ManifestHelper(aApp.manifest, aApp.origin, aApp.manifestURL);
@ -153,9 +153,12 @@ this.PermissionsInstaller = {
: PermissionsTable[permName][appStatus];
let permValue = PERM_TO_STRING[permission];
if (!aIsSystemUpdate && isPromptPermission) {
// If it's not a system update, then we should keep the prompt
// permissions that have been granted or denied previously.
if (isPromptPermission) {
// If the permission is prompt, keep the current value. This will
// work even on a system update, with the caveat that if a
// ALLOW/DENY permission is changed to PROMPT then the system should
// inform the user that he can now change a permission that he could
// not change before.
permValue =
PermissionSettingsModule.getPermission(expandedPermNames[idx],
aApp.manifestURL,

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

@ -440,7 +440,7 @@ this.DOMApplicationRegistry = {
}
},
updatePermissionsForApp: function(aId, aIsPreinstalled, aIsSystemUpdate) {
updatePermissionsForApp: function(aId, aIsPreinstalled) {
if (!this.webapps[aId]) {
return;
}
@ -458,7 +458,6 @@ this.DOMApplicationRegistry = {
manifestURL: this.webapps[aId].manifestURL,
origin: this.webapps[aId].origin,
isPreinstalled: aIsPreinstalled,
isSystemUpdate: aIsSystemUpdate,
kind: this.webapps[aId].kind
}, true, function() {
debug("Error installing permissions for " + aId);
@ -721,8 +720,7 @@ this.DOMApplicationRegistry = {
continue;
}
this.updateOfflineCacheForApp(id);
this.updatePermissionsForApp(id, isPreinstalled,
true /* isSystemUpdate */);
this.updatePermissionsForApp(id, isPreinstalled);
}
// Need to update the persisted list of apps since
// installPreinstalledApp() removes the ones failing to install.