calling some NFCTag API should throw if the condition is not met.

RESOLVED FIXED in 2.1 S9 (21Nov)

Status

Firefox OS
NFC
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: allstars, Unassigned)

Tracking

unspecified
2.1 S9 (21Nov)
ARM
Gonk (Firefox OS)
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [p=1])

Attachments

(1 attachment, 1 obsolete attachment)

In Bug 1074611 we will add maxNDEFSize, isReadOnly, canBeMadeReadOnly attributes into MozNFCTag.

So the following situations should throw.
1. Writing a NDEF that exceeds the maxNDEFSize or isReadOnly is true
2. call makeReadOnly when canBeMadeReadOnly is false.
Also calling format when the tag is not formatable should throw.
Depends on: 1086179
(Assignee)

Updated

4 years ago
No longer depends on: 1086179
Created attachment 8517321 [details] [diff] [review]
Patch
Assignee: nobody → allstars.chh
Attachment #8517321 - Flags: review?(dlee)
(Assignee)

Updated

4 years ago
No longer blocks: 1042851
(Assignee)

Updated

4 years ago
Blocks: 1042851
(Assignee)

Updated

4 years ago
No longer blocks: 1042851
Comment on attachment 8517321 [details] [diff] [review]
Patch

Review of attachment 8517321 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/nfc/nsNfc.js
@@ +78,5 @@
> +
> +    let ndefLen = 0;
> +    for (let record of records) {
> +      let idLen = record.id.length ? 1 : 0;
> +      let payloadLen = record.payload.length > 256 ? 4 : 1;

Check the NDEF spec,it doesn't define that a NDEF record with payload length less than 256, it must use a short record.
So we should check SR field in flag here.
Attachment #8517321 - Flags: review?(dlee)
(In reply to Dimi Lee[:dimi][:dlee] from comment #3)
> Comment on attachment 8517321 [details] [diff] [review]
> Patch
> 
> Review of attachment 8517321 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: dom/nfc/nsNfc.js
> @@ +78,5 @@
> > +
> > +    let ndefLen = 0;
> > +    for (let record of records) {
> > +      let idLen = record.id.length ? 1 : 0;
> > +      let payloadLen = record.payload.length > 256 ? 4 : 1;
> 
> Check the NDEF spec,it doesn't define that a NDEF record with payload length
> less than 256, it must use a short record.
> So we should check SR field in flag here.
After checking, the flag in NDEF is set in nfcd not in App, so current way is correct.
(Assignee)

Updated

4 years ago
Depends on: 1094669

Updated

4 years ago
Attachment #8517321 - Flags: review+
Created attachment 8518682 [details] [diff] [review]
Patch v2.

use record.size base on Bug 1094669.
Attachment #8517321 - Attachment is obsolete: true
Attachment #8518682 - Flags: review?(dlee)

Updated

4 years ago
Attachment #8518682 - Flags: review?(dlee) → review+
Comment on attachment 8518682 [details] [diff] [review]
Patch v2.

Add r? to smaug for reviewing the DOMError part.
Attachment #8518682 - Flags: review?(bugs)

Updated

4 years ago
Attachment #8518682 - Flags: review?(bugs) → review+
https://hg.mozilla.org/integration/b2g-inbound/rev/b6e75437bc68
Whiteboard: [p=1]
Target Milestone: --- → 2.1 S9 (21Nov)
https://hg.mozilla.org/mozilla-central/rev/b6e75437bc68
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
(Assignee)

Updated

4 years ago
Blocks: 1042851
You need to log in before you can comment on or make changes to this bug.