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