[webnfc]nfc.push should throw SyntaxError when NFCMessage is invalid
Reported by
canx....@intel.com,
May 4 2017
|
|||||
Issue descriptionSteps to reproduce the problem: Test Case: https://thewebera.github.io/web-test-suite/web-nfc/nfc/nfc_push_exceptions.https.html Tese Name: Test that promise is rejected with SyntaxError if NFCMessage is invalid. 1.Set invalid NFCMessage What is the expected behavior? SyntaxError is thrown. What went wrong? TypeError is thrown. Did this work before? N/A Does this work in other browsers? N/A Chrome version: 60.0.3087.3 Channel: canary OS Version: Nexus 7(Android 5.1) Flash Version: Shockwave Flash 25.0 r0 According to the spec: 10.7.1.3 Mapping empty record to NDEF(https://w3c.github.io/web-nfc/#mapping-string-to-ndef) Description: If record.data is not a string or number, throw a "SyntaxError" exception and abort these steps. If record.mediaType is not a string or starts with "text/", then throw a "SyntaxError" exception and abort these steps. In addition, UAs may check that record.mediaType is an IANA registered media type for text. If not, then the UA may throw a "SyntaxError" exception and abort these steps.
,
May 4 2017
,
May 5 2017
e.g. Mapping string to NDEF, if record.mediaType is not a string or starts with "text/", then throw a "SyntaxError" exception.
'{recordType: "text", mediaType: "application/json", data: "test text data"}'
Actually, it throws "TypeError".
,
May 5 2017
We need few more fixes for map-to-ndef algorithm, I will create issue and PR for the spec.
,
May 10 2017
Created https://github.com/w3c/web-nfc/issues/116 and https://github.com/w3c/web-nfc/pull/115 Will update implementation as soon as spec is updated.
,
May 24 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/f33e1d034eabce26a32bf9b05f3ca29a924fd237 commit f33e1d034eabce26a32bf9b05f3ca29a924fd237 Author: alexander.shalamov <alexander.shalamov@intel.com> Date: Wed May 24 12:52:17 2017 [webnfc] Align nfc.push operation with the specification This CL aligns error handling for nfc.push operation, with the latest changes in the specification. Whenever invlid type is provided, resulting promise is rejected with 'TypeError' exception. When error happens due to the invalid sytnax or tokens, resulting promise is rejected with 'SyntaxError' exception. Layout test updated accordingly. BUG= 718349 Review-Url: https://codereview.chromium.org/2885813002 Cr-Commit-Position: refs/heads/master@{#474265} [modify] https://crrev.com/f33e1d034eabce26a32bf9b05f3ca29a924fd237/third_party/WebKit/LayoutTests/nfc/push.html [modify] https://crrev.com/f33e1d034eabce26a32bf9b05f3ca29a924fd237/third_party/WebKit/Source/modules/nfc/NFC.cpp [modify] https://crrev.com/f33e1d034eabce26a32bf9b05f3ca29a924fd237/third_party/WebKit/Source/modules/nfc/NFC.h
,
May 24 2017
,
Jun 1 2017
I verified this issue with Chrome 61.0.3116.0, this issue cannot reproduce. Closed.
,
Jun 1 2017
canx.cao@ thanks for verifying |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by alexande...@intel.com
, May 4 2017