[whatwg] Web Workers API

Hi,

The IDL for Worker in the Web Workers API specification shows:

    void postMessage(in any message, in optional MessagePortArray ports);

I have a question regarding the 'any' type for message.

If a caller of postMessage passes an object to a worker that is not a
string, is it converted to a string or can non-string objects be propagated
through to the onmessage(event) in the worker.

So if I write:

var w = new MyWorker('MyWorker.js');
w.postMessage(new MyObject());

--------------
// MyWorker.js

onmessage = function(event)
{
    var d = event.data;
    // what type is 'd'?
}

If 'd' is not a string, then is it a MyObject, and if so, how is it supposed
to be marshalled by the inter-worker(thread) communication?

I suggest that whatever the answer, that this be covered when the spec
document is next updated.

Thanks.

Received on Thursday, 1 July 2010 21:06:28 UTC