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
Fix isLocal algorithm #493
Conversation
@@ -3752,6 +3752,10 @@ <h3>Parsing content</h3> | |||
<li> | |||
If |ndef|'s |typeNameField| is `1` ([=well-known type record=]): | |||
<ol> | |||
<li> | |||
Set |record|'s <a>isLocal</a> to `true` if |ndef| is a payload |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose {U
, T
, Sp
} types here should not be set isLocal=true
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not all sub-records must be local types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to decide what isLocal
means: to denote that a record is in the payload of another record, of if the type is a local type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a previous comment of @leonhsl it seems we want that isLocal
means only a local type, not sub-recordness. However, when creating records, a local type may only exist in a containing record. But other than local types may be part of a message that is payload to a record.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's what I read from the discussion you had in the issue, isLocal
is to denote the record is a local type, to differentiate a "text" local type record (sub-record of course) from a TEXT sub-record.
I think we allow users to create local type records at all times, but we reject the push()
promise when we found the top-level message contains a local type record.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was also thinking if we could consider an implicit context (no conflicts within a message), but the NFC Forum RTD clearly says "NFC Forum Local Types are available for use within the context of another record". So local type may only occur in the payload of a record, but we should set isLocal
only for those sub-records that actually have a local type. Done :).
to another <a>NDEF record</a>, reject |promise| with a {{TypeError}} | ||
and abort these steps. | ||
</li> | ||
If |record|'s <a>isLocal</a> is `true`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you moved this to the front, but the validate local type steps were written with the old algorithm in mind. If we check local types up-front, we need to update/change the validation algorithm as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, on a second look, the current validation algorithm should fare pretty well here as well.
I think I will merge this and continue from there. Thanks! |
Some notable points: 1) Local type in WebNFC APIs is always prefixed by ':', but, the ':' will be omitted when it's actually written into the nfc tag. ":act" --> "act" to be written as the TYPE field into the nfc tag. ":text" --> "text" The reading direction is vice versa. "act" --> ":act" to be exposed as NDEFRecord#recordType. "text" --> ":text" 2) Only "smart-poster", external, and local type records are supposed to be able to carry a ndef message as payload. 3) Local type is only expected to exist inside a ndef message that is another ndef record's payload. Top level ndef message is not allowed to have a local type record. The spec changes: w3c/web-nfc#491 w3c/web-nfc#493 w3c/web-nfc#495 w3c/web-nfc#502 w3c/web-nfc#506 BUG=520391 Change-Id: Ic2890c031109aa583437ac93a8901ff71992af78
Some notable points: 1) Local type in WebNFC APIs is always prefixed by ':', but, the ':' will be omitted when it's actually written into the nfc tag. ":act" --> "act" to be written as the TYPE field into the nfc tag. ":text" --> "text" The reading direction is vice versa. "act" --> ":act" to be exposed as NDEFRecord#recordType. "text" --> ":text" 2) Only "smart-poster", external, and local type records are supposed to be able to carry a ndef message as payload. 3) Local type is only expected to exist inside a ndef message that is another ndef record's payload. Top level ndef message is not allowed to have a local type record. The spec changes: w3c/web-nfc#491 w3c/web-nfc#493 w3c/web-nfc#495 w3c/web-nfc#502 w3c/web-nfc#506 BUG=520391 Change-Id: Ic2890c031109aa583437ac93a8901ff71992af78
Some notable points: 1) Local type in WebNFC APIs is always prefixed by ':', but, the ':' will be omitted when it's actually written into the nfc tag. ":act" --> "act" to be written as the TYPE field into the nfc tag. ":text" --> "text" The reading direction is vice versa. "act" --> ":act" to be exposed as NDEFRecord#recordType. "text" --> ":text" 2) Only "smart-poster", external, and local type records are supposed to be able to carry a ndef message as payload. 3) Local type is only expected to exist inside a ndef message that is another ndef record's payload. Top level ndef message is not allowed to have a local type record. The spec changes: w3c/web-nfc#491 w3c/web-nfc#493 w3c/web-nfc#495 w3c/web-nfc#502 w3c/web-nfc#506 BUG=520391 Change-Id: Ic2890c031109aa583437ac93a8901ff71992af78
Some notable points: 1) Local type in WebNFC APIs is always prefixed by ':', but, the ':' will be omitted when it's actually written into the nfc tag. ":act" --> "act" to be written as the TYPE field into the nfc tag. ":text" --> "text" The reading direction is vice versa. "act" --> ":act" to be exposed as NDEFRecord#recordType. "text" --> ":text" 2) Only "smart-poster", external, and local type records are supposed to be able to carry a ndef message as payload. 3) Local type is only expected to exist inside a ndef message that is another ndef record's payload. Top level ndef message is not allowed to have a local type record. The spec changes: w3c/web-nfc#491 w3c/web-nfc#493 w3c/web-nfc#495 w3c/web-nfc#502 w3c/web-nfc#506 BUG=520391 Change-Id: Ic2890c031109aa583437ac93a8901ff71992af78
Some notable points: 1) Local type in WebNFC APIs is always prefixed by ':', but, the ':' will be omitted when it's actually written into the nfc tag. ":act" --> "act" to be written as the TYPE field into the nfc tag. ":text" --> "text" The reading direction is vice versa. "act" --> ":act" to be exposed as NDEFRecord#recordType. "text" --> ":text" 2) Only "smart-poster", external, and local type records are supposed to be able to carry a ndef message as payload. 3) Local type is only expected to exist inside a ndef message that is another ndef record's payload. Top level ndef message is not allowed to have a local type record. The spec changes: w3c/web-nfc#491 w3c/web-nfc#493 w3c/web-nfc#495 w3c/web-nfc#502 w3c/web-nfc#506 BUG=520391 Change-Id: Ic2890c031109aa583437ac93a8901ff71992af78 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1996946 Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Reilly Grant <reillyg@chromium.org> Commit-Queue: Leon Han <leon.han@intel.com> Cr-Commit-Position: refs/heads/master@{#737290}
Some notable points: 1) Local type in WebNFC APIs is always prefixed by ':', but, the ':' will be omitted when it's actually written into the nfc tag. ":act" --> "act" to be written as the TYPE field into the nfc tag. ":text" --> "text" The reading direction is vice versa. "act" --> ":act" to be exposed as NDEFRecord#recordType. "text" --> ":text" 2) Only "smart-poster", external, and local type records are supposed to be able to carry a ndef message as payload. 3) Local type is only expected to exist inside a ndef message that is another ndef record's payload. Top level ndef message is not allowed to have a local type record. The spec changes: w3c/web-nfc#491 w3c/web-nfc#493 w3c/web-nfc#495 w3c/web-nfc#502 w3c/web-nfc#506 BUG=520391 Change-Id: Ic2890c031109aa583437ac93a8901ff71992af78 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1996946 Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Reilly Grant <reillyg@chromium.org> Commit-Queue: Leon Han <leon.han@intel.com> Cr-Commit-Position: refs/heads/master@{#737290}
Some notable points: 1) Local type in WebNFC APIs is always prefixed by ':', but, the ':' will be omitted when it's actually written into the nfc tag. ":act" --> "act" to be written as the TYPE field into the nfc tag. ":text" --> "text" The reading direction is vice versa. "act" --> ":act" to be exposed as NDEFRecord#recordType. "text" --> ":text" 2) Only "smart-poster", external, and local type records are supposed to be able to carry a ndef message as payload. 3) Local type is only expected to exist inside a ndef message that is another ndef record's payload. Top level ndef message is not allowed to have a local type record. The spec changes: w3c/web-nfc#491 w3c/web-nfc#493 w3c/web-nfc#495 w3c/web-nfc#502 w3c/web-nfc#506 BUG=520391 Change-Id: Ic2890c031109aa583437ac93a8901ff71992af78 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1996946 Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Reilly Grant <reillyg@chromium.org> Commit-Queue: Leon Han <leon.han@intel.com> Cr-Commit-Position: refs/heads/master@{#737290}
…ype records, a=testonly Automatic update from web-platform-tests [webnfc] Support writing/reading local type records Some notable points: 1) Local type in WebNFC APIs is always prefixed by ':', but, the ':' will be omitted when it's actually written into the nfc tag. ":act" --> "act" to be written as the TYPE field into the nfc tag. ":text" --> "text" The reading direction is vice versa. "act" --> ":act" to be exposed as NDEFRecord#recordType. "text" --> ":text" 2) Only "smart-poster", external, and local type records are supposed to be able to carry a ndef message as payload. 3) Local type is only expected to exist inside a ndef message that is another ndef record's payload. Top level ndef message is not allowed to have a local type record. The spec changes: w3c/web-nfc#491 w3c/web-nfc#493 w3c/web-nfc#495 w3c/web-nfc#502 w3c/web-nfc#506 BUG=520391 Change-Id: Ic2890c031109aa583437ac93a8901ff71992af78 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1996946 Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Reilly Grant <reillyg@chromium.org> Commit-Queue: Leon Han <leon.han@intel.com> Cr-Commit-Position: refs/heads/master@{#737290} -- wpt-commits: a1652e2faab5c92db0d3a2523ef9a94003e1e8f5 wpt-pr: 21157
…ype records, a=testonly Automatic update from web-platform-tests [webnfc] Support writing/reading local type records Some notable points: 1) Local type in WebNFC APIs is always prefixed by ':', but, the ':' will be omitted when it's actually written into the nfc tag. ":act" --> "act" to be written as the TYPE field into the nfc tag. ":text" --> "text" The reading direction is vice versa. "act" --> ":act" to be exposed as NDEFRecord#recordType. "text" --> ":text" 2) Only "smart-poster", external, and local type records are supposed to be able to carry a ndef message as payload. 3) Local type is only expected to exist inside a ndef message that is another ndef record's payload. Top level ndef message is not allowed to have a local type record. The spec changes: w3c/web-nfc#491 w3c/web-nfc#493 w3c/web-nfc#495 w3c/web-nfc#502 w3c/web-nfc#506 BUG=520391 Change-Id: Ic2890c031109aa583437ac93a8901ff71992af78 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1996946 Reviewed-by: Daniel Cheng <dchengchromium.org> Reviewed-by: Reilly Grant <reillygchromium.org> Commit-Queue: Leon Han <leon.hanintel.com> Cr-Commit-Position: refs/heads/master{#737290} -- wpt-commits: a1652e2faab5c92db0d3a2523ef9a94003e1e8f5 wpt-pr: 21157 UltraBlame original commit: db0bf96c8b8840896e7a762605492f3f55594981
…ype records, a=testonly Automatic update from web-platform-tests [webnfc] Support writing/reading local type records Some notable points: 1) Local type in WebNFC APIs is always prefixed by ':', but, the ':' will be omitted when it's actually written into the nfc tag. ":act" --> "act" to be written as the TYPE field into the nfc tag. ":text" --> "text" The reading direction is vice versa. "act" --> ":act" to be exposed as NDEFRecord#recordType. "text" --> ":text" 2) Only "smart-poster", external, and local type records are supposed to be able to carry a ndef message as payload. 3) Local type is only expected to exist inside a ndef message that is another ndef record's payload. Top level ndef message is not allowed to have a local type record. The spec changes: w3c/web-nfc#491 w3c/web-nfc#493 w3c/web-nfc#495 w3c/web-nfc#502 w3c/web-nfc#506 BUG=520391 Change-Id: Ic2890c031109aa583437ac93a8901ff71992af78 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1996946 Reviewed-by: Daniel Cheng <dchengchromium.org> Reviewed-by: Reilly Grant <reillygchromium.org> Commit-Queue: Leon Han <leon.hanintel.com> Cr-Commit-Position: refs/heads/master{#737290} -- wpt-commits: a1652e2faab5c92db0d3a2523ef9a94003e1e8f5 wpt-pr: 21157 UltraBlame original commit: db0bf96c8b8840896e7a762605492f3f55594981
…ype records, a=testonly Automatic update from web-platform-tests [webnfc] Support writing/reading local type records Some notable points: 1) Local type in WebNFC APIs is always prefixed by ':', but, the ':' will be omitted when it's actually written into the nfc tag. ":act" --> "act" to be written as the TYPE field into the nfc tag. ":text" --> "text" The reading direction is vice versa. "act" --> ":act" to be exposed as NDEFRecord#recordType. "text" --> ":text" 2) Only "smart-poster", external, and local type records are supposed to be able to carry a ndef message as payload. 3) Local type is only expected to exist inside a ndef message that is another ndef record's payload. Top level ndef message is not allowed to have a local type record. The spec changes: w3c/web-nfc#491 w3c/web-nfc#493 w3c/web-nfc#495 w3c/web-nfc#502 w3c/web-nfc#506 BUG=520391 Change-Id: Ic2890c031109aa583437ac93a8901ff71992af78 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1996946 Reviewed-by: Daniel Cheng <dchengchromium.org> Reviewed-by: Reilly Grant <reillygchromium.org> Commit-Queue: Leon Han <leon.hanintel.com> Cr-Commit-Position: refs/heads/master{#737290} -- wpt-commits: a1652e2faab5c92db0d3a2523ef9a94003e1e8f5 wpt-pr: 21157 UltraBlame original commit: db0bf96c8b8840896e7a762605492f3f55594981
…ype records, a=testonly Automatic update from web-platform-tests [webnfc] Support writing/reading local type records Some notable points: 1) Local type in WebNFC APIs is always prefixed by ':', but, the ':' will be omitted when it's actually written into the nfc tag. ":act" --> "act" to be written as the TYPE field into the nfc tag. ":text" --> "text" The reading direction is vice versa. "act" --> ":act" to be exposed as NDEFRecord#recordType. "text" --> ":text" 2) Only "smart-poster", external, and local type records are supposed to be able to carry a ndef message as payload. 3) Local type is only expected to exist inside a ndef message that is another ndef record's payload. Top level ndef message is not allowed to have a local type record. The spec changes: w3c/web-nfc#491 w3c/web-nfc#493 w3c/web-nfc#495 w3c/web-nfc#502 w3c/web-nfc#506 BUG=520391 Change-Id: Ic2890c031109aa583437ac93a8901ff71992af78 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1996946 Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Reilly Grant <reillyg@chromium.org> Commit-Queue: Leon Han <leon.han@intel.com> Cr-Commit-Position: refs/heads/master@{#737290} -- wpt-commits: a1652e2faab5c92db0d3a2523ef9a94003e1e8f5 wpt-pr: 21157
As suggested by @leonhsl at #491 (comment) and #491 (comment), this PR refactors "Creating NDEF record" algorithm for
isLocal
and makes sure we setisLocal=true
only for TNF=1 records.Preview | Diff