[webnfc]nfc.push should throw TypeError when parameter is 'number'
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 Test Name: nfc.push should fail with TypeError when parameter is 'number' 1.Set the NFCMessage as below: navigator.nfc.push(test_number_data) What is the expected behavior? TypeError is thrown. What went wrong? No error, test case time out. 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 spec: 10.7.1 The push() method (https://w3c.github.io/web-nfc/#the-push-method) If the message parameter is not of type defined by the NFCPushMessage union, reject promise with "TypeError", and abort these steps. So if we push a number to NFC tag, "TypeError" should be thrown.
,
May 4 2017
This is due to implicit number to string conversion.
,
May 4 2017
@alexander.shalamov, according to spec below, number is not part of NFCPushMessage, do you think if spec should make some change for it? 'typedef (DOMString or ArrayBuffer or NFCMessage) NFCPushMessage;'
,
May 4 2017
wanming.lin@ What would we add there? double, short, float? According to WebIDL https://www.w3.org/TR/WebIDL-1/#es-DOMString and ecma spec https://tc39.github.io/ecma262/#sec-tostring it is valid to have web idl interface with method(DOMString str); and call it as method(42); Could you also read webidl and ecma specs links, maybe I misunderstood or missed something. Thanks.
,
May 5 2017
@shalamov, thanks, you are right. |
||
►
Sign in to add a comment |
||
Comment 1 by alexande...@intel.com
, May 4 2017Owner: alexande...@intel.com
Status: Assigned (was: Unconfirmed)