W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2009

Re: [webidl] DOMString

From: Oliver Hunt <oliver@apple.com>
Date: Tue, 21 Apr 2009 01:55:09 -0700
Message-Id: <70F44043-FDB2-4D17-B837-935EA2AC8820@apple.com>
To: WebApps WG <public-webapps@w3.org>
On Apr 21, 2009, at 1:38 AM, Anne van Kesteren wrote:

> If something takes a DOMString as value is it clearly defined what  
> happens if the toString algorithm throws or returns a non-DOMString?  
> I haven't been able to find descriptions for that in the Web IDL  
> specification. E.g.
>
> obj  = { toString:function() { throw("haha") } }
> obj2 = { toString:function() { return 1 } }
> obj3 = { toString:function() { return obj } }

The [[ToString]] algorithm is defined in ECMAScript (Section 9.8,  
[1]), the specified behaviour would result in [[ToString]] on obj2  
producing the string "1";  [[ToString]] on obj3 will result in a  
TypeError, as [[DefaultValue]] will produce a non-primitive type  
(Section 9.1, [1])

I would assume that the exception will be propagated to the runtime,  
but it should be stated.

--Oliver

[1] ECMA262-5 RC http://www.ecma-international.org/publications/files/drafts/tc39-2009-025.pdf

>
>
> -- 
> Anne van Kesteren
> http://annevankesteren.nl/
>
Received on Tuesday, 21 April 2009 08:56:08 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:31 GMT