blob: 29841d9ac1741c298da2a34ff3cb398d414f8926 [file] [log] [blame]
<!DOCTYPE html>
<meta charset="UTF-8">
<title>Throwing in event listener generates an error event on the window object</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test("Throwing in event listener generates an error event on the window object");
var errorEvent = false;
window.onerror = function(e) {
errorEvent = e;
}
document.addEventListener('DOMContentLoaded', t.step_func(function(){
var element = document.getElementById('bim');
element.addEventListener('click', function(){
throw new Error('Error from listener');
});
element.click();
assert_equals(typeof errorEvent, 'string');
t.done();
}));
</script>
<div id="bim">
</div>