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

Bug Involving queueMicrotask #932

Closed
stephahart opened this issue May 3, 2021 · 2 comments
Closed

Bug Involving queueMicrotask #932

stephahart opened this issue May 3, 2021 · 2 comments

Comments

@stephahart
Copy link

stephahart commented May 3, 2021

"@babel/core": "^7.14.0"
"@babel/preset-env": "^7.14.0"
"core-js": "^3.11.1"

Testing on iOS 10.3.2 in (Mobile Safari 10.0):

// modern engines have queueMicrotask method
if (!queueMicrotask) {
  flush = function () {
    var parent, fn;
    if (IS_NODE && (parent = process.domain)) parent.exit();
    while (head) {
      alert(JSON.stringify(head)); // inifinite loop, where head evaluates to "{}"
      fn = head.fn;
      head = head.next;
      try {
        fn();
      } catch (error) {
        if (head) notify();
        else last = undefined;
        throw error;
      }
    } last = undefined;
    if (parent) parent.enter();
  };

In this excerpt of code, I'm somehow getting stuck in a loop where alert(JSON.stringify(head)) constantly evaluates to false.

I'm not able to debug more, but this code is also triggered in my dev environment:

  // environments with maybe non-completely correct, but existent Promise
  } else if (Promise && Promise.resolve) {
    // Promise.resolve without an argument throws an error in LG WebOS 2
    promise = Promise.resolve(undefined);
    then = promise.then;
    notify = function () {
      then.call(promise, flush);
    };
  } ...
@stephahart
Copy link
Author

This issue is not present in version 3.11.0.

@zloirock
Copy link
Owner

zloirock commented May 3, 2021

Try 3.11.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants