Closed
Bug 1055477
Opened 10 years ago
Closed 10 years ago
B2G NFC: Add 'CheckPermission' and AvailableIn in NFC WebIDLs.
Categories
(Firefox OS Graveyard :: NFC, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
2.1 S3 (29aug)
People
(Reporter: allstars.chh, Assigned: allstars.chh)
References
Details
(Whiteboard: [p=2])
Attachments
(3 files, 1 obsolete file)
3.14 KB,
patch
|
smaug
:
review+
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
2.52 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
1.87 KB,
patch
|
allstars.chh
:
review+
|
Details | Diff | Splinter Review |
Right now the function Navigator::HasNfcSupport will also check permissions, however we should do the permission check in the WebIDL part. Also add AvaialbleIn for these NFC WebIDLs.
Assignee | ||
Comment 1•10 years ago
|
||
Assignee | ||
Comment 2•10 years ago
|
||
Assignee | ||
Updated•10 years ago
|
Attachment #8475090 -
Flags: review?(bugs)
Assignee | ||
Updated•10 years ago
|
Attachment #8475091 -
Flags: review?(bugs)
Updated•10 years ago
|
Summary: B2G NFC: Add 'CheckPermission' and AvaialbleIn in NFC WebIDLs. → B2G NFC: Add 'CheckPermission' and AvailableIn in NFC WebIDLs.
Comment 3•10 years ago
|
||
Comment on attachment 8475090 [details] [diff] [review] Part 1: Add CheckPermission !!win is a bit odd, and CheckPermissions in BindingUtils.cpp does similar check already. So you could just return true there.
Attachment #8475090 -
Flags: review?(bugs) → review+
Comment 4•10 years ago
|
||
Comment on attachment 8475091 [details] [diff] [review] Part 2: Add AvailableIn .webidl changes are fine to me, but I think ehsan or sicking should give the opinion why nfc stuff needs to be for certifiedapps only
Attachment #8475091 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 5•10 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #4) > Comment on attachment 8475091 [details] [diff] [review] > Part 2: Add AvailableIn > > .webidl changes are fine to me, but I think ehsan or sicking should give the > opinion why nfc stuff needs to be for certifiedapps only Hi smaug Actually I am not sure when to use AvailableIn. "nfc" permission is already certified now. http://lxr.mozilla.org/mozilla-central/source/dom/apps/src/PermissionsTable.jsm#326 It seems to me CheckPermission is already enough. If AvailableIn is not mandatory I'll remove it and land only Part 1 patch.
Assignee | ||
Comment 6•10 years ago
|
||
Comment on attachment 8475091 [details] [diff] [review] Part 2: Add AvailableIn Review of attachment 8475091 [details] [diff] [review]: ----------------------------------------------------------------- Hi Ehsan Can you help to review this patch for me? Right now NFC is certified API, so I add AvailableIn in these WebIDLs. This came to my mind base on your review on Bug 879861 (NFC Secure Element Support ) and Bug 951976 (API for Resource Statistics), you suggested to add AvailableIn on these WebIDLS. However there's one thing I am not quite sure. These WebIDLs already have CheckPermissions attribute, and why should we need to add "AvailableIn" to these? For example, nfc-manager or resource-manager is already a certified permission, so CheckPermissions="resource-manager" implied the caller is already a certified app. Do we still need to add AvailableIn="CertifiedApps" in this case? Thank you
Attachment #8475091 -
Flags: review?(ehsan)
Comment 7•10 years ago
|
||
(In reply to Yoshi Huang[:allstars.chh] from comment #6) > Comment on attachment 8475091 [details] [diff] [review] > Part 2: Add AvailableIn > > Review of attachment 8475091 [details] [diff] [review]: > ----------------------------------------------------------------- > > Hi Ehsan > Can you help to review this patch for me? > Right now NFC is certified API, so I add AvailableIn in these WebIDLs. > > This came to my mind base on your review on Bug 879861 (NFC Secure Element > Support ) and Bug 951976 (API for Resource Statistics), you suggested to add > AvailableIn on these WebIDLS. > > However there's one thing I am not quite sure. > These WebIDLs already have CheckPermissions attribute, and why should we > need to add "AvailableIn" to these? > > For example, nfc-manager or resource-manager is already a certified > permission, so CheckPermissions="resource-manager" implied the caller is > already a certified app. Do we still need to add AvailableIn="CertifiedApps" > in this case? Our permissions table is the ultimate source of truth when it comes to what kinds of apps can request what types of permissions. So for example, as you suggest, if the resource-manager permission can only be granted to the certified apps, adding the [AvailableIn=CertifiedApps] on top of [CheckPermissions="resource-manager"] won't change where the API is exposed. It would, however, make it *much* easier to read the IDL and figure out where the API is exposed. It also makes exposing the API to let's say privileged apps require a WebIDL change, which means it will require a DOM peer review. Both of these are great results, and I would like to make more APIs use AvailableIn for this reason. If you know of more, please keep these kinds of patches coming. :-) Much appreciated.
Updated•10 years ago
|
Attachment #8475091 -
Flags: review?(ehsan) → review+
Assignee | ||
Comment 8•10 years ago
|
||
(In reply to :Ehsan Akhgari (not reading bugmail, needinfo? me!) from comment #7) > (In reply to Yoshi Huang[:allstars.chh] from comment #6) Thanks for the detail explaination. I got it now. Thank you.
Assignee | ||
Comment 9•10 years ago
|
||
Hi, Smaug I found I forgot to update MozNFCPeerEvent.webidl, and upload another patch for that. Also update test_interfaces.html. Could you help to review this for me ? Thanks
Attachment #8476591 -
Flags: review?(bugs)
Assignee | ||
Comment 10•10 years ago
|
||
Try https://tbpl.mozilla.org/?tree=Try&rev=b9d6bf58c006
Assignee | ||
Comment 11•10 years ago
|
||
Comment on attachment 8475090 [details] [diff] [review] Part 1: Add CheckPermission Review of attachment 8475090 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/base/Navigator.cpp @@ +2314,5 @@ > if (!contentHelper) { > return false; > } > > + return !!win; if return true directly is okay, I'll update the patch to nsCOMPtr<nsISupports> contentHelper = do_GetService("@mozilla.org/nfc/content-helper;1"); return !!contentHelper;
Comment 12•10 years ago
|
||
Oh, sure that is fine.
Comment 13•10 years ago
|
||
Comment on attachment 8476591 [details] [diff] [review] Part 3: Update MozNFCPeerEvent and mochitests. Hmm, we don't have a way to test AvailableIn stuff in test_interfaces :/
Attachment #8476591 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 14•10 years ago
|
||
comment addressed.
Attachment #8475090 -
Attachment is obsolete: true
Attachment #8477975 -
Flags: review+
Assignee | ||
Comment 15•10 years ago
|
||
https://hg.mozilla.org/integration/b2g-inbound/rev/8507f750761a https://hg.mozilla.org/integration/b2g-inbound/rev/7e28bef4ef4f https://hg.mozilla.org/integration/b2g-inbound/rev/48d86bbd3cc6
Assignee | ||
Updated•10 years ago
|
Whiteboard: [p=2]
Target Milestone: --- → 2.1 S3 (29aug)
Assignee | ||
Comment 16•10 years ago
|
||
forgot to paste try : https://tbpl.mozilla.org/?tree=Try&rev=970d0cbf6ab3
Comment 17•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/8507f750761a https://hg.mozilla.org/mozilla-central/rev/7e28bef4ef4f https://hg.mozilla.org/mozilla-central/rev/48d86bbd3cc6
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•