Skip to content

testharness.js: allow_uncaught_exception in Deno - #33657

Open
lucacasonato wants to merge 3 commits into
web-platform-tests:masterfrom
lucacasonato:prevent_default_error_event_allow_uncaught_exception
Open

lucacasonato wants to merge 3 commits into
web-platform-tests:masterfrom
lucacasonato:prevent_default_error_event_allow_uncaught_exception

Conversation

@lucacasonato

Copy link
Copy Markdown
Member

In Deno uncaught errors and unhandled rejections that are not
"preventDefault"'ed cause the runtime to exit with a non-0 status code.
Node has similar behaviour for unhandled rejections.

This commit adds support for these runtimes running tests that have
allow_uncaught_exception enabled by calling preventDefault on error
events when allow_uncaught_exception is enabled.

The primary motivator is that this would allow Deno to run reportError
tests.

In Deno uncaught errors and unhandled rejections  that are not
"preventDefault"'ed cause the runtime to exit with a non-0 status code.
Node has similar behaviour for unhandled rejections.

This commit adds support for these runtimes running tests that have
`allow_uncaught_exception` enabled by calling `preventDefault` on error
events when `allow_uncaught_exception` is enabled.
@jgraham

jgraham commented Apr 20, 2022

Copy link
Copy Markdown
Contributor

This seems reasonable to me. @zcorpan might also have an opinion.

Can you push to a trigger branch e.g. triggers/firefox_nightly and.or triggers/chrome_dev so we can get a full run and compare the results on wpt.fyi in case of unexpected side effects.

@lucacasonato

Copy link
Copy Markdown
Member Author

@jgraham jgraham left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I didn't see anything too worrying in the Firefox results; I trust that you've checked the others.

@lucacasonato

Copy link
Copy Markdown
Member Author

@zcorpan

zcorpan commented Apr 27, 2022

Copy link
Copy Markdown
Member

This looks ok to me, except for tests that test the observable differences as you found. You could add an opt out in setup() e.g.

setup({do_not_prevent_default_for_unhandled_exceptions: true});

Naming open for bikeshedding.

But such tests would still not be able to run in Deno as-is, unless you make the non-0 status code the expected result for those tests or add some opt in to allow unhandled exceptions in Deno.

@jgraham

jgraham commented May 3, 2022

Copy link
Copy Markdown
Contributor

Hmm, so at risk of being really bikesheddy, we are now using uncaught and unhandled in property names to mean roughly the same things. It's also a really long name. I wonder if it should be called preventDefault_uncaught_exception and default to true? But now this is adding API surface it feels like maybe it should have had an RFC.

@domenic

domenic commented May 3, 2022

Copy link
Copy Markdown
Member

Wouldn't the best fix here be for Deno to have some web-like mode where non-preventDefault()ed exceptions don't crash the process, and then use that when running these tests (or perhaps all web platform tests)?

@lucacasonato

Copy link
Copy Markdown
Member Author

@domenic Yeah that could work too. I'll look into that.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants