Skip to content

fix microtask mode compatibility #21507

Open
x04 wants to merge 8 commits intooven-sh:mainfrom
x04:fix/microtask-mode
Open

fix microtask mode compatibility #21507
x04 wants to merge 8 commits intooven-sh:mainfrom
x04:fix/microtask-mode

Conversation

@x04
Copy link
Contributor

@x04 x04 commented Jul 31, 2025

What does this PR do?

Fixes this issue: #20145

How did you verify your code works?

Has a test, requires using my patched WebKit so that will need to be merged before merging this.
See WebKit PR here: oven-sh/WebKit#101

x04 added 3 commits July 30, 2025 18:31
revert some unnecessary formatting changes

microtask mode
@x04
Copy link
Contributor Author

x04 commented Aug 1, 2025

I noticed promise rejections are not handled properly in VMs either, but that is outside the scope of this PR.

If anyone wants to see the issue update the test script with this and run with node/bun:

const shouldThrow = process.argv[3];

// ...

let code = `
  Promise.resolve().then(() => {
    console.log('Microtask inside VM');
  });

  Promise.resolve().then(() => {
    console.log('Microtask inside VM 2');
  });

  console.log('End of VM code');
`;

if (shouldThrow === "true") {
  code = `
    Promise.resolve().then(() => {
      throw new Error('Test error');
    });

    console.log('End of VM code');
  `;
}

Node handles the rejection but Bun silently ignores it. I might fix that just not in this PR.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant