[webkit-dev] How to handle Array types in IDL files?

Maciej Stachowiak mjs at apple.com
Tue Aug 25 23:52:38 PDT 2009


On Aug 25, 2009, at 11:43 PM, Drew Wilson wrote:

> I'm trying to update MessageEvent to match the current HTML5 spec.
>
> Currently, MessageEvent has two references to MessagePort:
>
>         readonly attribute MessagePort messagePort;
>
>         void initMessageEvent(in DOMString typeArg, in boolean  
> canBubbleArg, in boolean cancelableArg, in DOMString dataArg, in  
> DOMString originArg, in DOMString lastEventIdArg, in DOMWindow  
> sourceArg, in MessagePort messagePort);
>
> MessageEvent now needs to support an array of MessagePorts. I had  
> planned to provide a custom getter for the messagePort attribute and  
> change initMessageEvent to be custom as well, resulting in this:
>
>         readonly attribute [CustomGetter] Array ports;
>
>         [Custom] void initMessageEvent(in DOMString typeArg, in  
> boolean canBubbleArg, in boolean cancelableArg, in DOMString  
> dataArg, in DOMString originArg, in DOMString lastEventIdArg, in  
> DOMWindow sourceArg, in Array messagePorts);
>
> My custom JS handlers could map between JSArray and the native  
> WebCore collection used by the impl class. I'm not certain whether  
> this is the right approach for the objc bindings, however - in fact,  
> the generated code for DOMMessageEvent.mm contains "#import Array.h"  
> and "#import DOMArrayInternal.h", neither of which exist.
>
> What do people suggest here? I'm not certain how this should be  
> exposed for ObjC. Other classes (like Clipboard.idl) that use Array  
> don't seem to have objc bindings, but I don't think that's an option  
> for MessageEvent.

We probably need special support for Web IDL array types in the  
bindings generator. Sam can probably comment n more detail. As a  
stopgap, we could make the relevant IDL attributes be JS only. I would  
check out what Web IDL says about Array - I don't think it's supposed  
to be reflected as just a vanilla JS Array.

Regards,
Maciej


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090825/f6fddee5/attachment.html>


More information about the webkit-dev mailing list