OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../js/resources/js-test-pre.js"></script> | 2 <script src="../js/resources/js-test-pre.js"></script> |
3 <script> | 3 <script> |
4 | 4 |
5 description('Tests that malformed code in event handler attributes does not caus
e a crash'); | 5 description('Tests that malformed code in event handler attributes does not caus
e a crash'); |
6 | 6 |
7 function dispatchClick(element) | 7 function dispatchClick(element) |
8 { | 8 { |
9 var clickEvent = document.createEvent('MouseEvent'); | 9 var clickEvent = document.createEvent('MouseEvent'); |
10 clickEvent.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false
, false, false, false, 0, null); | 10 clickEvent.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false
, false, false, false, 0, null); |
11 element.dispatchEvent(clickEvent); | 11 element.dispatchEvent(clickEvent); |
12 } | 12 } |
13 | 13 |
14 // Ignore errors due to the syntax error in the attribute. | 14 // Ignore errors due to the syntax error in the attribute. |
15 window.onerror = function() { | 15 window.onerror = function() { |
16 return true; | 16 return true; |
17 }; | 17 }; |
18 | 18 |
19 var div = document.createElement('div'); | 19 var div = document.createElement('div'); |
20 div.setAttribute('onclick', 'return 42; }(); var x = {'); | 20 div.setAttribute('onclick', 'return 42; }(); var x = {'); |
21 dispatchClick(div); | 21 dispatchClick(div); |
22 | 22 |
23 testPassed('Did not crash'); | 23 testPassed('Did not crash'); |
24 | 24 |
25 </script> | 25 </script> |
26 <script src="../js/resources/js-test-post.js"></script> | |
OLD | NEW |