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: Wed, 22 Jun 2011 02:43:14 -0400
Message-ID: <BANLkTikw-hrWSUFj1msMj=sVHWzS_FVo1Q@mail.gmail.com>
To: David Levin <levin@chromium.org>
Cc: Jonas Sicking <jonas@sicking.cc>, Ian Hickson <ian@hixie.ch>, Andrew Wilson <atwilson@google.com>, Kenneth Russell <kbr@google.com>, 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>, Travis Leithead <Travis.Leithead@microsoft.com>
On Wed, Jun 22, 2011 at 1:57 AM, David Levin <levin@chromium.org> wrote:

> Let's say the call doesn't throw when given a type B that isn't
> transferrable.
> Let's also say some later changes the javascript code and uses B after the
> postMessage call.
> Everything work. No throw is done and B isn't "gutted" because it isn't
> transferrable.

Throwing for unsupported objects will break common, reasonable uses, making
everyone jump hoops to use transfer.  Not throwing will only break code that
seriously misuses the API, by listing objects for transfer and then
continuing to use the object.

Anyway, if this exception is thrown, everyone's going to use a helper like

function filterTransferrable(list) {
    var ret = [];
    for(var i = 0; i < list.length; ++i) {
        if(list[i] instanceof Transferrable)
    return ret;

postMessage([A, B], filterTransferrable([A, B]));

... which will trigger the case you describe anyway.

Glenn Maynard
Received on Wednesday, 22 June 2011 06:43:42 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:32 UTC