Skip to content

Commit ff8d655

Browse files
committed
Fix #546: check size of SP size and action records data on creation
Signed-off-by: Zoltan Kis <[email protected]>
1 parent 24f5f88 commit ff8d655

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

index.html

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2637,11 +2637,6 @@ <h3><dfn>Writing content</dfn></h3>
26372637
<a>recordType</a> returns `false`, reject |promise| with a
26382638
{{TypeError}} and abort these steps.
26392639
</li>
2640-
<!--
2641-
TODO: include clauses to fix
2642-
https://github.com/w3c/web-nfc/issues/546, i.e.
2643-
check SP size and action records payload size.
2644-
-->
26452640
<li>
26462641
Return the result of running
26472642
<a>map local type to NDEF</a> given |record|, |ndef| and
@@ -3197,6 +3192,19 @@ <h3><dfn>Writing content</dfn></h3>
31973192
Set |ndef|'s <a>TYPE field</a> to |localTypeName|, representing the
31983193
<a>local type name</a>.
31993194
</li>
3195+
<li>
3196+
If |context| is `"smart-poster"`, |localTypeName| is
3197+
<strong>"`s`" (`0x73`)</strong> and if the type of
3198+
|record|'s <a>data</a> is not {{BufferSource}} or its byte length
3199+
is bigger than 4, [= exception/throw =] a {{TypeError}} and abort these steps.
3200+
</li>
3201+
<li>
3202+
If |context| is `"smart-poster"`, |localTypeName| is
3203+
<strong>"`act`" (`0x61` `0x63` `0x74`) </strong> and if the type of
3204+
|record|'s <a>data</a> is not {{BufferSource}} or its byte length
3205+
is not exactly one, [= exception/throw =] a {{TypeError}} and abort
3206+
these steps.
3207+
</li>
32003208
<li>
32013209
If the type of a |record|'s <a>data</a> is {{BufferSource}},
32023210
<ol>
@@ -3232,10 +3240,6 @@ <h3><dfn>Writing content</dfn></h3>
32323240
</li>
32333241
</ol>
32343242
</li>
3235-
<!--
3236-
TODO: clauses to fix https://github.com/w3c/web-nfc/issues/546
3237-
check SP size and action records payload size.
3238-
-->
32393243
<li>
32403244
Return |ndef|.
32413245
</li>

0 commit comments

Comments
 (0)