Follow-up to #31505
Currently, we perform_a_microtask_checkpoint after the handling of each "sequential" message in the script-thread. This includes various types of messages.
As per the spec, a microtask checkpoint should only be run after running a task, which corresponds to MainThreadScriptMsg::Common(CommonScriptMsg::Task().
I've tried only running those after a task, and got some unexpected test results, so this requires more investigation. For example, if we call into javascript at any point when handling those "other types of message", for example by firing an event, we are sort of running a task and need to perform a microtask checkpoint afterwards. I assume we are indeed doing this, and that this is why it is necessary to run the microtask checkpoint after having handled any type of message.
A potential solution would be to queue a task, and only from within the task calling into JS. But this needs to be determined on a case by case basis, based on the spec or if absent, common sense.
Follow-up to #31505
Currently, we perform_a_microtask_checkpoint after the handling of each "sequential" message in the script-thread. This includes various types of messages.
As per the spec, a microtask checkpoint should only be run after running a task, which corresponds to
MainThreadScriptMsg::Common(CommonScriptMsg::Task().I've tried only running those after a task, and got some unexpected test results, so this requires more investigation. For example, if we call into javascript at any point when handling those "other types of message", for example by firing an event, we are sort of running a task and need to perform a microtask checkpoint afterwards. I assume we are indeed doing this, and that this is why it is necessary to run the microtask checkpoint after having handled any type of message.
A potential solution would be to queue a task, and only from within the task calling into JS. But this needs to be determined on a case by case basis, based on the spec or if absent, common sense.