When a message is posted to multiple ports at once, the order in which
the callbacks for these messages are invoked is non-deterministic.
To account for this, the test has been rewritten to accumulate logs
for each port separately, and then print them grouped by port.
The way this test was written didn't guarantee a deterministic message
order, resulting in different output in Chromium and Firefox. This
change slightly rearranges the message order to make it deterministic.
This change is necessary as a prepartion for upcoming change that makes
MessagePort post messages from a separate thread, which would've
revealed the non-deterministic message order.
This is to allow future changes to do cross-process MessagePorts in an
implementation-agnostic way. Add some tests for this behavior.
Delivering messages that were posted to a MessagePort just before it was
transferred is not yet implemented still.