summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/harness/expected-error-in-async-test.html
blob: 61987366316cc033f0d0ba6276104ecf392b5ff8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!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 errorThrower()
{
    setTimeout(errorExpecter, 0);
    debug("Throwing an expected error");
    throw new Error("An expected error");
}

function errorExpecter()
{
    shouldHaveHadError("expected error");
    finishJSTest();
}

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