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

Enable promise rejection event tests in ShadowRealm #49341

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

ptomato
Copy link
Contributor

@ptomato ptomato commented Nov 22, 2024

PromiseRejectionEvent, onunhandledrejection, and onrejectionhandled should be tested in ShadowRealm scopes. This requires shuffling around some existing tests, and writing a few new ones.

These test files all execute the same tests in different global scopes. We
can remove the boilerplate and just combine them all into an .any.js file
to achieve the same result.
Task queuing mechanisms based on setTimeout(), postMessage(), and
createImageBitmap() are not universally exposed. Split this test into two
files, one that uses only universally exposed APIs, and one that does not.

Move the helper functions common to both files, into a support file.
promise-rejection-events.any.js tests several combinations of microtask
queueing with postMessage, MutationObserver, and Promise.resolve().then().
Add queueMicrotask to this mix, and put it in
promise-rejection-events-universal.any.js since it is available
universally.

Not sure if the section "Positive unhandledrejection/rejectionhandled
tests with delayed attachment" is relevant, as there is no way to queue a
"macrotask" inside ShadowRealm, so it might not be possible to test the
case where it's too late to attach a handler.
These seem OK to run in dedicated workers as well.
This is based on promise-rejection-events-onerror.html but without using
"DOM manipulation task source" to queue a task.
@ptomato ptomato force-pushed the shadowrealm-promise-rejection-event branch from 73d403b to fc6a598 Compare November 27, 2024 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants