antonm@chromium.org | 3b2e204 | 2011-01-21 19:40:02 +0000 | [diff] [blame] | 1 | <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.org | ada3c20 | 2012-06-20 03:28:42 +0000 | [diff] [blame] | 9 | if (window.testRunner) { |
| 10 | testRunner.dumpAsText(); |
antonm@chromium.org | 3b2e204 | 2011-01-21 19:40:02 +0000 | [diff] [blame] | 11 | } |
| 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> |