web-platform-tests / wpt

Test suites for Web platform specs — including WHATWG, W3C, and others
https://web-platform-tests.org/
Other
5.02k stars 3.12k forks source link

Enable ShadowRealm testing for ErrorEvent and queueMicrotask #49325

Open ptomato opened 13 hours ago

ptomato commented 13 hours ago

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.)