| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../fast/js/resources/js-test-pre.js"></script> | 2 <script src="../fast/js/resources/js-test-pre.js"></script> |
| 3 <script> | 3 <script> |
| 4 description( | 4 description( |
| 5 'This tests that string replacement with a large replacement string causes an ou
t-of-memory exception. See <a href="https://bugs.webkit.org/show_bug.cgi?id=1029
56">bug 102956</a> for more details.' | 5 'This tests that string replacement with a large replacement string causes an ou
t-of-memory exception. See <a href="https://bugs.webkit.org/show_bug.cgi?id=1029
56">bug 102956</a> for more details.' |
| 6 ); | 6 ); |
| 7 | 7 |
| 8 function createStringWithRepeatedChar(c, multiplicity) { | 8 function createStringWithRepeatedChar(c, multiplicity) { |
| 9 while (c.length < multiplicity) | 9 while (c.length < multiplicity) |
| 10 c += c; | 10 c += c; |
| 11 c = c.substring(0, multiplicity); | 11 c = c.substring(0, multiplicity); |
| 12 return c; | 12 return c; |
| 13 } | 13 } |
| 14 | 14 |
| 15 var x = "1"; | 15 var x = "1"; |
| 16 var y = "2"; | 16 var y = "2"; |
| 17 x = createStringWithRepeatedChar(x, 1 << 12); | 17 x = createStringWithRepeatedChar(x, 1 << 12); |
| 18 y = createStringWithRepeatedChar(y, (1 << 20) + 1); | 18 y = createStringWithRepeatedChar(y, (1 << 20) + 1); |
| 19 | 19 |
| 20 shouldThrow("x.replace(/\\d/g, y)", '"Error: Out of memory"'); | 20 shouldThrow("x.replace(/\\d/g, y)", '"Error: Out of memory"'); |
| 21 var successfullyParsed = true; | 21 var successfullyParsed = true; |
| 22 </script> | 22 </script> |
| 23 <script src="../fast/js/resources/js-test-post.js"></script> | |
| OLD | NEW |