[whatwg] JSON support for worker postMessage

Jonas Sicking jonas at sicking.cc
Mon Nov 17 20:10:12 PST 2008


Indeed. Blobs is a great idea. We'll probably have to create further 
JSON extensions to support that.

/ Jonas

Aaron Boodman wrote:
> +1, because I think it will be useful to pass other things to workers
> that JSON cannot represent (blobs) in the future.
> 
> - a
> 
> On Mon, Nov 17, 2008 at 8:03 PM, Jonas Sicking <jonas at sicking.cc> wrote:
>> Hi All,
>>
>> Ben just wrote up a patch to support JSON objects as well as primitive
>> values (0, null, false, etc) to be passed to and from workers using
>> postMessage.
>>
>> Wanted to see what the reactions to this was. Is it a good idea or not?
>>
>> I seem to recall this coming up in the past in the original feedback about
>> what features people wanted.
>>
>> The technical details are as follows:
>> Any of the following values are passed by value as-is:
>> * strings
>> * numbers
>> * booleans
>> * undefined
>> * null
>>
>> Anything else is passed to JSON.stringify (defined by Ecmascript drafts
>> here[1]). If calling JSON.stringify throws the same error will be thrown by
>> the function. Otherwise the message event fired on the other 'side' will
>> contain the result of JSON.parse.
>>
>> / Jonas
>>




More information about the whatwg mailing list