mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 846057 - Add testPermission and hasPermission APIs. r=jgriffin
This commit is contained in:
parent
d2f9772497
commit
e9952adf69
@ -236,6 +236,19 @@ SpecialPowersObserverAPI.prototype = {
|
||||
case "remove":
|
||||
Services.perms.removeFromPrincipal(principal, msg.type);
|
||||
break;
|
||||
case "has":
|
||||
let hasPerm = Services.perms.testPermissionFromPrincipal(principal, msg.type);
|
||||
if (hasPerm == Ci.nsIPermissionManager.ALLOW_ACTION)
|
||||
return true;
|
||||
return false;
|
||||
break;
|
||||
case "test":
|
||||
let testPerm = Services.perms.testPermissionFromPrincipal(principal, msg.type, msg.value);
|
||||
if (testPerm == msg.value) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
throw new SpecialPowersException("Invalid operation for " +
|
||||
"SPPermissionManager");
|
||||
|
@ -1244,7 +1244,7 @@ SpecialPowersAPI.prototype = {
|
||||
: Ci.nsIPermissionManager.DENY_ACTION;
|
||||
|
||||
var msg = {
|
||||
'op': "add",
|
||||
'op': 'add',
|
||||
'type': type,
|
||||
'permission': permission,
|
||||
'url': url,
|
||||
@ -1259,7 +1259,7 @@ SpecialPowersAPI.prototype = {
|
||||
let [url, appId, isInBrowserElement] = this._getInfoFromPermissionArg(arg);
|
||||
|
||||
var msg = {
|
||||
'op': "remove",
|
||||
'op': 'remove',
|
||||
'type': type,
|
||||
'url': url,
|
||||
'appId': appId,
|
||||
@ -1269,6 +1269,33 @@ SpecialPowersAPI.prototype = {
|
||||
this._sendSyncMessage('SPPermissionManager', msg);
|
||||
},
|
||||
|
||||
hasPermission: function (type, arg) {
|
||||
let [url, appId, isInBrowserElement] = this._getInfoFromPermissionArg(arg);
|
||||
|
||||
var msg = {
|
||||
'op': 'has',
|
||||
'type': type,
|
||||
'url': url,
|
||||
'appId': appId,
|
||||
'isInBrowserElement': isInBrowserElement
|
||||
};
|
||||
|
||||
return this._sendSyncMessage('SPPermissionManager', msg)[0];
|
||||
},
|
||||
testPermission: function (type, value, arg) {
|
||||
let [url, appId, isInBrowserElement] = this._getInfoFromPermissionArg(arg);
|
||||
|
||||
var msg = {
|
||||
'op': 'test',
|
||||
'type': type,
|
||||
'value': value,
|
||||
'url': url,
|
||||
'appId': appId,
|
||||
'isInBrowserElement': isInBrowserElement
|
||||
};
|
||||
return this._sendSyncMessage('SPPermissionManager', msg)[0];
|
||||
},
|
||||
|
||||
getMozFullPath: function(file) {
|
||||
return file.mozFullPath;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user