Skip to content

Commit aa2c2f8

Browse files
committed
Revert to the 'activated reader objects' internal slot and allow multiple readers
Signed-off-by: Zoltan Kis <[email protected]>
1 parent bf7a613 commit aa2c2f8

File tree

1 file changed

+41
-65
lines changed

1 file changed

+41
-65
lines changed

index.html

Lines changed: 41 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -2079,11 +2079,10 @@ <h2>The <dfn>record type</dfn> string</h2>
20792079
</td>
20802080
</tr>
20812081
<tr>
2082-
<td><dfn>[[\PendingRead]]</dfn></td>
2082+
<td><dfn>[[\ActivatedReaderList]]</dfn></td>
20832083
<td>empty <a>set</a></td>
20842084
<td>
2085-
A &lt;|promise:Promise|, |reader:NDEFReader|&gt; tuple where |promise|
2086-
holds a {{Promise}} and |reader| holds an {{NDEFReader}}.
2085+
A <a>set</a> of {{NDEFReader}} instances.
20872086
</td>
20882087
</tr>
20892088
<tr>
@@ -2097,8 +2096,8 @@ <h2>The <dfn>record type</dfn> string</h2>
20972096
</tbody>
20982097
</table>
20992098
<p>
2100-
The <dfn>pending read tuple</dfn> is the value of the
2101-
<a>[[\PendingRead]]</a> internal slot.
2099+
The <dfn>activated reader objects</dfn> is the value of the
2100+
<a>[[\ActivatedReaderList]]</a> internal slot.
21022101
</p>
21032102
<p>
21042103
The <dfn>pending write tuple</dfn> is the value of the
@@ -2225,31 +2224,6 @@ <h2>The <dfn>record type</dfn> string</h2>
22252224
</div>
22262225
</section>
22272226

2228-
<section><h3>Aborting pending scan operation</h3>
2229-
<div>
2230-
To attempt to <dfn>abort a pending scan operation</dfn>,
2231-
run the following steps:
2232-
<ol class=algorithm>
2233-
<li>
2234-
If there is no <a>pending read tuple</a> |tuple|, abort these steps.
2235-
</li>
2236-
<li>
2237-
If |tuple|'s reader has already initiated an ongoing NFC data transfer,
2238-
abort these steps.
2239-
</li>
2240-
<li>
2241-
Reject |tuple|'s promise with an {{"InvalidStateError"}} {{DOMException}}.
2242-
</li>
2243-
<li>
2244-
Stop the <a>dispatch NFC content</a> steps.
2245-
</li>
2246-
<li>
2247-
Clear the <a>pending read tuple</a>.
2248-
</li>
2249-
</ol>
2250-
</div>
2251-
</section>
2252-
22532227
<section><h3>Releasing NFC</h3>
22542228
<p>
22552229
To <dfn>release NFC</dfn> on an <a>environment settings object</a>,
@@ -2263,7 +2237,7 @@ <h2>The <dfn>record type</dfn> string</h2>
22632237
Attempt to <a>abort a pending write operation</a>.
22642238
</li>
22652239
<li>
2266-
Attempt to <a>abort a pending scan operation</a>.
2240+
Clear the <a>activated reader objects</a>.
22672241
</li>
22682242
<li>
22692243
Release the NFC resources on the underlying platform.
@@ -3418,9 +3392,9 @@ <h3><dfn>Writing content</dfn></h3>
34183392
accessible to the client.
34193393
</p>
34203394
<p>
3421-
If there is a <a>pending read tuple</a> whose |reader| is an
3422-
{{NDEFReader}} instance, then the <a>UA</a> MUST listen to
3423-
<a>NDEF message</a>s on all connected NFC adapters.
3395+
If there are any {{NDEFReader}} instances in <a>activated reader objects</a>
3396+
then the <a>UA</a> MUST listen to <a>NDEF message</a>s on all connected
3397+
NFC adapters.
34243398
</p>
34253399

