Skip to content

Fix #592: allow multiple readers but no multiple scans on any reader #611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Dec 28, 2020
37 changes: 31 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2204,8 +2204,8 @@ <h2>The <dfn>record type</dfn> string</h2>

<section><h3>Aborting pending write operation</h3>
<div>
To attempt to <dfn>abort a pending write operation</dfn> on an
<a>environment settings object</a>, perform the following steps:
To attempt to <dfn>abort a pending write operation</dfn>,
run the following steps:
<ol class=algorithm>
<li>
If there is no <a>pending write tuple</a> |tuple|, abort these steps.
Expand All @@ -2225,6 +2225,28 @@ <h2>The <dfn>record type</dfn> string</h2>
</div>
</section>

<section><h3>Aborting pending scan operation</h3>
<div>
To attempt to <dfn>abort a pending scan operation</dfn>,
run the following steps:
<ol class=algorithm>
<li>
If there is no <a>pending read tuple</a> |tuple|, abort these steps.
</li>
<li>
If |tuple|'s reader has already initiated an ongoing NFC data transfer,
abort these steps.
</li>
<li>
Reject |tuple|'s promise with an {{"InvalidStateError"}} {{DOMException}}.
</li>
<li>
Clear the <a>pending read tuple</a> and abort these steps.
</li>
</ol>
</div>
</section>

<section><h3>Releasing NFC</h3>
<p>
To <dfn>release NFC</dfn> on an <a>environment settings object</a>,
Expand Down Expand Up @@ -2510,7 +2532,7 @@ <h3><dfn>Writing content</dfn></h3>
Let |records| be the list « |textRecord| ».
</li>
<li>
Set |source|'s <a>records</a> to |records|.
Set |source|'s records to |records|.
</li>
</ul>
<dt>{{BufferSource}}</dt>
Expand All @@ -2524,13 +2546,13 @@ <h3><dfn>Writing content</dfn></h3>
Let |records| be the list « |mimeRecord| ».
</li>
<li>
Set |source|'s <a>records</a> to |records|.
Set |source|'s records to |records|.
</li>
</ul>
<dt>{{NDEFMessageInit}}</dt>
<ul>
<li>
If |source|'s <a>records</a> [= list/is empty =], [= exception/throw =]
If |source|'s records [= list/is empty =], [= exception/throw =]
a {{TypeError}} and abort these steps.
</li>
</ul>
Expand All @@ -2548,7 +2570,7 @@ <h3><dfn>Writing content</dfn></h3>
</li>
<li>
[= list/For each =] |record:NDEFRecordInit| in the <a>list</a>
|source|'s <a>records</a>, run the following steps:
|source|'s records, run the following steps:
<ol>
<li>
Let |ndef| be the result of running <a>create NDEF record</a>
Expand Down Expand Up @@ -3419,6 +3441,9 @@ <h3><dfn>Writing content</dfn></h3>
browsing context</a>, then reject |p| with and
{{"InvalidStateError"}} {{DOMException}} and return |p|.
</li>
<li>
Attempt to <a>abort a pending scan operation</a>.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, we should return |p| with rejected promise if failing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we just reject the pending scan, not this one. It's a cleanup operation.
Or do you mean if the abort fails, we should reject the scan?
i.e. should we handle the "ongoing operation" step as a fail to abort and propagate it up?

</li>
<li>
Let |reader:NDEFReader| be the {{NDEFReader}} instance.
</li>
Expand Down