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

[whatwg] MessagePorts and message delivery ordering

From: Drew Wilson <atwilson@google.com>
Date: Thu, 6 Aug 2009 14:26:33 -0700
Message-ID: <f965ae410908061426l31e300c4n6de84c2e03a264a4@mail.gmail.com>
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

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