w3c / web-nfc

Web NFC
https://w3c.github.io/web-nfc/
Other
313 stars 69 forks source link

toRecords() should be nullable or not? #487

Closed leonhsl closed 4 years ago

leonhsl commented 4 years ago

I think toRecords() is better to be nullable. It returning null indicates this Sp/external record's payload is just a plain buffer but not an NDEF message at all, and returning an empty sequence indicates the payload is an NDEF message that does not have any record.

Currently the spec https://w3c.github.io/web-nfc/#dfn-parse-records-from-bytes makes toRecords() return an empty sequence for both the cases mentioned above.

WDYT? The background is https://chromium-review.googlesource.com/c/chromium/src/+/1980586, we need to change either spec or impl to keep them consistent. @kenchris @zolkis @beaufortfrancois @riju

zolkis commented 4 years ago

Makes sense to me. Once more it proves that implementation feedback is essential.

beaufortfrancois commented 4 years ago

I'll update spec to make toRecords nullable.