summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/dom/inline-event-attributes-crash.html
blob: e6199075b071cf93fcce2da7eb38cd1e709200d2 (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
<!DOCTYPE html>
<script src="../../resources/js-test.js"></script>
<script>

description('Tests that malformed code in event handler attributes does not cause a crash');

function dispatchClick(element)
{
    var clickEvent = document.createEvent('MouseEvent');
    clickEvent.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
    element.dispatchEvent(clickEvent);
}

// Ignore errors due to the syntax error in the attribute.
window.onerror = function() {
    return true;
};

var div = document.createElement('div');
div.setAttribute('onclick', 'return 42; }(); var x = {');
dispatchClick(div);

testPassed('Did not crash');

</script>