Bug 856923 - Don't stop installing permissions if one of them has an invalid entry in the manifest. r=gwagner

This commit is contained in:
Reuben Morais 2013-04-05 16:38:08 -07:00
Родитель b4b1d3a327
Коммит 3fd1918417
3 изменённых файлов: 12 добавлений и 7 удалений

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

@ -300,7 +300,7 @@ this.appendAccessToPermName = function appendAccessToPermName(aPermName, aAccess
**/
this.expandPermissions = function expandPermissions(aPermName, aAccess) {
if (!PermissionsTable[aPermName]) {
let errorMsg =
let errorMsg =
"PermissionsTable.jsm: expandPermissions: Unknown Permission: " + aPermName;
Cu.reportError(errorMsg);
dump(errorMsg);
@ -310,7 +310,7 @@ this.expandPermissions = function expandPermissions(aPermName, aAccess) {
const tableEntry = PermissionsTable[aPermName];
if (tableEntry.substitute && tableEntry.additional) {
let errorMsg =
let errorMsg =
"PermissionsTable.jsm: expandPermissions: Can't handle both 'substitute' " +
"and 'additional' entries for permission: " + aPermName;
Cu.reportError(errorMsg);
@ -320,12 +320,12 @@ this.expandPermissions = function expandPermissions(aPermName, aAccess) {
if (!aAccess && tableEntry.access ||
aAccess && !tableEntry.access) {
let errorMsg =
"PermissionsTable.jsm: expandPermissions: Invalid Manifest : " +
aPermName + " " + aAccess + "\n";
let errorMsg =
"PermissionsTable.jsm: expandPermissions: Invalid access for permission " +
aPermName + ": " + aAccess + "\n";
Cu.reportError(errorMsg);
dump(errorMsg);
throw new Error(errorMsg);
return [];
}
let expandedPermNames = [];
@ -423,7 +423,7 @@ this.isExplicitInPermissionsTable = function(aPermName, aIntStatus) {
let realPerm = PermissionsReverseTable[aPermName];
if (realPerm) {
return (PermissionsTable[realPerm][appStatus] ==
return (PermissionsTable[realPerm][appStatus] ==
Ci.nsIPermissionManager.PROMPT_ACTION);
} else {
return false;

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

@ -28,6 +28,7 @@ const TEST_MANIFEST_URL =
const TEST_ORIGIN_URL = "http://mochi.test:8888";
const installedPermsToTest = {
"storage": "unknown",
"geolocation": "prompt",
"alarms": "allow",
"desktop-notification": "allow",

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

@ -3,6 +3,10 @@
"installs_allowed_from": [ "*" ],
"type": "web",
"permissions": {
"storage": {
"access": "readcreate",
"description": "this permission is not needed by the test, it's here to test whether we will properly ignore permissions with the wrong 'access' entry in the manifest"
},
"geolocation": {
"description": "geolocate"
},