| <p> |
| This test verifies that execution terminates after a not-a-constructor exception is thrown. In particular, |
| it verifies that the engine doesn't restart execution through a custom toString() function. |
| </p> |
| |
| <pre id="console"></pre> |
| |
| <script> |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| function log(s) |
| { |
| document.getElementById("console").appendChild(document.createTextNode(s + "\n")); |
| } |
| |
| try { |
| var o = { |
| toString: function() { log("FAIL: toString was called."); }, |
| valueOf: function() { log("FAIL: valueOf was called."); } |
| }; |
| |
| new o; |
| } catch(e) { } |
| |
| log("PASS: Test complete."); |
| </script> |