Ian,

The structured clone algorithm is currently defined only for object inputs and doesn't say what should happen when a primitive value is passed to it. (The internal structured cloning algorithm handles primitives, but the outer level one does not.)

Browser implementations allow primitives such as strings to be passed to History.pushState(), window.postMessage() and other methods that reference the structured clone algorithm.

I think you can fix this by changing "object" to "value" in four places:

When a user agent is required to obtain a structured clone of an object [change 
this to value],
it must run the following algorithm, which either returns a separate object [value],
or throws an exception.

Let input be the object [value] being cloned.

Let memory be an association list of pairs of objects, initially empty. This is 
used to handle duplicate references. In each pair of objects, one is called the 
source object and the other the destination object.

Let output be the object [value] resulting from calling the internal structured 
cloning algorithm with input and memory.


        David

        David

Reply via email to