blob: deffb06ab513c9668677bd2d8ef2f111e8cb9c7e [file] [log] [blame]
antonm@chromium.org3b2e2042011-01-21 19:40:02 +00001<html>
2<head>
3<script>
4 function test() {
5 alert(
6 'This test verifies that exception thrown while converting an object to string '
7 + 'are correctly propagated and do not crash the browser.');
8
rniwa@webkit.orgada3c202012-06-20 03:28:42 +00009 if (window.testRunner) {
10 testRunner.dumpAsText();
antonm@chromium.org3b2e2042011-01-21 19:40:02 +000011 }
12
13 var throwing = { toString: function() { throw 'EXCEPTION'; } };
14 try {
15 document.images.item(throwing);
16 alert('FAIL: document.images.item(throwing) should have thrown an exception!');
17 } catch (e) {
18 alert('OK: ' + e);
19 }
20 try {
21 document.images[throwing];
22 alert('FAIL: document.images[throwing] should have thrown an exception!');
23 } catch (e) {
24 alert('OK: ' + e);
25 }
26 }
27</script>
28</head>
29<body onload='test()'>
30</body>
31</html>