W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2009

[whatwg] postMessage object cloning

From: Oliver Hunt <oliver@apple.com>
Date: Mon, 16 Mar 2009 17:33:59 -0700
Message-ID: <DA7BF391-3EDD-4EE0-8E9F-D06305FD5080@apple.com>
So I've been looking at the object cloning rules for postMessage and  
have noticed a couple of things that seem less than ideal.  The first  
is that it fails to specify the behaviour of cloning for prototype  
chains.  While this is definitely an issue specific to JS rather than  
binding languages as a whole, JS is the language of the web, so if I  
have an object, a la:
myObject = {};
myObject.__proto__ = {foo: "bar"}

Do we clone the prototype object?  Do we flatten the prototype list?  
or do we drop the prototype?

The other issue i bumped into is behaviour of ImageData/ 
CanvasPixelArray -- currently (per spec) these will not be cloned, and  
instead have to be marshalled into and out of arrays by the  
developer.  This seems less than ideal -- could the internal  
structuring algorithm be extended to include these types.  The  
alternative is to allow CPA, etc to be automatically marshalled to  
arrays, which (while not ideal) would at least get processing correct  
in one direction.  Unfortunately the developer would still have to  
manually marshall data coming from the worker, hence my preference for  
allowing ImageData and CPA to be cloned.

Received on Monday, 16 March 2009 17:33:59 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:10 UTC