Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit queueMicrotask repetitive execution #4641

Closed
bgauryy opened this issue May 19, 2019 · 2 comments
Closed

Limit queueMicrotask repetitive execution #4641

bgauryy opened this issue May 19, 2019 · 2 comments
Labels
clarification Standard could be clearer topic: event loop

Comments

@bgauryy
Copy link

bgauryy commented May 19, 2019

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();
@Yay295
Copy link
Contributor

Yay295 commented May 19, 2019

afaik some browsers already silently do this.

@TimothyGu
Copy link
Member

This was discussed when the API was added: #512 (comment)

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

@annevk annevk added clarification Standard could be clearer topic: event loop labels May 20, 2019
@domenic domenic closed this as completed Sep 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Standard could be clearer topic: event loop
Development

No branches or pull requests

5 participants