Bug 853356: gUM video prompt for Contact API prompt. r=fabrice

This commit is contained in:
Alfredo Yang 2014-01-31 15:40:48 -05:00
parent 2e9f77795b
commit 22ba01b127
2 changed files with 21 additions and 4 deletions

View File

@ -74,10 +74,18 @@ this.PermissionPromptHelper = {
}
if (permValue == Ci.nsIPermissionManager.PROMPT_ACTION) {
// create a nsIContentPermissionRequest
let request = {
// create an array with a nsIContentPermissionType element
let type = {
type: msg.type,
access: msg.access ? msg.access : "unused",
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionType])
};
let typeArray = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
typeArray.appendElement(type, false);
// create a nsIContentPermissionRequest
let request = {
types: typeArray,
principal: principal,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionRequest]),
allow: aCallbacks.allow,

View File

@ -68,8 +68,17 @@ PermissionPromptService.prototype = {
+ "2nd argument must be type 'nsIContentPermissionRequest'");
}
let type = aRequest.access !== "unused" ? aRequest.type + "-" + aRequest.access
: aRequest.type;
// Only allow exactly one permission request here.
let types = aRequest.types.QueryInterface(Ci.nsIArray);
if (types.length != 1) {
aRequest.cancel();
return;
}
let reqType = types.queryElementAt(0, Ci.nsIContentPermissionType);
let type = reqType.access !== "unused" ? reqType.type + "-" + reqType.access
: reqType.type;
let perm =
permissionManager.testExactPermissionFromPrincipal(aRequest.principal, type);