From 8bbc136cb394c9f30e3b446faba977f7e6afe6ca Mon Sep 17 00:00:00 2001
From: Kenneth Christiansen
@@ -1615,6 +1623,10 @@ The NFCRecordType enum
The NFC object provides a way for the browsing context to
use NFC functionality.
It allows for pushing Web NFC messages to NFC tags
- or NFC peers within range, and to set up and cancel NFC watches
+ or NFC peers within range, and to set up and abort NFC watches
to handle incoming Web NFC messages either from an NFC tag or an
NFC peer.
@@ -1447,7 +1447,6 @@
The NFCRecordType enum
[SecureContext]
interface NFC {
Promise<void> push(NFCPushMessage message, optional NFCPushOptions options);
- Promise<void> cancelPush(optional NFCPushTarget target="any");
Promise<long> watch(MessageCallback callback, optional NFCWatchOptions options);
};
@@ -1561,12 +1560,20 @@ The NFCRecordType enum
Set nfc@[[\suspended]] to true
.
"tag"
as parameter.
- "peer"
as parameter.
+ For each pending NFC.push:
+
+
"AbortError"
DOMException
+ and abort these steps.
+ The NFCRecordType enum
NFCPushTarget target = "any";
unrestricted double timeout = Infinity;
boolean ignoreRead = true;
+ AbortSignal? signal;
};
The NFCRecordType enum
will skip invoking the
receiving and parsing steps for an NFC tag.
+ The NFCPushOptions.signal property allows to abort + the push. +
- The NFCWatchOptions.signal property allows to abort / cancel + The NFCWatchOptions.signal property allows to abort the watch.
@@ -1755,200 +1767,228 @@cancelPush()
method.
+ the current message is sent, a timeout happens, or the push is
+ aborted.
The - NFC.push(message, options) - method, when invoked, MUST run the + NFC.push method, when invoked, MUST run the push a message algorithm:
Promise
promise, and
- then continue running this algorithm in parallel.
-
- "NotSupportedError"
and abort these steps.
- Promise
object.
NFCPushMessage
union, reject promise
- with "TypeError"
, and abort these steps.
+ Let message be the first argument.
NFCMessage
type, and message.records is an
- empty sequence, reject promise with
- "TypeError"
and abort these steps.
+ Let options be the second callback.
"TypeError"
and abort
- these steps.
+ Let signal be the options’ dictionary member of the same
+ name if present, or null otherwise.
"NotSupportedError"
and
- abort these steps.
+ If signal’s aborted flag is set, then reject p
+ with an "AbortError"
DOMException and return p.
"NoModificationAllowedError"
and abort these
+ steps.
+ "AbortError"
DOMException
+ and abort these steps.
+ "any"
, run the following
- steps twice, once with slot set to the value
- "tag"
, and once set to the value "peer"
;
- otherwise run the following step once, with
- slot set to the value of target.
- "AbortError"
.
-
- In other words, the current invocation of push()
- rejects and replaces existing running invocations handling the
- same slot. At any given moment there may be
- maximum two instances of this algorithm running: one targeting
- NFC tags, and another targeting NFC peers.
-
- Implementations are expected to clean up state on aborting these - steps, e.g. stop the related timer, clear the related push - message, as well as release any resources bound to NFC - functionality, so that new invocations of this algorithm do not - depend on previous invocations. -
-Infinity
,
- start a timer timer with the timeout value set to
- timeout.
-
+ "NotSupportedError"
and abort these steps.
+ NFCPushMessage
union, reject p
+ with "TypeError"
, and abort these steps.
+ "TimeoutError"
and abort these steps.
+ If the message parameter is of
+ NFCMessage
type, and message.records is an
+ empty sequence, reject p with
+ "TypeError"
and abort these steps.
cancelPush()
- method is called while timer is active with
- target or "any"
, then reject
- promise with "AbortError"
and
- abort these steps, as described in the
- cancelPush()
steps.
+ If timeout value is NaN or negative, reject
+ p with "TypeError"
and abort
+ these steps.
"NotSupportedError"
and
+ abort these steps.
+ "any"
, run the following
+ steps twice, once with slot set to the value
+ "tag"
, and once set to the value "peer"
;
+ otherwise run the following step once, with
+ slot set to the value of target.
+ "AbortError"
.
+
+ In other words, the current invocation of push()
+ rejects and replaces existing running invocations handling the
+ same slot. At any given moment there may be
+ maximum two instances of this algorithm running: one targeting
+ NFC tags, and another targeting NFC peers.
+
+ Implementations are expected to clean up state on aborting these + steps, e.g. stop the related timer, clear the related push + message, as well as release any resources bound to NFC + functionality, so that new invocations of this algorithm do not + depend on previous invocations. +
+Infinity
,
+ start a timer timer with the timeout value set to
+ timeout.
+ "tag"
or "any"
+ Promise p is rejected for a reason such as being
+ aborted by the user. In that case, abort these steps.
"peer"
or
- "any"
+ If timer expires, reject p with
+ "TimeoutError"
and abort these steps.
false
.
- true
, run the
- receiving steps.
+ if device is an NFC tag, target
+ is "tag"
or "any"
+ "peer"
or
+ "any"
null
, or it is
- different than the serialized origin of the
- incumbent settings object, and the
- obtain push permission steps return
- false
, then reject promise with
- "SecurityError"
and abort these steps.
+ this@[[\suspended]] is false
.
true
, run the
+ receiving steps.
+ null
, or it is
+ different than the serialized origin of the
+ incumbent settings object, and the
+ obtain push permission steps return
+ false
, then reject p with
+ "SecurityError"
and abort these steps.
+ "NetworkError"
and abort these
+ steps.
+ + Multiple adapters should be used sequentially by users. + There is very small likelihood that a simultaneous tap + will happen on two or multiple different and connected + NFC adapters. + If it happens, the user will likely need to repeat the + taps until success, preferably one device at a time. + The error here gives an indication that the operation + needs to be repeated. Otherwise the user may think the + operation succeeded on all connected NFC adapters. +
+"NetworkError"
and abort these
- steps.
- - Multiple adapters should be used sequentially by users. - There is very small likelihood that a simultaneous tap - will happen on two or multiple different and connected - NFC adapters. - If it happens, the user will likely need to repeat the - taps until success, preferably one device at a time. - The error here gives an indication that the operation - needs to be repeated. Otherwise the user may think the - operation succeeded on all connected NFC adapters. -
-
- If this@[[\suspended]] is true
,
- continue waiting until timer expires (if set), or
- until cancelPush()
is called, or until
- an NFC device comes within communication range.
-
+ If this@[[\suspended]] is true
,
+ continue waiting until timer expires (if set), or
+ promise is aborted by the user, or until an NFC device
+ comes within communication range.
+
- The
- NFC.cancelPush(target)
- method, when invoked, MUST run cancel push algorithm:
-
Promise
promise and
- then continue running this algorithm in parallel.
- NFC.push()
- algorithm running with its options.target equal to
- target or "any"
, then
- "NoModificationAllowedError"
and abort these
- steps.
- "AbortError"
and abort the steps of the
- instance.
-
- The cancelPush()
method does not interrupt ongoing
- transfers, it only cancels pushing before an NFC device
- comes in range.
-