Sync web-platform-tests PR 19612 into mozilla-central (this bug is closed when the sync is complete).
[testharness.js] Don't complete after allowed exc.
The following tests intentionally produce an uncaught exception and then define
testharness.js immediately transitions to "complete" and ignores the
Today, the tests referenced in the commit message are reported as passing single-page tests. Once we've completed the implementation of WPT RFC 28, they will instead be reported as test harness errors.
As an alternative to this patch, we could modify each of the tests. If a subtest is defined before the exception is thrown, then all the subtests are reported as expected. (We could, for example, declare the existing synchronous subtests as asynchronous subtests instead.)
Changing the harness is definitely riskier, but it also seems more correct to me.
This change could interfere with single-page tests that use
allow_uncaught_exceptions. My experiments don't indicate that any such tests exist, but it's difficult to demonstrate or summarize that research here. A more blunt heuristic might do. Only three tests use
allow_uncaught_exception without invoking functions named
$ git grep -l allow_uncaught_exception | xargs grep -LE '\b(test|promise_test|async_test)\s*\('
All three define subtests indirectly through helper functions.