34263400
<section> <h3>The <strong>scan()</strong> method</h3>
@@ -3440,15 +3414,6 @@ <h3><dfn>Writing content</dfn></h3>
34403414
browsing context</a>, then reject |p| with an
34413415
{{"InvalidStateError"}} {{DOMException}} and return |p|.
34423416
</li>
3443-
<li>
3444-
If there is a <a>pending read tuple</a> |tuple|, then reject |p|
3445-
with an {{"InvalidStateError"}} {{DOMException}} and return |p|.
3446-
<p class="note">
3447-
Note that scans need to be explicitly aborted before a new scan
3448-
could be done, and this behavior is different from writes, which
3449-
automatically abort and replace pending writes.
3450-
</p>
3451-
</li>
34523417
<li>
34533418
Let |reader:NDEFReader| be the {{NDEFReader}} instance.
34543419
</li>
@@ -3466,23 +3431,25 @@ <h3><dfn>Writing content</dfn></h3>
34663431
<li>
34673432
If |signal| is not `null`, then
34683433
<a data-cite="dom#abortsignal-abort-algorithms">
3469-
add the following abort steps</a> to |signal|:
3470-
<ol>
3471-
<li>
3472-
Clear the <a>pending read tuple</a> .
3473-
</li>
3474-
<li>
3475-
Make a request to stop listening to <a>NDEF message</a>s
3476-
on all <a>NFC adapter</a>s.
3477-
</li>
3478-
</ol>
3434+
add the following <dfn>abort the pending scans</dfn> steps</a>
3435+
to |signal|:
3436+
<ol>
3437+
<li>
3438+
Remove |reader| from the <a>activated reader objects</a>.
3439+
</li>
3440+
<li>
3441+
If the <a>activated reader objects</a> [= list/is empty =],
3442+
then make a request to stop listening to <a>NDEF message</a>s
3443+
on all <a>NFC adapter</a>s.
3444+
</li>
3445+
</ol>
34793446
</li>
34803447
<li>
34813448
[=promise/React=] to |p|:
34823449
<ol>
34833450
<li>
3484-
If |p| was settled (fulfilled or rejected), then clear the
3485-
<a>pending read tuple</a>.
3451+
If |p| was settled (fulfilled or rejected), then
3452+
<a>abort the pending scans</a>.
34863453
</li>
34873454
</ol>
34883455
</li>
@@ -3507,7 +3474,7 @@ <h3><dfn>Writing content</dfn></h3>
35073474
and abort these steps.
35083475
</li>
35093476
<li>
3510-
Set the <a>pending read tuple</a> to (|p|, |reader|).
3477+
Add |reader| to the <a>activated reader objects</a>.
35113478
</li>
35123479
<li>
35133480
Resolve |p|.
@@ -3532,10 +3499,14 @@ <h3><dfn>Writing content</dfn></h3>
35323499
If the <a>NFC tag</a> in proximity range does not expose <a>NDEF</a>
35333500
technology for reading or formatting, run the following sub-steps:
35343501
<ol>
3535-
<li>
3536-
If there is a <a>pending read tuple</a> whose |reader| is an
3537-
{{NDEFReader}} instance, fire an event</a> named "`readingerror`" at
3538-
|reader|.
3502+
<li>[= list/For each =]
3503+
{{NDEFReader}} instance |reader:NDEFReader| in the
3504+
<a>activated reader objects</a>, run the following sub-steps:
3505+
<ol>
3506+
<li>
3507+
<a>Fire an event</a> named "`error`" at |reader|.
3508+
</li>
3509+
</ol>
35393510
</li>
35403511
<li>
35413512
Abort these steps.
@@ -3602,11 +3573,16 @@ <h3><dfn>Writing content</dfn></h3>
36023573
</p>
36033574
<ol class=algorithm>
36043575
<li>
3605-
If there is a <a>pending read tuple</a> whose |reader| is an
3606-
{{NDEFReader}} instance, <a>fire an event</a> named "`reading`" at
3607-
|reader| using <a>NDEFReadingEvent</a> with its <a>serialNumber</a>
3608-
attribute initialized to |serialNumber| and <a>message</a> attribute
3609-
initialized to |message|.
3576+
[= list/For each =] {{NDEFReader}} instance |reader:NDEFReader| in
3577+
the <a>activated reader objects</a>,
3578+
<ol>
3579+
<li>
3580+
<a>fire an event</a> named "`reading`" at |reader| using
3581+
<a>NDEFReadingEvent</a> with its <a>serialNumber</a> attribute
3582+
initialized to |serialNumber| and its <a>message</a> attribute
3583+
initialized to |message|.
3584+
</li>
3585+
</ol>
36103586
</li>
36113587
</ol>
36123588
</section>

0 commit comments

Comments
 (0)