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

This commit is contained in:
Alfredo Yang 2014-02-09 15:34:43 -05:00
parent 3a4bbe0a0b
commit bbd218f9fe
2 changed files with 20 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,16 @@ 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);