Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upMessageport: use a microtask to "maybe add pending port" #24738
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The global, when first noting a transfer-received port, queues a task to then run the "maybe add pending port logic". The purpose of the task is to only add the port if it isn't transferred in the same task in which it is received.
servo/components/script/dom/globalscope.rs
Line 659 in f3b1f0d
Queuing a task does leave open the possibility for JS to run and transfer the port again, before the queued task actually run. This can happen with timers, or UI events, which currently dispatch JS events without going through the task-queue and hence can be run before a task scheduled on the task-queue(see also #24737).
This could be made more robust by queuing a micro-task, or perhaps not queuing anything at all in the light of the changes introduced by #24664