Bug 794331 - [Permissions] change fmradio to new permissionManager API. r=cjones
authorGregor Wagner <anygregor@gmail.com>
Wed, 26 Sep 2012 11:00:33 -0700
changeset 108156 8fc98a70f97a5f3a91e08d133660d49793e48e66
parent 108155 b13571ca268d80be7ef1b4a6e279a15fdd37f280
child 108157 8f0b50af10510a9a3fb0450d528e8f9fc4031150
push id15408
push usergwagner@mozilla.com
push dateWed, 26 Sep 2012 18:01:24 +0000
treeherdermozilla-inbound@8fc98a70f97a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones
bugs794331
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 794331 - [Permissions] change fmradio to new permissionManager API. r=cjones
dom/fm/DOMFMRadioChild.js
--- a/dom/fm/DOMFMRadioChild.js
+++ b/dom/fm/DOMFMRadioChild.js
@@ -41,23 +41,20 @@ DOMFMRadioChild.prototype = {
                flags: Ci.nsIClassInfo.DOM_OBJECT
              }),
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMFMRadio,
                                          Ci.nsIDOMGlobalPropertyInitializer]),
 
   // nsIDOMGlobalPropertyInitializer implementation
   init: function(aWindow) {
-    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, "fmradio");
+    let perm = Services.perms.testExactPermissionFromPrincipal(aWindow.document.nodePrincipal, "fmradio");
     this._hasPrivileges = perm == Ci.nsIPermissionManager.ALLOW_ACTION;
 
     if (!this._hasPrivileges) {
       throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
     }
 
     const messages = ["DOMFMRadio:enable:Return:OK",
                       "DOMFMRadio:enable:Return:NO",