Bug 775822 - Use the new Permission Manager API for B2G shell.js and CameraContent.js. r=vingtetun

This commit is contained in:
Mounir Lamouri 2012-07-20 18:06:35 -07:00
parent 4d8c0de9d5
commit ca5f998306
2 changed files with 5 additions and 5 deletions

View File

@ -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']

View File

@ -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;