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

Re: What changes to Web Messaging spec are proposed? [Was: Re: Using ArrayBuffer as payload for binary data to/from Web Workers]

From: Glenn Maynard <glenn@zewt.org>
Date: Fri, 10 Jun 2011 03:17:12 -0400
Message-ID: <BANLkTin1gmwP7+=ufmN+6=ptpBO09ZDUNw@mail.gmail.com>
To: Travis Leithead <Travis.Leithead@microsoft.com>
Cc: Andrew Wilson <atwilson@google.com>, Kenneth Russell <kbr@google.com>, Jonas Sicking <jonas@sicking.cc>, David Levin <levin@chromium.org>, Arthur Barstow <art.barstow@nokia.com>, Dmitry Lomov <dslomov@google.com>, ben turner <bent.mozilla@gmail.com>, "public-webapps@w3.org" <public-webapps@w3.org>, Ian Hickson <ian@hixie.ch>
(Can you please reset your font?)

On Fri, Jun 10, 2011 at 1:54 AM, Travis Leithead <
Travis.Leithead@microsoft.com> wrote:

>  We don’t really need to support JavaScript objects, arrays, complex
> graphs, etc. at all with the new API
>

Strongly disagree.  I should be able to transfer objects naturally with the
existing API, with the same flexibility:

postMessage([
    { frameData: computedArrayBuffer, frameId: 1, complexNestedObject: obj1
},
    { frameData: secondComputedArrayBuffer, frameId: 2, complexNestedObject:
obj2 }
], [computedArrayBuffer, secondComputedArrayBuffer]);

Using a whole separate API that can't handle everything that structured
clone can would be an unnecessarily limiting kludge, forcing the receiver to
piece together transferred objects and their associated cloned objects,
which would be received in separate messages.

This proposal is also completely transparent to the receiving side, so an
API exposed through messages can make use of object transfer without
affecting users of the API.

(and since the current proposal requires the web developer to make an
> explicit list anyway for the 2nd param to post message, it’s no _*more*_
> work to do the same for a new API).
>

It's a lot more work for the developer if he has to use separate APIs for
transferred objects and everything else.

(Also, a minor side proposal is to allow including object constructors, so
you can say things like postMessage(obj, [ArrayBuffer]).  That would allow
developers to avoid having to write an explicit list.)

-- 
Glenn Maynard
Received on Friday, 10 June 2011 07:17:39 GMT

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