Repetitive tasks execution preventing from anything else to be executed, since there is always a new task to execute in the micro tasks queue.
Such scenario should be prevented.
Loop Code :
let c = 0;
function runTask(){
queueMicrotask(() => {
try {
console.log(c++);
runTask();
} catch (e) {
//Expected some error here
}
});
}
runTask();
afaik some browsers already silently do this.
This was discussed when the API was added: https://github.com/whatwg/html/issues/512#issuecomment-171498578
In reality this really isn't too different from having a script do while (true) {}. The HTML Standard already has provisions against both of these cases in https://html.spec.whatwg.org/multipage/webappapis.html#killing-scripts
Most helpful comment
This was discussed when the API was added: https://github.com/whatwg/html/issues/512#issuecomment-171498578
In reality this really isn't too different from having a script do
while (true) {}. The HTML Standard already has provisions against both of these cases in https://html.spec.whatwg.org/multipage/webappapis.html#killing-scripts