Skip to content

Commit

Permalink
Add create steps for absolute-URL records (#512)
Browse files Browse the repository at this point in the history
* Add create steps for absolute URL records

* Explicitely set ndef PAYLOAD related fields
  • Loading branch information
beaufortfrancois authored and kenchris committed Jan 3, 2020
1 parent b1a2853 commit de6de3c
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion index.html
Expand Up @@ -2766,7 +2766,13 @@ <h3><dfn>Writing or pushing content</dfn></h3>
|ndef|.
</li>
</ul>
<!-- TODO: "absolute-url" -->
<dt>"`absolute-url`"</dt>
<ul>
<li>
Return <a>map absolute-URL to NDEF</a> given |record| and
|ndef|.
</li>
</ul>
</dl>
</li>
<li>
Expand Down Expand Up @@ -3363,6 +3369,47 @@ <h3><dfn>Writing or pushing content</dfn></h3>
</ol>
</div>
</section>

<section><h3>Mapping absolute-URL to NDEF</h3>
<div>
To <dfn>map absolute-URL to NDEF</dfn> given a |record:NDEFRecordInit|
and |ndef|, run these steps:
<ol class=algorithm data-link-for="NDEFRecord">
<li>
If |record|'s <a>mediaType</a> is not `undefined`,
[= exception/throw =] a {{TypeError}} and abort these steps.
</li>
<li>
If |record|'s <a>data</a> is not a {{DOMString}},
[= exception/throw =] a {{TypeError}} and abort these steps.
</li>
<li>
If the result of <a data-lt="url parser">parsing</a> |record|'s
<a>data</a> is failure, [= exception/throw =] a
{{SyntaxError}} and abort these steps.
</li>
<li>
Set |arrayBuffer| to |record|'s <a>data</a>.
</li>
<li>
Set |data:byte sequence| to |arrayBuffer|.[[\ArrayBufferData]].
</li>
<li>
Set |ndef|'s <a>TNF field</a> to `3` ([=absolute-URL record=]).
</li>
<li>
Set |ndef|'s <a>TYPE field</a> to |data|.
</li>
<li>
Set |ndef|'s <a>PAYLOAD LENGTH field</a> to `0` and omit <a>PAYLOAD
field</a>.
</li>
<li>
Return |ndef|.
</li>
</ol>
</div>
</section>
</section>

<section> <h3>Listening for content</h3>
Expand Down

0 comments on commit de6de3c

Please sign in to comment.