зеркало из https://github.com/mozilla/gecko-dev.git
Bug 775822 - Use the new Permission Manager API for B2G shell.js and CameraContent.js. r=vingtetun
This commit is contained in:
Родитель
93e91906db
Коммит
cf23e7a288
|
@ -246,8 +246,8 @@ var shell = {
|
|||
if (!manifest)
|
||||
return;
|
||||
|
||||
let documentURI = contentWindow.document.documentURIObject;
|
||||
if (!Services.perms.testPermission(documentURI, 'offline-app')) {
|
||||
let principal = contentWindow.document.nodePrincipal;
|
||||
if (Services.perms.testPermissionFromPrincipal(principal, 'offline-app') == Ci.nsIPermissionManager.UNKNOWN_ACTION) {
|
||||
if (Services.prefs.getBoolPref('browser.offline-apps.notify')) {
|
||||
// FIXME Bug 710729 - Add a UI for offline cache notifications
|
||||
return;
|
||||
|
@ -255,8 +255,8 @@ var shell = {
|
|||
return;
|
||||
}
|
||||
|
||||
Services.perms.add(documentURI, 'offline-app',
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
Services.perms.addFromPrincipal(principal, 'offline-app',
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
|
||||
let manifestURI = Services.io.newURI(manifest, null, documentURI);
|
||||
let updateService = Cc['@mozilla.org/offlinecacheupdate-service;1']
|
||||
|
|
|
@ -59,7 +59,7 @@ CameraContent.prototype = {
|
|||
let principal = aWindow.document.nodePrincipal;
|
||||
let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);
|
||||
|
||||
let perm = principal == secMan.getSystemPrincipal() ? Ci.nsIPermissionManager.ALLOW_ACTION : Services.perms.testExactPermission(principal.URI, "content-camera");
|
||||
let perm = Services.perms.testExactPermissionFromPrincipal(principal, "content-camera");
|
||||
|
||||
//only pages with perm set and chrome pages can use the camera in content
|
||||
this.hasPrivileges = perm == Ci.nsIPermissionManager.ALLOW_ACTION;
|
||||
|
|
Загрузка…
Ссылка в новой задаче