[whatwg] Structured clone algorithm a little too friendly?

ben turner bent at mozilla.com
Mon Mar 1 14:50:30 PST 2010


Hi folks,

I'm implementing the structured clone algorithm and this part bothers
me a little bit:

  - If input is a host object (e.g. a DOM node)
      Return the null value.

Seems like this has the potential to confuse web programmers somewhat.
If I were to write code like this:

  worker.postMessage(window);

I would expect something meaningful to happen as long as no exception
was generated. According to the spec, though, we would send null to
the worker and not generate any exception. Is that really desirable?

I like the idea of making the structured clone as friendly as possible
but maybe we should add some teeth to this case just like we do for
recursive objects?

-Ben Turner



More information about the whatwg mailing list