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

[whatwg] Structured clone algorithm a little too friendly?

From: ben turner <bent@mozilla.com>
Date: Mon, 1 Mar 2010 14:50:30 -0800
Message-ID: <21b1517c1003011450q4fb1c521g8ee38d608196d4e5@mail.gmail.com>
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
Received on Monday, 1 March 2010 14:50:30 UTC

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