[whatwg] MessagePorts and message delivery ordering

I was writing some unit tests for SharedWorkers, and I saw some behavior
that seems to be spec compliant, but which was counter-intuitive from a
developer standpoint.
Let's say that you have two message ports - some other window or a shared
worker owns the other end of those ports.

You then do this:

port1.postMessage("foo");
port2.postMessage("bar");

At the other end, the order of the delivery of these messages is entirely
arbitrary (could be "foo"->"bar", or "bar"->"foo") even though those ports
share the same owner. This is because each port is an individual task
source, and ordering within a given task source is guaranteed by the spec,
but ordering across task sources is intentionally not guaranteed (this
allows UAs to prioritize task sources).

Anyhow, just thought I'd point it out, and make sure there isn't something
in the spec that I missed that should affect delivery ordering in this case.

-atw
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20090806/7fff7210/attachment.htm>

Received on Thursday, 6 August 2009 14:26:33 UTC