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 ShadowRealm testing for ErrorEvent and queueMicrotask #49325

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

Conversation

ptomato
Copy link
Contributor

@ptomato ptomato commented Nov 22, 2024

Adapt the tests for the onerror event on Worker global scopes to cover ShadowRealm global scopes as well.

One of the tests uses setTimeout() directly to fire the global onerror event. Use queueMicrotask() instead, since that is [Exposed=*]. We cannot use t.step_timeout() because that wraps the callback in a t.step_func() which catches the error and fails the test.

Run the microtask evaluation order tests in ShadowRealm scopes.

Add a new test ensuring that the behaviour of wrapping exceptions thrown from outer realm functions in a fresh TypeError extends to the onerror event as well.

(This PR was originally for just ErrorEvent and onerror. I added my queueMicrotask coverage as well, because most of the tests are quite related.)

Adapt the tests for the onerror event on Worker global scopes to cover
ShadowRealm global scopes as well.

One of the tests uses setTimeout() directly to fire the global onerror
event. Use queueMicrotask() instead, since that is [Exposed=*]. We cannot
use t.step_timeout() because that wraps the callback in a t.step_func()
which catches the error and fails the test.
@ptomato ptomato changed the title Enable ShadowRealm testing for ErrorEvent Enable ShadowRealm testing for ErrorEvent and queueMicrotask Nov 22, 2024
This test is similar to window-onerror-runtime-error-throw.html and
window-onerror-runtime-error.html, but ensuring that the ShadowRealm
global's onerror is triggered and not the Window's onerror.

By my reading of the spec, we cannot have a test equivalent to
window-onerror-parse-error.html in ShadowRealm because
ShadowRealm.prototype.evaluate() will exit early if the given code fails
to parse.

return promise;
}, "error event is weird (return true cancels; many args) on WorkerGlobalScope, with a runtime error");
}, "error event is weird (return true cancels; many args) on non-Window global scope, with a runtime error");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not certain whether ShadowRealmGlobalScope gets the same exceptional onerror signature as Window and WorkerGlobalScope. @Ms2ger do you have an opinion on this?

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.

4 participants