Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../js/resources/js-test-pre.js"></script> | |
| 5 <script> | |
| 6 description("Tests that an exception is thrown when the value returned in the be foreunload callback cannot be converted to a String"); | |
| 7 window.jsTestIsAsync = true; | |
| 8 | |
| 9 function test(frame) { | |
| 10 frame.contentWindow.onbeforeunload = function(event) { | |
| 11 return {toString: function() { throw "Exception in toString()"; }}; | |
| 12 }; | |
| 13 | |
| 14 frame.contentWindow.location.href = "resources/does-not-exist.html"; | |
| 15 setTimeout(finishJSTest, 0); | |
|
do-not-use
2013/09/11 15:13:33
I updated the test to use an iframe. This way, we
| |
| 16 } | |
| 17 | |
| 18 var testMessage; | |
| 19 window.onerror = function(msg) { | |
| 20 testMessage = msg; | |
| 21 testPassed("Exception was thrown"); | |
| 22 shouldBeEqualToString("testMessage", "Uncaught Exception in toString()"); | |
| 23 setTimeout(finishJSTest, 0); | |
| 24 return true; | |
| 25 }; | |
| 26 </script> | |
| 27 </head> | |
| 28 <body> | |
| 29 <iframe onload="test(this)" src="resources/onclick.html"></iframe> | |
| 30 <script src="../js/resources/js-test-post.js"></script> | |
| 31 </body> | |
| 32 </html> | |
| OLD | NEW |