summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/css/visited-link-hang.html
blob: 178d97db0162f279036ab72f50d7ac599c1b068c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<p>If this test runs without hanging, then it has passed. The visited link hash algorithm was N^2 at one point and would hang.</p>
<p id="test1"></p>
<p id="test2"></p>
<p id="test3"></p>
<p id="result">TEST DID NOT RUN YET</p>

<script>

if (window.testRunner)
    testRunner.dumpAsText();

var oneMillionSlashes = "";
for (i = 0; i < 1000000; ++i)
    oneMillionSlashes += "/";

var oneMillionSlashesAndDots = "";
for (i = 0; i < 333334; ++i)
    oneMillionSlashesAndDots += "/./";

var oneMillionSlashesAndDoubleDots = "";
for (i = 0; i < 250000; ++i)
    oneMillionSlashesAndDoubleDots += "/../";

document.getElementById("test1").innerHTML = '<a href="about:test?slashes' + oneMillionSlashes + '">Link with tons of slashes</a>';
document.getElementById("test2").innerHTML = '<a href="about:test?slashes' + oneMillionSlashesAndDots + '">Link with tons of slashes with dots</a>';
document.getElementById("test3").innerHTML = '<a href="about:test?slashes' + oneMillionSlashesAndDoubleDots + '">Link with tons of slashes with double dots</a>';

// GC these large strings so that they don't cause the next test to timeout.
if (window.GCController) {
    oneMillionSlashes = null;
    oneMillionSlashesAndDots = null;
    oneMillionSlashesAndDoubleDots = null;
    GCController.collect();
}

document.getElementById("result").firstChild.data = "TEST PASSED";
</script>