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
Родитель 93e91906db
Коммит cf23e7a288
2 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

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