chromium/third_party/blink/web_tests/fast/harness/error-in-async-test.html

<!DOCTYPE html>

<script src="../../resources/js-test.js"></script>
<script>
description('Test that the window.onerror handler in resources/js-test.js ' +
    'stops asynchronous tests');

function buggyAsyncCode()
{
    debug("Simulating an unexpected error");

    // If the onerror handler doesn't finish async tests, this test will
    // timeout, and the line below will not show.
    throw new Error("An unexpected error");
}

window.jsTestIsAsync = true;
debug("Will throw an error soon");
</script>
<body onload="setTimeout(buggyAsyncCode, 0)"></body>