зеркало из https://github.com/mozilla/gecko-dev.git
Bug 861905 - Contacts API: Shortcut permission check in the child. r=mounir
This commit is contained in:
Родитель
d6381883a6
Коммит
c94f5db02e
|
@ -20,6 +20,10 @@ XPCOMUtils.defineLazyGetter(Services, "DOMRequest", function() {
|
|||
return Cc["@mozilla.org/dom/dom-request-service;1"].getService(Ci.nsIDOMRequestService);
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "pm",
|
||||
"@mozilla.org/permissionmanager;1",
|
||||
"nsIPermissionManager");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsIMessageSender");
|
||||
|
@ -559,6 +563,15 @@ ContactManager.prototype = {
|
|||
access = "unknown";
|
||||
}
|
||||
|
||||
// Shortcut for ALLOW_ACTION so we avoid a parent roundtrip
|
||||
let type = "contacts-" + access;
|
||||
let permValue =
|
||||
pm.testExactPermissionFromPrincipal(this._window.document.nodePrincipal, type);
|
||||
if (permValue == Ci.nsIPermissionManager.ALLOW_ACTION) {
|
||||
aAllowCallback();
|
||||
return;
|
||||
}
|
||||
|
||||
let requestID = this.getRequestId({
|
||||
request: aRequest,
|
||||
allow: function() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче