blob: 20a48cd8dbbfe172192becca0cc91e7e73971ade [file] [log] [blame]
arv@chromium.orgd4d173a2012-03-16 19:23:14 +00001<!DOCTYPE html>
mark.lam@apple.comb130a342013-09-07 22:48:36 +00002<script src="../../resources/js-test-pre.js"></script>
arv@chromium.orgd4d173a2012-03-16 19:23:14 +00003<script>
4
5description('Tests that malformed code in event handler attributes does not cause a crash');
6
7function dispatchClick(element)
8{
9 var clickEvent = document.createEvent('MouseEvent');
10 clickEvent.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
11 element.dispatchEvent(clickEvent);
12}
13
arv@chromium.org7d77f6d2012-03-16 20:27:30 +000014// Ignore errors due to the syntax error in the attribute.
15window.onerror = function() {
16 return true;
17};
18
arv@chromium.orgd4d173a2012-03-16 19:23:14 +000019var div = document.createElement('div');
20div.setAttribute('onclick', 'return 42; }(); var x = {');
21dispatchClick(div);
22
arv@chromium.org7d77f6d2012-03-16 20:27:30 +000023testPassed('Did not crash');
24
arv@chromium.orgd4d173a2012-03-16 19:23:14 +000025</script>
mark.lam@apple.comb130a342013-09-07 22:48:36 +000026<script src="../../resources/js-test-post.js"></script>