W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

postMessage is the new wtf

From: Rick Waldron <waldron.rick@gmail.com>
Date: Tue, 13 Dec 2011 11:24:51 -0500
Message-ID: <CAHfnhfo4OYTP6QrjDF60VAoeAuN6OyJ2GBQPdUc-dS57BrSUjA@mail.gmail.com>
To: Webapps WG <public-webapps@w3.org>
Following the recent blog post
http://updates.html5rocks.com/2011/12/Transferable-Objects-Lightning-Fastand
subsequent Twitter discussion regarding changes to the parameter list
of:

Worker.prototype.postMessage( message [, transfer ] ) [1]

DedicatedWorkerGlobalScope void
postMessage<http://dev.w3.org/html5/workers/#dom-dedicatedworkerglobalscope-postmessage>(any
message, optional sequence<Transferable> transfer) [2][3]


I'm unable to find documentation or discussion that would clarify the
rationale of over-using and over-loading the "postMessage" Identifier;
considering the the blog cited above shows this example:

[window|worker].webkitPostMessage(uInt8Array.buffer, [uInt8Array.buffer]);

which conflicts with:

window.postMessage(message, targetOrigin [, transfer ]) [4][5]

and they both conflict with:

DedicatedWorkerGlobalScope : WorkerGlobalScope ...
 void postMessage(in any message, in optional MessagePortArray ports); [6]

Currently, passing a second arg to worker.postMessage(), that is not a
MessagePortArray raises
"Uncaught TypeError: MessagePortArray argument must contain only
MessagePorts" in Chrome and "Could not get domain" warning in Firefox.


Any reasonable clarification would be greatly appreciated.

Thanks in advance

Rick


[1]
http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#dedicated-workers-and-the-worker-interface

[2]
http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#dedicated-workers-and-the-dedicatedworkerglobalscope-interface

[3]
http://dev.w3.org/html5/workers/#dedicated-workers-and-the-dedicatedworkerglobalscope-interface

[4]
http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html#web-messaging

[5]
http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html#posting-messages

[6] PREVIOUS SPECIFICATION STATE!!!
http://www.w3.org/TR/2011/WD-workers-20110208/#dedicated-workers-and-the-dedicatedworkerglobalscope-interface
Received on Tuesday, 13 December 2011 16:34:05 GMT

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