[webkit-dev] Passing data structures through postMessage()

Drew Wilson atwilson at google.com
Thu Sep 10 17:59:46 PDT 2009


I'm not sure that it is actually more restrictive now than it was 6 months
ago. I assume you're looking at this:

http://www.w3.org/TR/2009/WD-html5-20090212/infrastructure.html#safe-passing-of-structured-data

where it seems to say that all host objects (DOM objects, etc) are cloned as
"null". Sounds like you looked into it in much more detail than I did, so
undoubtedly there are ambiguities that aren't obvious at first glance.

Anyhow, from April up until two weeks ago, ImageData was the only serialized
host object:

http://www.w3.org/TR/2009/WD-html5-20090423/infrastructure.html#safe-passing-of-structured-data

...so I'm not totally crazy :)

It's a moot point now - while I could (and did :) imagine a reasonably
compact one-off serialization for something like ImageData, the addition of
the File types on 8/25 (and who knows what else in the future) makes it
clear that serialization is not the way to go.

-atw

On Thu, Sep 10, 2009 at 5:38 PM, Oliver Hunt <oliver at apple.com> wrote:

> No, it is more restrictive now than it was 6 months ago -- I was attempting
> to implement this back then and the ambiguity in handling the more
> excitingly complex objects (now simply "return null") made it substantially
> more complex, that is the only reason the implementation is not currently
> matching the object clone semantic.  JSON was never sufficient for the
> purpose of postMessage, and is also relatively trivially breakable.
>
> --Oliver
>
>
> On Sep 10, 2009, at 5:29 PM, Drew Wilson wrote:
>
>  Good point - re-reviewing the Structured Clone spec, I see all kinds of
>> crazy stuff is cloneable now, so string/JSON may not be a particularly good
>> basis. It seems that we'll need to support File access from Workers, since
>> you can clone/send those objects over from page context.
>>
>> I had expected that having a common serialization format would be useful,
>> but I agree - it probably is better to just send opaque objects around,
>> which might enable WebKit to send actual cloned object instances without
>> requiring any serialization, while chromium can do the serialization itself
>> when sending the data cross-process.
>>
>> -atw
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090910/ce7949bb/attachment.html>


More information about the webkit-dev mailing list