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

WebIDL - passing undefined as optional nullable param

From: Janusz Majnert <j.majnert@samsung.com>
Date: Tue, 13 Jan 2015 09:41:47 +0100
Message-id: <54B4DA4B.90104@samsung.com>
To: public-script-coord@w3.org
Hi,
I have this function definition:

void doSomething(DOMString a, optional ErrorCallback? onError);


I'm trying to find out if exceptions should be thrown in the following 
cases:
1. The optional argument is not given: doSomething("aaa");
2. undefined is passed: doSomething("aaa", undefined);

I tried tracing this through the WebIDL spec and came to the conclusion 
that case 1 should work ok. For case 2, it should throw a TypeError 
(WebIDL 4.2.23, point 1), unless there is some way that the nullability 
takes effect.


Regards,
-- 
Janusz Majnert
Senior Software Engineer
Samsung R&D Institute Poland
Samsung Electronics
Received on Tuesday, 13 January 2015 08:42:18 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 13 January 2015 08:42:19 UTC