diff --git a/dom/apps/PermissionsTable.jsm b/dom/apps/PermissionsTable.jsm index 9887e90b1483..e02d771afd75 100644 --- a/dom/apps/PermissionsTable.jsm +++ b/dom/apps/PermissionsTable.jsm @@ -411,8 +411,13 @@ this.PermissionsTable = { geolocation: { app: DENY_ACTION, trusted: DENY_ACTION, privileged: DENY_ACTION, - certified: ALLOW_ACTION, - access: ["read", "write"] + certified: ALLOW_ACTION + }, + "nfc-share": { + app: DENY_ACTION, + trusted: DENY_ACTION, + privileged: DENY_ACTION, + certified: ALLOW_ACTION }, "nfc-manager": { app: DENY_ACTION, diff --git a/dom/nfc/nsNfc.js b/dom/nfc/nsNfc.js index 2887d8f89508..fc3dda88d868 100644 --- a/dom/nfc/nsNfc.js +++ b/dom/nfc/nsNfc.js @@ -389,7 +389,7 @@ MozNFCImpl.prototype = { return; } - if (!this.checkPermissions(["nfc-read", "nfc-write"])) { + if (!this.checkPermissions(["nfc"])) { return; } @@ -426,7 +426,7 @@ MozNFCImpl.prototype = { return; } - if (!this.checkPermissions(["nfc-read", "nfc-write"])) { + if (!this.checkPermissions(["nfc"])) { return; } @@ -461,7 +461,8 @@ MozNFCImpl.prototype = { return; } - if (!this.checkPermissions(["nfc-write"])) { + let perm = isPeerReady ? ["nfc-share"] : ["nfc"]; + if (!this.checkPermissions(perm)) { return; } @@ -483,7 +484,7 @@ MozNFCImpl.prototype = { return; } - if (!this.checkPermissions(["nfc-write"])) { + if (!this.checkPermissions(["nfc", "nfc-share"])) { return; } diff --git a/dom/webidl/MozNFC.webidl b/dom/webidl/MozNFC.webidl index 5fa99daddc99..62ddf94d1b17 100644 --- a/dom/webidl/MozNFC.webidl +++ b/dom/webidl/MozNFC.webidl @@ -78,7 +78,7 @@ interface MozNFCManager { [JSImplementation="@mozilla.org/navigatorNfc;1", NavigatorProperty="mozNfc", Func="Navigator::HasNFCSupport", - CheckPermissions="nfc-read nfc-write", + CheckPermissions="nfc nfc-share", AvailableIn="CertifiedApps"] interface MozNFC : EventTarget { /** @@ -86,32 +86,28 @@ interface MozNFC : EventTarget { * to share data to the NFCPeer object by calling mozNFC.notifyUserAcceptedP2P. * The event will be type of NFCPeerEvent. */ - [CheckPermissions="nfc-write"] + [CheckPermissions="nfc-share"] attribute EventHandler onpeerready; /** * This event will be fired when a NFCPeer is detected. */ - [CheckPermissions="nfc-write"] attribute EventHandler onpeerfound; /** * This event will be fired when NFCPeer, earlier detected in onpeerready * or onpeerfound, moves out of range. */ - [CheckPermissions="nfc-write"] attribute EventHandler onpeerlost; /** * Ths event will be fired when a NFCTag is detected. */ - [CheckPermissions="nfc-read nfc-write"] attribute EventHandler ontagfound; /** * This event will be fired if the tag detected in ontagfound has been removed. */ - [CheckPermissions="nfc-read nfc-write"] attribute EventHandler ontaglost; }; diff --git a/dom/webidl/MozNFCPeer.webidl b/dom/webidl/MozNFCPeer.webidl index d9c327766519..93770292af81 100644 --- a/dom/webidl/MozNFCPeer.webidl +++ b/dom/webidl/MozNFCPeer.webidl @@ -19,7 +19,7 @@ interface MozNFCPeer { /** * Send file to peer device. */ - [Throws] + [Throws, CheckPermissions="nfc-share"] Promise sendFile(Blob blob); }; diff --git a/dom/webidl/MozNFCPeerEvent.webidl b/dom/webidl/MozNFCPeerEvent.webidl index edbae6fd1581..102b21bb1674 100644 --- a/dom/webidl/MozNFCPeerEvent.webidl +++ b/dom/webidl/MozNFCPeerEvent.webidl @@ -5,7 +5,7 @@ */ [Constructor(DOMString type, optional MozNFCPeerEventInit eventInitDict), - Func="Navigator::HasNFCSupport", CheckPermissions="nfc-write", + Func="Navigator::HasNFCSupport", CheckPermissions="nfc nfc-share", AvailableIn="CertifiedApps"] interface MozNFCPeerEvent : Event { diff --git a/dom/webidl/MozNFCTagEvent.webidl b/dom/webidl/MozNFCTagEvent.webidl index 1a3c59428056..e4b5cef75ed0 100644 --- a/dom/webidl/MozNFCTagEvent.webidl +++ b/dom/webidl/MozNFCTagEvent.webidl @@ -5,7 +5,7 @@ */ [Constructor(DOMString type, optional MozNFCTagEventInit eventInitDict), - Func="Navigator::HasNFCSupport", CheckPermissions="nfc-read nfc-write", + Func="Navigator::HasNFCSupport", CheckPermissions="nfc", AvailableIn="CertifiedApps"] interface MozNFCTagEvent : Event {