From 1babe6b3c89b0328c9aca4dc1bf0f61bdfde5365 Mon Sep 17 00:00:00 2001 From: Zoltan Kis Date: Mon, 7 Sep 2015 16:52:30 +0300 Subject: [PATCH 01/28] Fixed review comments in the Security and Privacy document --- security-privacy.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/security-privacy.html b/security-privacy.html index 2282077..c8d9ae1 100644 --- a/security-privacy.html +++ b/security-privacy.html @@ -294,10 +294,10 @@ than the physical proximity range maintained by the user.
  • - The location of the user using NFC technology for reading NFC tag - from web pages might be indirectly found out, by knowing the location of - the NFC tag, the physical event of reading, and the close - physical proximity which is needed to use NFC. + The location of the user using NFC technology for reading + NFC tags from web pages might be indirectly determined, by + knowing the physical location of the NFC tag, the physical event + of reading, and the close physical proximity which is needed to use NFC. Also, the location of the user might be disclosed by sending NFC tags, either by directly sharing the user location (when the browsing context has access to that), or by sending information From 43eac44843b498a1b9f4379ee8a58fbc7d87f81e Mon Sep 17 00:00:00 2001 From: Zoltan Kis Date: Mon, 7 Sep 2015 17:20:29 +0300 Subject: [PATCH 02/28] Fixed parameters handling. Changed NFCDataType to NFCRecordType to be consistent with the web-nfc.idl. --- index.html | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index 278be0f..6df6d10 100644 --- a/index.html +++ b/index.html @@ -1010,13 +1010,13 @@

    The NFCRecord dictionary and dictionary:

    -
    NFCDataType kind
    +
    NFCRecordType kind
    USVString type
    any data

    The kind - property MUST return the NFCDataType of the + property MUST return the NFCRecordType of the NDEF record.

    @@ -1032,13 +1032,13 @@

    The NFCRecord dictionary and

    -

    The NFCDataType enum

    +

    The NFCRecordType enum

    - NFCDataType denotes the data types + NFCRecordType denotes the data types supported as NDEF record payload in read and send operations in this API.

    -
    +
    empty
    text
    url
    @@ -1051,7 +1051,7 @@

    The NFCRecord dictionary and the data, i.e. the receiving NFC content algorithm and sending NFC content algorithm.

    -

    +

    Data mapping

    @@ -1417,6 +1417,9 @@

    The pushMessage algorithm

  • +
  • + Let options be the second argument. +
  • Let timeout be the value of options.timeout if it is defined, or otherwise 10000 (milliseconds). @@ -1790,19 +1793,19 @@

    The pushMessage algorithm

    When an NFC device comes in communication range, -

    +

    +

    + To map a JSON object to NDEF given a record, + run these steps: +

    +

    The cancelPush() method

    From eda9205d24487f89d69179415b2acf54c3718bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C2=A8Kenneth?= <¨kenneth.r.christiansen@intel.com¨> Date: Fri, 11 Sep 2015 15:47:19 +0200 Subject: [PATCH 15/28] Extract map text to NDEF algo --- index.html | 223 ++++++++++++++++++++++++++--------------------------- 1 file changed, 109 insertions(+), 114 deletions(-) diff --git a/index.html b/index.html index a420cc7..33cae32 100644 --- a/index.html +++ b/index.html @@ -267,9 +267,9 @@ Promise, - JSON and + JSON, - JSON.stringify + JSON.stringify and JSON.parse are defined in [[!ECMASCRIPT]]. @@ -1582,100 +1582,11 @@
  • - If record.kind is "text", then - execute the following steps, or make sure - that the underlying platform provides equivalent values to - ndef: -

    - This kind is useful when clients specifically want to write an - NDEF Well Known Type Text record. Other options would be to - use the value "opaque" with an explicit - IANA media type text type, which allows for better differentiation, e.g. when using "text/xml", or "text/vcard". -

    - + If record.kind is "text", then let + ndef be the result of passing record + to map text to NDEF. If this threw an exception, reject + promise with that exception and abort these steps.
  • -
  • If record.kind is "url", then let ndef the be result of passing record to map a URL to NDEF. @@ -1706,21 +1617,15 @@ terminate this algorithm.
  • - Otherwise, - + Set the ndef.TNF field to 2 (Media Type). +
  • +
  • + Set the ndef.TYPE field to var>record.type. +
  • +
  • + Set the ndef.PAYLOAD field to + record.data according to the + [[NFC-STANDARDS]], i.e. as an opaque octet stream.
  • @@ -1855,7 +1760,96 @@

    - +

    + To map text to NDEF given a record, run these + steps: +

    + This kind is useful when clients specifically want to write an + NDEF Well Known Type Text record. Other options would be to + use the value "opaque" with an explicit + IANA media type text type, which allows for better differentiation, e.g. when using "text/xml", or "text/vcard". +

    + +

    To map a URL to NDEF given a record, run these steps:

  • - Add a Web NFC record to output to the end of - output by following the - write Web NFC record sub-steps, or ensure that the - underlying platform provides equivalent values to ndef: - -
  • - + Let web ndef be the result of invoking create a Web NFC + record. + +
  • + Add web ndef to output. +
  • +
  • + Let timer be a new timer associated with this invocation + of pushMessage(). +
  • +
  • + Every termination of these steps MUST clear output, + and cancel the associated timer. +
  • Make a request to the underlying platform to send output - to the next device which comes in proximity range, and start a timer + to the next device which comes in proximity range, and start the timer timer with options.timeout. There MUST be exactly one message set for pushing per calling browsing context with exactly one associated timer. @@ -1760,6 +1688,31 @@
  • +

    + To map empty record to NDEF given a record, run + these steps: +

      +
    1. + Let ndef be the notation for the NDEF record to + be created by the underlying platform. +
    2. +
    3. Set the + ndef.TNF field to 0 (NFC Empty Type record). +
    4. +
    5. Set + ndef.TYPE_LENGHT, + ndef.ID_LENGTH and + ndef.PAYLOAD_LENGTH fields to 0, + and omit the associated fields from the NDEF record: + ndef.TYPE, + ndef.ID, + ndef.PAYLOAD. +
    6. +
    7. + Return ndef. +
    8. +
    +

    To map text to NDEF given a record, run these steps: @@ -1769,7 +1722,7 @@ use the value "opaque" with an explicit IANA media type text type, which allows for better differentiation, e.g. when using "text/xml", or "text/vcard".

    - +

    To map a URL to NDEF given a record, run these steps: -

    +

    To map a JSON object to NDEF given a record, run these steps: -

    + +

    +

    + To map binary data to NDEF given a record, + run these steps: +

      +
    1. + If record.data is not of instance of + ArrayBuffer, reject promise with + "SyntaxError", and abort these steps. +
    2. +
    3. + The UA MAY check if record.type is + a valid IANA registered type. If not, then MAY throw a + "SyntaxError" exceeption and abort these steps. +
    4. +
    5. + Let ndef be the notation for the NDEF record to + be created by the underlying platform. +
    6. +
    7. + Set the ndef.TNF field to 2 (Media Type). +
    8. +
    9. + Set the ndef.TYPE field to var>record.type. +
    10. +
    11. + Set the ndef.PAYLOAD field to record.data + according to the [[NFC-STANDARDS]], i.e. as an opaque octet stream. +
    12. +
    13. + Return ndef. +
    14. +
    +

    +

    + To create a Web NFC record, run these steps: +

      +
    1. + Let ndef be the notation for the NDEF record to + be created by the underlying platform. +
    2. +
    3. + Set ndef.TNF to 4 (NDEF External Type). +
    4. +
    5. + Set ndef.TYPE to + "urn:nfc:ext:w3.org:webnfc". +
    6. +
    7. + Set ndef.PAYLOAD to the URL path of the + browsing context, encoded as UTF-16. + This is going to be used by NFC watch filters. +

      + In future versions a list of "allowed-origins" may be + supported. + It is still up for discussions due to security issues. See the + + Security and Privacy document. +

      +
    8. +
    9. + Return ndef. +
    10. +

    The cancelPush() method

    The - cancelPush + NFCAcapter.cancelPush method is used for resetting the NDEF message set to be pushed next time an NFC device comes in range.

    @@ -2048,10 +2069,10 @@

             dictionary NFCWatchOptions {
    -          USVString url;
    -          USVString kind;
    -          USVString type;
    -          NFCWatchMode mode;
    +          USVString url = null;
    +          USVString kind = null;
    +          USVString type = null;
    +          NFCWatchMode mode = "web-nfc-only";
             };
           

    @@ -2086,7 +2107,7 @@ The NFCWatchOptions.mode property tells whether only Web NFC content or any NFC content will be watched. - The default value is "web-only". + The default value is "web-nfc-only".

     

    The watch() method

    The - - watch(options, callback) method enables listening to incoming - NDEF messages. + NFCAdapter.watch(options, callback) + method enables listening to incoming NDEF messages.

    The NFC content to which clients listen can be filtered based on @@ -2139,8 +2159,7 @@

    When the - - watch() method is invoked, the UA MUST run + NFCAdapter.watch() method is invoked, the UA MUST run the following NFC watch algorithm:

    1. Let promise be a new Promise object. From 20e8f4f19b60c2536a50b0dfdb055859e67e1778 Mon Sep 17 00:00:00 2001 From: Zoltan Kis Date: Tue, 15 Sep 2015 10:52:31 +0300 Subject: [PATCH 17/28] Added task source. Fixed pushMessage terminate steps. Small edits. --- index.html | 88 +++++++++++++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 40 deletions(-) diff --git a/index.html b/index.html index fbc22f0..a02fd69 100644 --- a/index.html +++ b/index.html @@ -172,6 +172,13 @@ fire a simple event are defined in [[!HTML5]]. +

      + The concepts + + task source and + + queue a task are defined in [[!HTML5]]. +

      The term browsing context refers to the environment in which @@ -286,7 +293,7 @@

      The term queue - a task is defined in [[!HTML5]]. + a task is defined in [[!HTML5]].

      The term task @@ -933,12 +940,14 @@ mandate specific user prompting policies. The term obtain permission is used for acquiring trust for a given operation.

      -

      - The Permissions API SHOULD - be supported by UAs for implementing NFC related - [[permissions]]. The required +

      + The Permissions API is + suggested to be used by UAs for implementing NFC related + [[permissions]] in order to minimize the need for user prompting. + The suggested - permission name is "nfc". + permission name is + "nfc". This allows saving user permissions for a given origin in a persistent database until revocation.

      @@ -1007,7 +1016,7 @@ For details see the Writing or pushing content section.
    2. - When requesting an NFC adapter by the getAdapter + When requesting an NFC adapter by the requestAdapter method, or when setting up listeners for reading, or when sending NFC content, the UA MAY warn the user that physical location may be inferred from the act of using NFC by the @@ -1278,9 +1287,11 @@ Navigator interface [HTML] which this specification extends.

      -
      -
      readonly attribute NFC nfc
      -
      +
      +    partial interface Navigator {
      +      readonly attribute NFC nfc;
      +    };
      +  

      The nfc attribute

      @@ -1447,6 +1458,16 @@ Return a new promise promise, and then continue running this algorithm in parallel.

    3. +
    4. + If there is an existing instance of this algorithm running for the + current NFC adapter, abort that instance of this algorithm, + by rejecting its promise with + "AbortError". +

      + Implementations are expected to clean up state on termination, + e.g. reset timer, clear output, etc. +

      +
    5. If the incumbent settings object is not a secure context, reject promise with @@ -1456,11 +1477,11 @@ An implementation MAY reject promise with "NotSupportedError", and abort these steps.
      - The UA might terminate message push at this point. The reasons - for terminations are implementation details. For example, the could - have has set a preference to allow a given origin only to read, write, - or send data to peers. Also, the implementation might be unable - to support the operation requested. + The UA might terminate message push at this point. The reasons + for terminations are implementation details. For example, the user + could have has set a preference to allow a given origin only to + read, write, or send data to peers. Also, the implementation might + be unable to support the operation requested.
    6. @@ -1520,7 +1541,7 @@ In other words, the current invocation of pushMessage() rejects and replaces existing running invocations handling the same options.target. As "any" handles both - "peer" and "tag", existing running invocations for + "peer" and "tag", existing running invocations for "any" always gets rejected.
    7. @@ -1552,7 +1573,7 @@
    8. - If record.kind is "text", then let + If record.kind is "text", then let ndef be the result of passing record to map text to NDEF. If this threw an exception, reject promise with that exception and abort these steps. @@ -1621,20 +1642,6 @@ Let timer be a new timer associated with this invocation of pushMessage().
    9. -
    10. - Every termination of these steps MUST clear output, - and cancel the associated timer. -
    11. -
    12. - Make a request to the underlying platform to send output - to the next device which comes in proximity range, and start the timer - timer with options.timeout. - There MUST be exactly one message set for pushing per calling - browsing context with exactly one associated timer. - This means that every new invocation of the - pushMessage() method replaces the previously set - push message and resets the associated timer. -
    13. If timer expires, reject promise with "TimeoutError" and abort these steps. @@ -1734,7 +1741,7 @@ In addition, UAs MAY check that record.type is an IANA registered media type - for text. + for text. If not, then the UA MAY throw a "SyntaxError" exception, and abort these steps.
    14. @@ -1808,7 +1815,7 @@

    - To map a URL to NDEF given a record, run these steps: + To map a URL to NDEF given a record, run these steps:

    1. If record.data is not a string, @@ -1906,7 +1913,7 @@
    2. Return ndef.
    3. -
    +

    To create a Web NFC record, run these steps: @@ -2228,7 +2235,8 @@

  • If this is the first watch being set up for the current NFC adapter, make a request to the underlying platform to - listen to NDEF messages. + listen to NDEF messages, and create a task source as + the Web NFC task source.
  • If the request fails, reject promise with @@ -2511,9 +2519,9 @@

    Receiving and parsing content

  • Queue a task to invoke the MessageCallback callback with record as its first argument, - and messageId as its second argument. The task source - for the tasks queued by algorithms in this section is the - XXXXX task source. + and messageId as its second argument. + The task source for the tasks queued by algorithms in + this section is the Web NFC task source.
  • @@ -2593,8 +2601,8 @@

    Receiving and parsing content

    The editors would like to express their gratitude to the former editors Luc Yriarte and Samuel Ortiz, and also to Don Coleman, Anne van Kesteren, Domenic Denicola, Jonas Sickling, Jeffrey Yasskin, Alexander Shalamov, - Salvatore Iovene, and Rijubrata Bhaumik for their technical guidance, - implementation feedback and support. + Salvatore Iovene, Rijubrata Bhaumik and Anssi Kostiainen for their technical + guidance, implementation feedback and support.

    From 622588061720d9155bac2694b6ed671bdc35a60d Mon Sep 17 00:00:00 2001 From: Zoltan Kis Date: Tue, 15 Sep 2015 11:40:30 +0300 Subject: [PATCH 18/28] Factored out permission steps for pushMessage() and watch(). --- index.html | 142 +++++++++++++++++++++++++++++------------------------ 1 file changed, 78 insertions(+), 64 deletions(-) diff --git a/index.html b/index.html index a02fd69..2fbd75c 100644 --- a/index.html +++ b/index.html @@ -1448,15 +1448,12 @@

    The pushMessage() method

    The NFCAdapter.pushMessage(message, options) - method, when invoked, MUST run the push a message algorithm. -

    -

    - To push a message given a message and options, - run the following steps: + method, when invoked, MUST run the + push a message algorithm:

    1. - Return a new promise promise, and then continue running this - algorithm in parallel. + Return a new promise promise, and then continue running + this algorithm in parallel.
    2. If there is an existing instance of this algorithm running for the @@ -1489,36 +1486,13 @@ browsing context invoking this method.
    3. - Try to obtain permission by applying the following sub-steps: -
        -
      • - If an expressed permission has been granted before for - origin using the - Permissions API, - then continue with step 7. -
      • -
      • - Otherwise, if a prearranged trust relationship exists, - then continue with step 7. -
      • -
      • - Otherwise, try to obtain expressed permission using the - Permissions API. - If a permissions dialog is involved with the user during this, - then the UA SHOULD notify the user also about that - using NFC for sending content may indirectly reveal the physical - location of the user in certain conditions. - If permission has been granted by the user, then continue with - step 7. -
      • -
      • - Otherwise, reject promise with - "SecurityError", and abort these steps. -
      • -
      + If the obtain push permission steps return + false, then reject promise with + "SecurityError", and abort these steps.
    4. - If the message parameter is not a valid Web NFC message, + If the message parameter is not a + valid Web NFC message, reject promise with "SyntaxError", and abort these steps.
    5. @@ -1720,6 +1694,34 @@

    +

    + To obtain push permission, run these steps: +

      +
    1. + If an expressed permission has been granted before for + origin using the + Permissions API, + then return true. +
    2. +
    3. + Otherwise, if a prearranged trust relationship exists, + then return true. +
    4. +
    5. + Otherwise, try to obtain expressed permission using the + Permissions API. + If a permissions dialog is involved with the user during this, + then the UA SHOULD notify the user also about that + using NFC for sending content may indirectly reveal the physical + location of the user in certain conditions. + If permission has been granted by the user, then return + true. +
    6. +
    7. + Return false. +
    8. +
    +

    To map text to NDEF given a record, run these steps: @@ -2173,7 +2175,7 @@

  • Return promise and continue the following steps - in parallel. + in parallel.
  • If the incumbent settings object is not a @@ -2191,36 +2193,10 @@ browsing context invoking this method.
  • - If the user has earlier denied permission for origin for - all future calls as well, reject promise with + If the obtain watch permission steps return + false, then reject promise with "SecurityError", and abort these steps.
  • -
  • - Reading NFC content does not require - expressed permission, but unless there is a - prearranged trust relationship, UAs SHOULD - ask for forgiveness with relevant - information displayed to the user which explains that reading - NFC content may indirectly reveal the physical location of the - user. In addition, if the value of options.mode is - "all", then also include in this information that the - origin is requesting to read all NFC content, not only - those meant for web pages. -
  • -
  • - If the user has blocked permission from the - ask for forgiveness - interaction for this origin, reject promise - with "SecurityError", and abort these steps. -

    - The ask for forgiveness interaction - might show choices like "block now" or "block forever", etc. If the - user has chosen to "block forever" the given origin, it - is the responsibility of the UA to remember these user - choices for each origin, regardless of which - NFC adapter is used, and consult them on later invocations. -

    -
  • If the first argument options contains invalid values, reject promise with a "SyntaxError", @@ -2258,6 +2234,44 @@
  • +

    + To obtain watch permission, run these steps: +

      +
    1. + If the user has earlier denied permission for the calling + origin for all future calls of watch() as well, + then return false. +
    2. +
    3. + Otherwise, if there is a prearranged trust relationship, + return true. +
    4. +
    5. + Otherwise, UAs SHOULD + ask for forgiveness with relevant + information displayed to the user. +

      + The ask for forgiveness interaction + might show choices like "block now" or "block forever", etc. + If the user has chosen to "block forever" the given + origin, it is the responsibility of the UA to remember + these user choices for each origin, regardless of which + NFC adapter is used, and consult them on later invocations. +

      +

      + In this step UAs are advised to notify users about + that reading NFC content may indirectly reveal the physical + location of the user. In addition, if "any" + NfcWatchMode is used, then also include in this + information that the origin is requesting to read not only + NFC content meant for web pages, but any NFC content. +

      +
    6. +
    7. + Return true. +
    8. +
    +

    From c867819d590709c4db25e5e7e51244b68b554937 Mon Sep 17 00:00:00 2001 From: Zoltan Kis Date: Tue, 15 Sep 2015 11:52:53 +0300 Subject: [PATCH 19/28] Small edits. --- index.html | 152 +++++++++++++++++++++++++++-------------------------- 1 file changed, 78 insertions(+), 74 deletions(-) diff --git a/index.html b/index.html index 2fbd75c..7936465 100644 --- a/index.html +++ b/index.html @@ -172,13 +172,6 @@ fire a simple event are defined in [[!HTML5]]. -

    - The concepts - - task source and - - queue a task are defined in [[!HTML5]]. -

    The term browsing context refers to the environment in which @@ -612,7 +605,7 @@

    - +

    Examples

    This section shows how developers can make use of the various features of @@ -1078,14 +1071,13 @@ The content of any Web NFC message is exposed by the following sequence:

    -
    typedef sequence<NFCRecord> NFCMessage;
    - A Web NFC message is a valid Web NFC message if these steps - return success: -
      -
    • - If the sequence of NFCRecord objects is empty, return false. -
    • -
    +
    +      typedef sequence<NFCRecord> NFCMessage;
    +    
    +

    + A Web NFC message is a valid Web NFC message if the + sequence of NFCRecord objects is not empty. +

    The NFCRecord dictionary

    @@ -1511,13 +1503,13 @@ whose target equal to options.target or "any", reject the promise of these with "AbortError". -
    - In other words, the current invocation of pushMessage() - rejects and replaces existing running invocations handling the same - options.target. As "any" handles both - "peer" and "tag", existing running invocations for - "any" always gets rejected. -
    +

    + In other words, the current invocation of pushMessage() + rejects and replaces existing running invocations handling the same + options.target. As "any" handles both + "peer" and "tag", existing running invocations + for "any" always gets rejected. +

  • Let output be the notation for the NDEF message @@ -1534,15 +1526,17 @@ If record.kind is "empty", then
    • - Let ndef be the result of passing record - to map empty record to NDEF. If this threw an exception, - reject promise with that exception and abort these steps. + Let ndef be the result of passing + record to map empty record to NDEF. + If this threw an exception, reject promise with + that exception and abort these steps.
    • Clear output and add ndef to it.
    • - Skip the remaining substeps for the sequence message. + Skip the remaining substeps for the sequence + message.
  • @@ -1553,22 +1547,25 @@ promise with that exception and abort these steps.
  • - If record.kind is "url", then let ndef - the be result of passing record to map a URL to NDEF. - If this threw an exception, reject promise with that exception - and abort these steps. + If record.kind is "url", then let + ndef the be result of passing record to + map a URL to NDEF. + If this threw an exception, reject promise with that + exception and abort these steps.
  • - If record.kind is "json", then let ndef - the be result of passing record to map a JSON object to NDEF. - If this threw an exception, reject promise with that exception - and abort these steps. + If record.kind is "json", then let + ndef the be result of passing record to + map a JSON object to NDEF. + If this threw an exception, reject promise with that + exception and abort these steps.
  • - If record.kind is "opaque", then let ndef - the be result of passing record to map binary data to NDEF. - If this threw an exception, reject promise with that exception - and abort these steps. + If record.kind is "opaque", then let + ndef the be result of passing record to + map binary data to NDEF. + If this threw an exception, reject promise with that + exception and abort these steps.
  • Otherwise, if record.kind is undefined, @@ -1606,8 +1603,8 @@
  • - Let web ndef be the result of invoking create a Web NFC - record. + Let web ndef be the result of invoking + create a Web NFC record.
  • Add web ndef to output. @@ -1729,7 +1726,8 @@ This kind is useful when clients specifically want to write an NDEF Well Known Type Text record. Other options would be to use the value "opaque" with an explicit - IANA media type text type, which allows for better differentiation, e.g. when using "text/xml", or "text/vcard". + IANA media type text type, which allows for better + differentiation, e.g. when using "text/xml", or "text/vcard".

    1. @@ -1744,8 +1742,8 @@ In addition, UAs MAY check that record.type is an IANA registered media type for text. - If not, then the UA MAY throw a "SyntaxError" exception, - and abort these steps. + If not, then the UA MAY throw a "SyntaxError" + exception, and abort these steps.
    2. Let language be "en". @@ -1817,7 +1815,8 @@

    - To map a URL to NDEF given a record, run these steps: + To map a URL to NDEF given a record, run these + steps:

    1. If record.data is not a string, @@ -1969,7 +1968,8 @@
    2. If there is no message set for pushing as described in the pushMessage() algorithm, - or no active timers associated with it, then terminate this algorithm. + or no active timers associated with it, then terminate this + algorithm.

      This step also covers the case when the timer has already fired, which also means that the message buffer is invalid, and is to be @@ -2171,7 +2171,8 @@ NFCAdapter.watch() method is invoked, the UA MUST run the following NFC watch algorithm:

        -
      1. Let promise be a new Promise object. +
      2. + Let promise be a new Promise object.
      3. Return promise and continue the following steps @@ -2219,9 +2220,9 @@ "NotSupportedError" , and abort these steps.
      4. - Otherwise, let watchId be a locally unique number assigned - to options and callback and store them - together as an NFC watch. + Otherwise, let watchId be a locally unique number + assigned to options and callback and store + them together as an NFC watch.
      5. Resolve promise with watchId. @@ -2277,9 +2278,9 @@

        The unwatch() method

        - When the NFCAdapter.unwatch(id) method is invoked, - the UA MUST return a promise promise and run the following - steps in parallel. + When the NFCAdapter.unwatch(id) method is + invoked, the UA MUST return a promise promise and run the + following steps in parallel.

        1. If the incumbent settings object is not a @@ -2320,8 +2321,8 @@

          Receiving and parsing content

          If there are any NFC watches set up for any NFC adapter, then UAs MUST listen to NDEF messages, according to step 9 of the NFC watch algorithm. - When the UA is to receive an NDEF message it MUST run the following - algorithm: + When the UA is to receive an NDEF message it MUST run the + following algorithm:
          1. Let input be the notation for the NDEF message @@ -2414,13 +2415,14 @@

            Receiving and parsing content

          2. If scheme is not 0, then set record.data - to the string obtained from mapping the value of scheme - to the URL scheme as specified in the [[NFC-STANDARDS]] URI - Record Type Definition specification, Section 3.2.2. + to the string obtained from mapping the value of + scheme to the URL scheme as specified in the + [[NFC-STANDARDS]] URI Record Type Definition specification, + Section 3.2.2.
          3. - Set record.data to the UTF-16 string converted from the - octets of ndef.PAYLOAD except the first octet. + Set record.data to the UTF-16 string converted from + the octets of ndef.PAYLOAD except the first octet.
          4. @@ -2432,10 +2434,10 @@

            Receiving and parsing content

            ndef.PAYLOAD.
          5. - If ndef.TNF is 2 (NFC Media Type record), then execute the - following sub-steps for parsing NDEF Media record, or make - sure that the underlying platform provides equivalent values to the - record object properties: + If ndef.TNF is 2 (NFC Media Type record), then execute + the following sub-steps for parsing NDEF Media record, or + make sure that the underlying platform provides equivalent values to + the record object properties:
            • If ndef.TYPE matches the match pattern @@ -2460,7 +2462,8 @@

              Receiving and parsing content

            • Set record.type to ndef.TYPE.
            • Set record.data to a new ArrayBuffer - object constructed from the octets of ndef.PAYLOAD. + object constructed from the octets of + ndef.PAYLOAD.
          6. @@ -2496,9 +2499,10 @@

            Receiving and parsing content

          7. - For matching message against the registered NFC watches, - for each NFC watch watch that has been registered - using the watch() method, execute the following sub-steps: + For matching message against the registered + NFC watches, for each NFC watch watch that has + been registered using the watch() method, execute the + following sub-steps:
            • Let options be the NFCWatchOptions @@ -2511,10 +2515,10 @@

              Receiving and parsing content

              NFC watch.
            • - Otherwise, if options.mode is "web-nfc-only", and - messageId is not null, or if - options.mode is "all", then execute the - following sub-steps: + Otherwise, if options.mode is + "web-nfc-only", and messageId is not + null, or if options.mode is + "any", then execute the following sub-steps:
              • If options.url is defined, and if @@ -2532,8 +2536,8 @@

                Receiving and parsing content

              • Queue a task to invoke the MessageCallback - callback with record as its first argument, - and messageId as its second argument. + callback with record as its first + argument, and messageId as its second argument. The task source for the tasks queued by algorithms in this section is the Web NFC task source.
              • From 72796ebc2603b185fbe1e6c78b9a186b9c7b2c7b Mon Sep 17 00:00:00 2001 From: Zoltan Kis Date: Tue, 15 Sep 2015 12:05:48 +0300 Subject: [PATCH 20/28] Modified the permission steps. --- index.html | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/index.html b/index.html index 7936465..0f9a5ed 100644 --- a/index.html +++ b/index.html @@ -1695,25 +1695,15 @@ To obtain push permission, run these steps:
                1. - If an expressed permission has been granted before for - origin using the - Permissions API, + If a prearranged trust relationship exists, then return true.
                2. - Otherwise, if a prearranged trust relationship exists, + Otherwise, if an expressed permission has been granted + for origin using the + Permissions API, then return true.
                3. -
                4. - Otherwise, try to obtain expressed permission using the - Permissions API. - If a permissions dialog is involved with the user during this, - then the UA SHOULD notify the user also about that - using NFC for sending content may indirectly reveal the physical - location of the user in certain conditions. - If permission has been granted by the user, then return - true. -
                5. Return false.
                6. @@ -2239,13 +2229,13 @@ To obtain watch permission, run these steps:
                  1. - If the user has earlier denied permission for the calling - origin for all future calls of watch() as well, - then return false. + If there is a prearranged trust relationship, + return true.
                  2. - Otherwise, if there is a prearranged trust relationship, - return true. + Otherwise, if the user has earlier denied permission for the calling + origin for all future calls of watch() as well, + then return false.
                  3. Otherwise, UAs SHOULD From b582d77ec8c34cc0e8083c1846a891536a15dde9 Mon Sep 17 00:00:00 2001 From: Zoltan Kis Date: Tue, 15 Sep 2015 14:44:35 +0300 Subject: [PATCH 21/28] Fixed links of watch(), and some security related formulations. --- index.html | 76 +++++++++++++++++++----------------------------------- 1 file changed, 26 insertions(+), 50 deletions(-) diff --git a/index.html b/index.html index 0f9a5ed..7d7e182 100644 --- a/index.html +++ b/index.html @@ -447,8 +447,8 @@

                    The Web NFC Id is a URL according to - [[RFC3986]], with "https" scheme, and an - ASCII serialized origin, optionally followed by a URL path. + [[RFC3986]], specifically an ASCII serialized origin with + "https" scheme, and optionally followed by a URL path. This allows matching Web NFC content with URL patterns specified by NFC watches.

                    @@ -883,16 +883,21 @@

                    Web pages using the NFC API are not trusted. This means that the user needs to be aware of exactly what a web page is - intending to do with NFC at any given moment. Implementations SHOULD - make sure that when the user authorizes an NFC operation, then only that + intending to do with NFC at any given moment. Implementations need to + make sure that when the user authorizes a method of this API, then only that action is run, without side effects, and exactly in the context and the - number of times the user allows the execution of NFC operations. + number of times the user allows the execution of NFC related operations, + according to the algorithmic steps detailed in this specification.

                    - The content of Web NFC messages is not trusted, unless the UA - can safely assume that the content has not been change by third parties - between writing and reading it, e.g. in the case of a - prearranged trust relationship can be established. + The choice of trusting the integrity of NFC content when + used for implementing security policies, for instance the authenticity of + origins saved in the NDEF Id field, or that of the + URL path of the browsing context, and then used for + same-origin or allowed-origins policy by the UA, SHOULD be based on + prearranged trust relationship (such as encryption and other means), + otherwise the integrity of the content MUST NOT be trusted by UAs + and security policies MUST NOT be based on this.

        @@ -920,10 +925,6 @@

        Permissions and user prompts

        - UAs MUST NOT provide Web NFC API access to browsing contexts - without complying with the security policies described in this document. -

        -

        This specification attempts to help minimizing the user prompts needed to use the Web NFC API and tries to involve implicit policies which can address the @@ -944,23 +945,6 @@ This allows saving user permissions for a given origin in a persistent database until revocation.

        -

        - UAs MUST acquire user consent, i.e. expressed permission for - for using the methods of this API, unless a - prearranged trust relationship applies, or unless an implicit policy - specified in this document allows it, eventually with an - ask for forgiveness indication. -

        -

        - The choice of trusting the integrity of NFC content when - used for implementing security policies, for instance the authenticity of - origins saved in the NDEF Id field, or that of the - URL path of the browsing context, and then used for - same-origin or allowed-origins policy by the UA, SHOULD be based on - prearranged trust relationship (such as encryption and other means), - otherwise the integrity of the content MUST NOT be trusted by UAs - and security policies MUST NOT be based on this. -

        All expressed permissions that are preserved beyond the current browsing session MUST be revocable. @@ -1074,10 +1058,6 @@

               typedef sequence<NFCRecord> NFCMessage;
             
        -

        - A Web NFC message is a valid Web NFC message if the - sequence of NFCRecord objects is not empty. -

        The NFCRecord dictionary

        @@ -1178,7 +1158,7 @@ "opaque" IANA media type - ArrayBuffer or typed array + ArrayBuffer Media-type as defined in [[RFC2046]] (TNF=2) @@ -1444,8 +1424,8 @@ push a message algorithm:
        1. - Return a new promise promise, and then continue running - this algorithm in parallel. + Return a new Promise promise, and + then continue running this algorithm in parallel.
        2. If there is an existing instance of this algorithm running for the @@ -1483,8 +1463,7 @@ "SecurityError", and abort these steps.
        3. - If the message parameter is not a - valid Web NFC message, + If the message parameter is an empty sequence, reject promise with "SyntaxError", and abort these steps.
        4. @@ -2130,11 +2109,7 @@

          The watch() method

          - The - NFCAdapter.watch(options, callback) - method enables listening to incoming NDEF messages. -

          -

          + This method enables listening to incoming NDEF messages. The NFC content to which clients listen can be filtered based on its data type, and based on the URL path of the browsing context which has been saved to the Web NFC record @@ -2156,10 +2131,11 @@

          Watch filters are grouped by NFC adapter.

          -

          +

          When the - NFCAdapter.watch() method is invoked, the UA MUST run - the following NFC watch algorithm: + NFCAdapter.watch(options, callback) + method is invoked, the UA MUST run the following + NFC watch algorithm:

          1. Let promise be a new Promise object. @@ -2269,8 +2245,8 @@

            The unwatch() method

            When the NFCAdapter.unwatch(id) method is - invoked, the UA MUST return a promise promise and run the - following steps in parallel. + invoked, the UA MUST return a Promise + promise and run the following steps in parallel.

            1. If the incumbent settings object is not a @@ -2310,7 +2286,7 @@

              Receiving and parsing content

              If there are any NFC watches set up for any NFC adapter, then UAs MUST listen to NDEF messages, according to step 9 - of the NFC watch algorithm. + of the NFC watch algorithm. When the UA is to receive an NDEF message it MUST run the following algorithm:

                From 6b308d2ae029ff21be24cccea27fb2ffe1dc40aa Mon Sep 17 00:00:00 2001 From: Zoltan Kis Date: Tue, 15 Sep 2015 18:46:43 +0300 Subject: [PATCH 22/28] Changed security policy descriptions. Updated NFCRecord validation. Updated task source. Updated page visibility related steps. Editorials. --- index.html | 200 +++++++++++++++++++++++++---------------------------- 1 file changed, 93 insertions(+), 107 deletions(-) diff --git a/index.html b/index.html index 7d7e182..0408047 100644 --- a/index.html +++ b/index.html @@ -152,26 +152,6 @@

                Terminology

                -

                The term browsing context refers to the environment in which @@ -184,6 +164,10 @@ web page, or an iframe.

                +

                + The term + top-level browsing context is defined in [[!HTML5]]. +

                The term @@ -284,6 +268,10 @@ IANA media types (formerly known as MIME types) are defined in RFC2046.

                +

                + A + valid MIME type is defined in [[!HTML5]]. +

                The term queue a task is defined in [[!HTML5]]. @@ -292,6 +280,7 @@ The term task source is defined in [[!HTML5]].

                +

                Security

                The term expressed permission refers to an act by the user, e.g. via user interface or setting or host device platform features, using which @@ -318,6 +307,8 @@ asks for forgiveness, or ensured a prearranged trust relationship exists.

                +
                +

                NFC specific

                NFC stands for Near Field Communications, short-range wireless technology operating at 13.56 MHz which enables communication between @@ -500,6 +491,7 @@ to the other device, printing to a Bluetooth printer or streaming video to a television set.

                +
                @@ -844,28 +836,6 @@

            -
          @@ -881,7 +851,7 @@

          Chain of trust

          - Web pages using the NFC API are not trusted. + Web pages using the Web NFC API are not trusted. This means that the user needs to be aware of exactly what a web page is intending to do with NFC at any given moment. Implementations need to make sure that when the user authorizes a method of this API, then only that @@ -890,14 +860,11 @@ according to the algorithmic steps detailed in this specification.

          - The choice of trusting the integrity of NFC content when + The integrity of NFC content SHOULD NOT be trusted when used for implementing security policies, for instance the authenticity of - origins saved in the NDEF Id field, or that of the - URL path of the browsing context, and then used for - same-origin or allowed-origins policy by the UA, SHOULD be based on - prearranged trust relationship (such as encryption and other means), - otherwise the integrity of the content MUST NOT be trusted by UAs - and security policies MUST NOT be based on this. + origins saved in the NDEF Id field, unless a + prearranged trust relationship (such as encryption and other means) + exists.

          @@ -911,7 +878,7 @@ priority:
          • - User data privacy : involuntary sharing of user data (such as location, + User data privacy: involuntary sharing of user data (such as location, contacts, personal data, etc) from an NFC-capable device such as a phone, tablet, or PC.
          • @@ -951,24 +918,26 @@

        -

        Security policies

        -

        - UAs MUST implement the following policies: -

          +

          Security policies

          +

          + This section summarizes the security policies which are specified as + normative requirements in the respective algorithms of this + specification: +

          +
        -

        + +
  • @@ -1074,19 +1042,38 @@

    The NFCRecord.kind - property MUST return the NFCRecordType of the + property represents the NFCRecordType of the NDEF record.

    The NFCRecord.type - property MUST return the IANA media type of the NDEF record + property represents the IANA media type of the NDEF record payload.

    - The NFCRecord.data property MUST return the + The NFCRecord.data property represents the payload data of the NDEF record with an appropriate ECMAScript type, which depends on the IANA media type.

    +

    + A valid NFCRecord record is an instance of + NFCRecord which matches the following criteria: +

      +
    • + record.kind has values defined by + NFCRecordType, or undefined. +
    • +
    • + record.type is a valid MIME type, or + undefined. +
    • +
    • + record.data is null, or of type + "string", or "number", or instance of + Object, or ArrayBuffer. +
    • +
    +

    The NFCRecordType enum

    @@ -1267,9 +1254,8 @@

    The nfc attribute

    - When getting the nfc attribute, the - UA MUST return the NFC object, which provides - NFC related functionality. + On getting the nfc attribute, the UA MUST return the NFC + object, which provides NFC related functionality.

    @@ -1324,9 +1310,9 @@ adapter to that.
  • - If there are multiple NFC adapters available, and there is - a system or user setting available with a preference to select the - default adapter, then bind adapter to that. + Otherwise, if there are multiple NFC adapters available, and + there is a system or user setting available with a preference to + select the default adapter, then bind adapter to that.
  • Otherwise, the UA MAY pop up a user dialog for @@ -1334,15 +1320,12 @@ to the selected one.
  • - Otherwise if user prompt is blocked or canceled, select the - first built-in NFC adapter. + Otherwise if user prompt is blocked or canceled, bind + adapter to the first built-in NFC adapter
  • - If no built-in adapters are found, select the first external - (e.g. USB) NFC adapter. -
  • -
  • - Bind adapter to the selected NFC adapter. + Otherwise, if no built-in adapters are found, bind + adapter the first external (e.g. USB) NFC adapter.
  • @@ -1464,6 +1447,8 @@
  • If the message parameter is an empty sequence, + or if any NFCRecord element in + message is not a valid NFCRecord, then reject promise with "SyntaxError", and abort these steps.
  • @@ -1637,11 +1622,10 @@ cancelPush() algorithm.
  • - If the browsing context loses focus (e.g. the user navigated - to another page), then the pending push messages still exist, and - timer continues to run until timeout, or until the user - switches back the focus and an NFC communication occurs, or - the cancelPush() method is called. + If the top-level browsing context loses focus (e.g. the user + navigated to another page), then pending push operations MUST be + canceled by executing the + cancelPush() steps.
  • @@ -2178,8 +2162,7 @@
  • If this is the first watch being set up for the current NFC adapter, make a request to the underlying platform to - listen to NDEF messages, and create a task source as - the Web NFC task source. + listen to NDEF messages.
  • If the request fails, reject promise with @@ -2290,10 +2273,13 @@

    Receiving and parsing content

    When the UA is to receive an NDEF message it MUST run the following algorithm:
      +
    1. + If the top-level browsing context loses focus (e.g. the user + has navigated away to another page), then these steps MUST be suspended. +
    2. Let input be the notation for the NDEF message which has been received by the underlying platform. -
    3. This is a placeholder for a possible future feature. In this step, implementations MAY check if the origin of the @@ -2311,6 +2297,7 @@

      Receiving and parsing content

      input is trusted integrity NFC content, then allowed-origin policies MAY be applied.

      +
    4. Let message be a new empty sequence of NFCRecord objects. @@ -2501,11 +2488,10 @@

      Receiving and parsing content

      record.type, then skip to the next NFC watch.
    5. - Queue a task to invoke the MessageCallback + Queue a task using the Web NFC task source + to invoke the MessageCallback callback with record as its first argument, and messageId as its second argument. - The task source for the tasks queued by algorithms in - this section is the Web NFC task source.
    6. From c6ab4350f2ad576bef5d454f640c7b2c334866a7 Mon Sep 17 00:00:00 2001 From: Zoltan Kis Date: Tue, 15 Sep 2015 22:56:46 +0300 Subject: [PATCH 23/28] Fixed typos. --- index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 0408047..007a264 100644 --- a/index.html +++ b/index.html @@ -1641,7 +1641,7 @@ ndef.TNF field to 0 (NFC Empty Type record).
    7. Set - ndef.TYPE_LENGHT, + ndef.TYPE_LENGTH, ndef.ID_LENGTH and ndef.PAYLOAD_LENGTH fields to 0, and omit the associated fields from the NDEF record: @@ -1848,7 +1848,7 @@
    8. The UA MAY check if record.type is a valid IANA registered type. If not, then MAY throw a - "SyntaxError" exceeption and abort these steps. + "SyntaxError" exception and abort these steps.
    9. Let ndef be the notation for the NDEF record to @@ -1858,7 +1858,7 @@ Set the ndef.TNF field to 2 (Media Type).
    10. - Set the ndef.TYPE field to var>record.type. + Set the ndef.TYPE field to record.type.
    11. Set the ndef.PAYLOAD field to record.data From 5ea42e314800a94da3a2cf1112a244b303468d7c Mon Sep 17 00:00:00 2001 From: Kenneth Rohde Christiansen Date: Wed, 16 Sep 2015 09:02:55 +0200 Subject: [PATCH 24/28] Fix typo --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 007a264..e3d3319 100644 --- a/index.html +++ b/index.html @@ -1367,7 +1367,7 @@

      The NFCPushOptions dictionary

             dictionary NFCPushOptions {
      -        NCPushTarget target = "any";
      +        NFCPushTarget target = "any";
               unsigned long timeout = 10000;
             };
           
      From 462526c69be123e3f68dbc35b683a00956ae6dde Mon Sep 17 00:00:00 2001 From: Kenneth Rohde Christiansen Date: Wed, 16 Sep 2015 09:08:24 +0200 Subject: [PATCH 25/28] Merge step 2 and 9 in pushMessage --- index.html | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/index.html b/index.html index e3d3319..19b751e 100644 --- a/index.html +++ b/index.html @@ -1411,14 +1411,23 @@ then continue running this algorithm in parallel.
    12. - If there is an existing instance of this algorithm running for the - current NFC adapter, abort that instance of this algorithm, + If there are any existing instance of this algorithm running + for the current NFC adapter + whose target equal to options.target or + "any", abort that instance of this algorithm, by rejecting its promise with "AbortError". -

      - Implementations are expected to clean up state on termination, - e.g. reset timer, clear output, etc. -

      +

      + In other words, the current invocation of pushMessage() + rejects and replaces existing running invocations handling the same + options.target. As "any" handles both + "peer" and "tag", existing running invocations + for "any" always gets rejected. +

      +

      + Implementations are expected to clean up state on termination, + e.g. reset timer, clear output, etc. +

    13. If the incumbent settings object is not a @@ -1462,19 +1471,6 @@ reject promise with "SyntaxError", and abort these steps.
    14. -
    15. - If there are any existing instance of this algorithm running - whose target equal to options.target or - "any", reject the promise of these with - "AbortError". -

      - In other words, the current invocation of pushMessage() - rejects and replaces existing running invocations handling the same - options.target. As "any" handles both - "peer" and "tag", existing running invocations - for "any" always gets rejected. -

      -
    16. Let output be the notation for the NDEF message to be created by an API call to the underlying platform, based on From 48863fa6a1d4e2e22954eb5b1bf73baae8bda73e Mon Sep 17 00:00:00 2001 From: Kenneth Rohde Christiansen Date: Wed, 16 Sep 2015 09:31:05 +0200 Subject: [PATCH 26/28] Make a note that browsers may ignore the secure context for dev purposes --- index.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/index.html b/index.html index 19b751e..3b253cc 100644 --- a/index.html +++ b/index.html @@ -1277,6 +1277,9 @@ If the incumbent settings object is not a secure context, reject promise with "SecurityError", and abort these steps. +
      + Browsers may ignore this rule for development purposes only. +
    17. If there is no support for NFC adapter handling functionality in @@ -1433,6 +1436,9 @@ If the incumbent settings object is not a secure context, reject promise with "SecurityError", and abort these steps. +
      + Browsers may ignore this rule for development purposes only. +
    18. An implementation MAY reject promise with @@ -1913,6 +1919,9 @@ If the incumbent settings object is not a secure context, reject promise with "SecurityError", and abort these steps. +
      + Browsers may ignore this rule for development purposes only. +
    19. If there is no message set for pushing as described in the @@ -2128,6 +2137,9 @@ If the incumbent settings object is not a secure context, reject promise with "SecurityError", and abort these steps. +
      + Browsers may ignore this rule for development purposes only. +
    20. If there is no support for the functionality of receiving data from @@ -2231,6 +2243,9 @@ If the incumbent settings object is not a secure context, reject promise with "SecurityError", and abort these steps. +
      + Browsers may ignore this rule for development purposes only. +
    21. If the parameter id is undefined, then From 57d0487d0e93ad0df7d09588980ac9f940b412e3 Mon Sep 17 00:00:00 2001 From: Kenneth Rohde Christiansen Date: Wed, 16 Sep 2015 09:35:32 +0200 Subject: [PATCH 27/28] Make the default time out UA dependent --- index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 3b253cc..ad072a9 100644 --- a/index.html +++ b/index.html @@ -1371,7 +1371,7 @@
             dictionary NFCPushOptions {
               NFCPushTarget target = "any";
      -        unsigned long timeout = 10000;
      +        unsigned long timeout;
             };
           

      @@ -1382,8 +1382,8 @@

      The NFCPushOptions.timeout property denotes the timeout for the pending pushMessage() - operation expressed in milliseconds. The default, and maximal value is - 10000, i.e. 10 seconds. After the timeout expires, the + operation expressed in milliseconds. The default value is + implementation-dependent. After the timeout expires, the message set for sending is cleared, an error is returned, and a new Web NFC message can be set for sending.

      From 3a5f734e63640c4f68d7697e328a136c95330355 Mon Sep 17 00:00:00 2001 From: Zoltan Kis Date: Wed, 16 Sep 2015 12:04:21 +0300 Subject: [PATCH 28/28] Concerning #49: specified timeout related behavior in more detail. --- index.html | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index ad072a9..bfefc18 100644 --- a/index.html +++ b/index.html @@ -1383,7 +1383,8 @@ The NFCPushOptions.timeout property denotes the timeout for the pending pushMessage() operation expressed in milliseconds. The default value is - implementation-dependent. After the timeout expires, the + implementation-dependent. The value Infinity means there is + no timeout. After the timeout expires, the message set for sending is cleared, an error is returned, and a new Web NFC message can be set for sending.

      @@ -1394,7 +1395,7 @@ This section describes how to write an NDEF message to an NFC tag or how to push it to an NFC peer device next time when they get into proximity range, or until - a timeout expires. At any time for there is at maximum two + a timeout expires. At any time there is at maximum two Web NFC messages that can be set for sending for an origin: one targeted to NFC tags and one to NFC peers. When there is a Web NFC message set for sending @@ -1470,7 +1471,9 @@
    22. If the options parameter is undefined, then let options be a new NFCPushOptions - object with the default values. + object with the default values. If any of the + NFCPushOptions properties are undefined, use + the default values.
    23. Otherwise, if the options parameter is defined and it is not a valid instance of NFCPushOptions, then @@ -1480,7 +1483,8 @@
    24. Let output be the notation for the NDEF message to be created by an API call to the underlying platform, based on - data provided by these steps. + data provided by these steps. On any termination of this algorithm, + output MUST be cleared.
    25. For each NFCRecord record in the sequence @@ -1576,12 +1580,19 @@ Add web ndef to output.
    26. - Let timer be a new timer associated with this invocation - of pushMessage(). + If options.timeout value is not valid or not supported + in the underlying platform, reject promise with + "SyntaxError", and abort these steps. +
    27. + If options.timeout value is not Infinity, + let timer be a new timer associated with this invocation + of pushMessage(), set to options.timeout, + and start timer. On any termination of this algorithm, + timer MUST be cleared.
    28. - If timer expires, reject promise with - "TimeoutError" and abort these steps. + If timer exists and expires, reject promise + with "TimeoutError" and abort these steps.
    29. When an NFC device comes within communication range,