postMessage is the new wtf

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 UTC