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.<div><br></div><div>Let's say that you have two message ports - some other window or a shared worker owns the other end of those ports.</div>
<div><br></div><div>You then do this:</div><div><br></div><div>port1.postMessage("foo");</div><div>port2.postMessage("bar");</div><div><br></div><div>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).</div>
<div><br></div><div>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.</div><div><br></div><div>-atw</div><div><br>
</div><div><br></div>