Closed
Bug 991970
Opened 12 years ago
Closed 11 years ago
[B2G][NFC] Support W3C compliant ontagfound, ontaglost
Categories
(Firefox OS Graveyard :: NFC, defect)
Tracking
(tracking-b2g:backlog)
People
(Reporter: dgarnerlee, Assigned: allstars.chh)
References
Details
(Keywords: dev-doc-needed, Whiteboard: [p=3])
Attachments
(3 files, 10 obsolete files)
|
4.79 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
|
22.29 KB,
patch
|
allstars.chh
:
review+
|
Details | Diff | Splinter Review |
|
3.46 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
See also: https://bugzilla.mozilla.org/show_bug.cgi?id=963533#c5
Investigate and create W3C compliant "ontagfound"/"ontaglost" Currently, they are "nfc-ndef-discovered" and "nfc-tag-discovered" and "nfc-tech-lost" activities.
A new system message ("Activity picker" that instead invokes the on<event> callback) and support for getting NFC interface objects in the argument list is needed for this to happen.
Updated•12 years ago
|
blocking-b2g: --- → backlog
| Reporter | ||
Comment 2•12 years ago
|
||
| Reporter | ||
Comment 3•12 years ago
|
||
WIP Gaia change: ontagfound with unimplemented ndefmessage.
| Reporter | ||
Comment 4•12 years ago
|
||
Perhaps a obvious note: the manifest.webapp specifies the accepted activities, but instead of the registered callback for 'activity', ontagfound/ontaglost will be called instead.
Ignoring implementation, the proposed change for compliance is going to be somewhat unnatural, when it works as designed.
Feedback is welcome.
| Reporter | ||
Comment 5•12 years ago
|
||
Attachment #8422713 -
Attachment is obsolete: true
| Reporter | ||
Comment 6•12 years ago
|
||
Attachment #8422742 -
Attachment is obsolete: true
| Reporter | ||
Comment 7•12 years ago
|
||
| Assignee | ||
Updated•11 years ago
|
Blocks: b2g-nfc-privilege
| Assignee | ||
Comment 8•11 years ago
|
||
Why does this depend on Bug 1075198?
In ontagfound the parameter should be type of MozNFCTag, not Uint8Array.
| Assignee | ||
Comment 9•11 years ago
|
||
Hi Garner
This bug has been filed for a while and no recently update, almost 4 months.
Like onpeerfound, we will handle 'how to dispatch event to foregound' to Bug 1082440.
So in this bug you can just focus on the 'dispatch ontagfound with a MozNFCTagEvent'.
This bug is blocking our plan (Bug 1042851) now also it blocks our following work on MozNFCTag object.
Given it already takes 4 months,
Please update the status here and provide ETA to finish this.
If you don't have any progress, then I'll take this bug because of priority.
Thanks
Flags: needinfo?(dgarnerlee)
| Reporter | ||
Comment 10•11 years ago
|
||
I'll take another look. The main issue that remains unsolved is the whole "declare a system message/activity handler" in manifest, and then declare another event handler to handle the tag data/event object. It'll work (as in the outdated WIP), just not really good solution. On the other hand, it can solved in a separate bug, and example code supplied until the original callback is simply redundant.
For the event handler, it should also contain data as a field (Uint8Array, which isn't supported by the event object code generator), unless we want the data to arrive separately in the message handler callback. I workaround is to just directly implement the event ourselves. This seems to be discouraged in new code.
(In reply to Yoshi Huang[:allstars.chh] from comment #9)
> Hi Garner
>
> This bug has been filed for a while and no recently update, almost 4 months.
>
> Like onpeerfound, we will handle 'how to dispatch event to foregound' to Bug
> 1082440.
> So in this bug you can just focus on the 'dispatch ontagfound with a
> MozNFCTagEvent'.
>
> This bug is blocking our plan (Bug 1042851) now also it blocks our following
> work on MozNFCTag object.
>
> Given it already takes 4 months,
> Please update the status here and provide ETA to finish this.
> If you don't have any progress, then I'll take this bug because of priority.
>
> Thanks
Flags: needinfo?(dgarnerlee)
| Assignee | ||
Comment 11•11 years ago
|
||
(In reply to Garner Lee from comment #10)
> On the other hand, it can
> solved in a separate bug,
File anothe bug to address your concern.
> For the event handler, it should also contain data as a field (Uint8Array,
> which isn't supported by the event object code generator), unless we want
> the data to arrive separately in the message handler callback. I workaround
> is to just directly implement the event ourselves. This seems to be
> discouraged in new code.
I think you mean to contain the MozNDEFRecord, not just the payload(Uint8Array)
I will try if I can add MozNDEFRecord in thie bug,
So in the ontagfound callback it will have evt.tag for the NFCTag object and evt.ndef for the NDEF.
Also I still didn't see new WIP patch on this, I'll take this one.
Assignee: dgarnerlee → allstars.chh
| Assignee | ||
Updated•11 years ago
|
Updated•11 years ago
|
Keywords: dev-doc-needed
| Assignee | ||
Comment 12•11 years ago
|
||
Attachment #8446326 -
Attachment is obsolete: true
Attachment #8446328 -
Attachment is obsolete: true
Attachment #8446330 -
Attachment is obsolete: true
| Assignee | ||
Comment 13•11 years ago
|
||
| Assignee | ||
Comment 14•11 years ago
|
||
Attachment #8509319 -
Attachment is obsolete: true
| Assignee | ||
Comment 15•11 years ago
|
||
Attachment #8509320 -
Attachment is obsolete: true
| Assignee | ||
Comment 16•11 years ago
|
||
Comment on attachment 8510161 [details] [diff] [review]
Part 2: implement ontagfound/lost
Review of attachment 8510161 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/nfc/nsINfcContentHelper.idl
@@ +41,5 @@
> *
> * @param sessionToken
> * SessionToken received from Chrome process
> */
> + void notifyPeerReady(in DOMString sessionToken);
Here and Below I just changed the indent from 3 spaces to 2 spaces.
Attachment #8510161 -
Flags: review?(dlee)
| Assignee | ||
Comment 17•11 years ago
|
||
I have problems running marionette-webapi now, so I'd complete the test case in Bug 1087928.
| Assignee | ||
Updated•11 years ago
|
Attachment #8510161 -
Flags: review?(dlee)
| Assignee | ||
Comment 18•11 years ago
|
||
Attachment #8510161 -
Attachment is obsolete: true
Attachment #8510227 -
Flags: review?(dlee)
Comment 19•11 years ago
|
||
Comment on attachment 8510227 [details] [diff] [review]
Part 2: implement ontagfound/lost
Review of attachment 8510227 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/nfc/gonk/Nfc.js
@@ +562,5 @@
> }
>
> SessionHelper.unregisterSession(message.sessionId);
> // Do not expose the actual session to the content
> delete message.sessionId;
If we do not want to expose sessionID to content, maybe we should move this before onPeerLost/onTagLost
::: dom/nfc/nsINfcContentHelper.idl
@@ +72,5 @@
> nsIDOMDOMRequest connect(in nsIDOMWindow window, in unsigned long techType, in DOMString sessionToken);
> nsIDOMDOMRequest close(in nsIDOMWindow window, in DOMString sessionToken);
>
> + /**
> + * Initiate Send file operation
Nits. send
::: dom/nfc/nsNfc.js
@@ +200,5 @@
> +
> + set ontaglost(handler) {
> + this.__DOM_IMPL__.setEventHandler("ontaglost", handler);
> + },
> +
I would suggest another coding style because we will have many NFC events (taglost,tagfound,peerfound,peerready,peerlost).
init: function init(aWindow) {
this.defineEventHandlerGetterSetter("onpeerfound");
this.defineEventHandlerGetterSetter("onpeerready");
this.defineEventHandlerGetterSetter("onpeerlost");
this.defineEventHandlerGetterSetter("ontagfound");
this.defineEventHandlerGetterSetter("ontaglost");
},
defineEventHandlerGetterSetter: function(name) {
Object.defineProperty(this, name, {
get: function() {
return this.__DOM_IMPL__.getEventHandler(name);
},
set: function(handler) {
this.__DOM_IMPL__.setEventHandler(name, handler);
}
});
},
::: dom/webidl/MozNFC.webidl
@@ +75,5 @@
> +
> + /**
> + * Ths event will be fired when a NFCTag is detected.
> + */
> + attribute EventHandler ontagfound;
ontagfound will get MozNFCTagEvent with tag data, should we add
[CheckPermissions="nfc-read"] here ?
@@ +80,5 @@
> +
> + /**
> + * This event will be fired if the tag detected in ontagfound has been removed.
> + */
> + attribute EventHandler ontaglost;
I don't understand why onpeerlost require nfc-write permission.
So I am a little bit confused if we also need permission check in ontaglost EventHandler
::: dom/webidl/MozNFCTagEvent.webidl
@@ +4,5 @@
> + * You can obtain one at http://mozilla.org/MPL/2.0/.
> + */
> +
> +[Constructor(DOMString type, optional MozNFCTagEventInit eventInitDict),
> + Func="Navigator::HasNFCSupport", AvailableIn="CertifiedApps"]
require nfc-write & nfc-read ?
@@ +24,5 @@
> +{
> + MozNFCTag? tag = null;
> +
> + sequence<MozNDEFRecord>? ndefRecords = [];
> +};
MozNFCTagEvent should be added to test_all_synthetic_events.html
Attachment #8510227 -
Flags: review?(dlee)
| Assignee | ||
Comment 20•11 years ago
|
||
Attachment #8510227 -
Attachment is obsolete: true
Attachment #8511832 -
Flags: review?(dlee)
Updated•11 years ago
|
Attachment #8511832 -
Flags: review?(dlee) → review+
| Assignee | ||
Comment 21•11 years ago
|
||
Comment on attachment 8511832 [details] [diff] [review]
Part 2: implement ontagfound/lost v2.
Add r? to smaug for requesting review for:
1. WebIDL changed MozNFC.webidl, and MozNFCTagEvent.webidl.
2. IDL changed in nsINfcContentHelper.idl: the techList in nsINfcTagEvent actually is an array of NFCTechType defined in dom/webidl/MozNFCTag.webidl, I use nsIVariant to represent this.
3. modifying test case in dom/events/test/test_all_synthetic_events.html since I added a MozNFCTagEvent.
Thanks
Attachment #8511832 -
Flags: review?(bugs)
| Assignee | ||
Comment 22•11 years ago
|
||
Comment on attachment 8510160 [details] [diff] [review]
Part 1: indent to 2 spaces.
fixed indent to 2 spaces.
Attachment #8510160 -
Flags: review?(bugs)
Updated•11 years ago
|
Attachment #8510160 -
Flags: review?(bugs) → review+
Comment 23•11 years ago
|
||
Comment on attachment 8511832 [details] [diff] [review]
Part 2: implement ontagfound/lost v2.
I wouldn't talk about Chrome process, but either chrome process or parent process. On IRC people said they use 'parent process'.
Attachment #8511832 -
Flags: review?(bugs) → review+
| Assignee | ||
Comment 24•11 years ago
|
||
s/Chrome/parent/g
Attachment #8511832 -
Attachment is obsolete: true
Attachment #8512417 -
Flags: review+
| Assignee | ||
Comment 25•11 years ago
|
||
Add permission check based on the comment in https://bugzilla.mozilla.org/show_bug.cgi?id=1003268#c38
Attachment #8512452 -
Flags: review?(bugs)
Updated•11 years ago
|
Attachment #8512452 -
Flags: review?(bugs) → review+
| Assignee | ||
Comment 26•11 years ago
|
||
| Assignee | ||
Comment 27•11 years ago
|
||
| Assignee | ||
Updated•11 years ago
|
Whiteboard: [p=3]
Target Milestone: --- → 2.1 S8 (7Nov)
Comment 28•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/c74213e2f68f
https://hg.mozilla.org/mozilla-central/rev/66002b73a68b
https://hg.mozilla.org/mozilla-central/rev/627bfb5807ea
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
| Assignee | ||
Updated•11 years ago
|
No longer blocks: b2g-nfc-privilege
| Assignee | ||
Updated•11 years ago
|
Blocks: b2g-nfc-privilege
Updated•11 years ago
|
blocking-b2g: backlog → ---
tracking-b2g:
--- → backlog
You need to log in
before you can comment on or make changes to this bug.
Description
•