Re: [web-nfc] scan() should validate NDEFScanOptions#{recordType,mediaType} (#437)

What happens now is that properties defined in `option` are passed to the internal slots. No checks here. I guess this is what you'd like to get improved. 

Then, when a tag is read, the [Dispathcing NFC content](https://w3c.github.io/web-nfc/#dispatching-nfc-content) is run, which will first test for `id` equality for _any_ records of the message, then for `recordType` equality over _any_ records of the message, then for `mediaType` equality over _any_ records of the message. All that are specified in the internal slots must be equal to the values from the tags. Only then an event is fired.

This means that if `options` specifies `Foo` for `mediaType`, then the tag will have to have a record with `mediaType` being `Foo`, otherwise it's not a match. 

Since we don't validate `mediaType`, there is not much difference validating against empty `mediaType`, since it will be automatically ignored.

I am not sure what would be the added value if validation was stricter and earlier.

-- 
GitHub Notification of comment by zolkis
Please view or discuss this issue at https://github.com/w3c/web-nfc/issues/437#issuecomment-550222603 using your GitHub account

Received on Wednesday, 6 November 2019 09:25:13 UTC