W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2013

[webidl.js] Implement the any type

From: François REMY <fremycompany_pub@yahoo.fr>
Date: Thu, 10 Jan 2013 12:01:25 +0100
Message-ID: <DUB002-W141A54DA4CCDC0D58D489CEA52A0@phx.gbl>
To: extensiblewebwebidl.js <reply+i-9734213-995692b9a7a2220a2d186a9d4ca28890d7904718-364405@reply.github.co>
CC: "public-script-coord@w3.org" <public-script-coord@w3.org>, "cam@mcc.id.au" <cam@mcc.id.au>, "public-nextweb@w3.org" <public-nextweb@w3.org>
Hi guys, I found yet another possible issue with the WebIDL spec.

In the "any" conversion algorithm, it's specified that if the ECMAScript value is a Number, it should be converted using the 'double' conversion at section 4.2.14. 


In this section, it's said to throw a type error if the number has the value "NaN" or is infinite.


I can prove this is not what browsers do by looking at the setTimeout function, which takes 'any' arguments. 


In the 'get timeout' algorithm that converts the received value into a number, we can read the following:

  "If timeout is an Infinity value, a Not-a-Number (NaN) value, or negative, let timeout be zero."

I tried calling setTimeout(alert, Number.NaN) and that works perfectly fine in all browsers (alert is executed straightaway), and that doesn't throw a conversion type error because of the 4.2.14 algorithm.

My belief is that the specification should have referenced the "4.2.15 unrestricted double" algorithm instead.

I sent this mail in CC to Cameron & the public-script-coord mailing list, let's see what their response will be. 		 	   		  
Received on Thursday, 10 January 2013 11:01:59 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:08 UTC