1 <p>This page tests for a crash when throwing an exception from a callback provided
2 to String.prototype.replace.
5 <p>If the test passes, you'll see a series of PASS messages below.
8 <pre id=
"console"></pre>
13 document
.getElementById("console").appendChild(document
.createTextNode(s
+ "\n"));
16 if (window
.testRunner
)
17 testRunner
.dumpAsText();
19 // these should not crash
23 "aa".replace(/a
/g
, function() {
29 log ("PASS: You didn't crash.");
34 "aa".replace("a", function() {
39 log ("PASS: You didn't crash.");
42 // this should not continue execution after an exception
44 var message
= "PASS: String.prototype.replace did not continue executing after an exception was thrown.";
48 "aa".replace(/a
/g
, function() {
50 message
= "FAIL: String.prototype.replace continued executing after an exception was thrown.";
58 (function x() { return 'blargh'.replace(/a
/g
, x
) })()