| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
| 5 <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"); | 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; | 7 window.jsTestIsAsync = true; |
| 8 | 8 |
| 9 var alreadyTested = false; | 9 var alreadyTested = false; |
| 10 function test(frame) { | 10 function test(frame) { |
| 11 if (alreadyTested) | 11 if (alreadyTested) |
| 12 return; | 12 return; |
| 13 alreadyTested = true; | 13 alreadyTested = true; |
| 14 | 14 |
| 15 frame.contentWindow.onbeforeunload = function(event) { | 15 frame.contentWindow.onbeforeunload = function(event) { |
| 16 return {toString: function() { throw "Exception in toString()"; }}; | 16 return {toString: function() { throw "Exception in toString()"; }}; |
| 17 }; | 17 }; |
| 18 | 18 |
| 19 frame.contentWindow.location.href = "resources/does-not-exist.html"; | 19 frame.contentWindow.location.href = "resources/does-not-exist.html"; |
| 20 setTimeout(finishJSTest, 0); | 20 setTimeout(finishJSTest, 0); |
| 21 } | 21 } |
| 22 | 22 |
| 23 var testMessage; | 23 var testMessage; |
| 24 window.onerror = function(msg) { | 24 window.onerror = function(msg) { |
| 25 testMessage = msg; | 25 testMessage = msg; |
| 26 // FIXME: This test fails. See crbug.com/446147. |
| 26 testPassed("Exception was thrown"); | 27 testPassed("Exception was thrown"); |
| 27 shouldBeEqualToString("testMessage", "Uncaught Exception in toString()"); | 28 shouldBeEqualToString("testMessage", "Uncaught Exception in toString()"); |
| 28 return true; | 29 return true; |
| 29 }; | 30 }; |
| 30 </script> | 31 </script> |
| 31 </head> | 32 </head> |
| 32 <body> | 33 <body> |
| 33 <iframe onload="test(this)" src="resources/onclick.html"></iframe> | 34 <iframe onload="test(this)" src="resources/onclick.html"></iframe> |
| 34 </body> | 35 </body> |
| 35 </html> | 36 </html> |
| OLD | NEW |