<rdar://problem/9251515> and https://bugs.webkit.org/show_bug.cgi?id=58072
[WebKit-https.git] / LayoutTests / fast / loader / stateobjects / state-url-sets-links-visited.html
1 <script>
2
3 if (window.layoutTestController) {
4     layoutTestController.keepWebHistory();
5     layoutTestController.dumpAsText();
6 }
7
8 function loaded()
9 {
10     window.history.replaceState(null, "Title", "replacedURL.html");
11     window.history.pushState(null, "Title", "pushedURL.html");
12
13     if (window.layoutTestController) {
14         var style1 = window.layoutTestController.computedStyleIncludingVisitedInfo(document.getElementById('link1'));
15         var style2 = window.layoutTestController.computedStyleIncludingVisitedInfo(document.getElementById('link2'));
16         var result = document.createElement("p");
17         if (style1.color != "rgb(255, 165, 0)" || style2.color != "rgb(255, 165, 0)")
18             result.innerText = "FAIL";
19         else
20             result.innerText = "PASS";
21         document.body.appendChild(result);
22     }
23 }
24
25 </script>
26
27 <style>
28 :link { color: rgb(0, 255, 0); background-color: white }
29 :visited { color: rgb(255, 165, 0); background-color: black }
30 </style>
31
32 <body onload="loaded();">
33 <a id="link1" href="replacedURL.html">This link should get colored visited as a result of replaceState() setting it as the current URL</a><br>
34 <a id="link2" href="pushedURL.html">This link should get colored visited as a result of pushState() adding it to the forward list</a><br>
35 If you're running in a browser, the link should be orange-on-black and you should see "replacedURL.html" in your global history.<br>
36 If you're running in DRT, the test will also append "PASS" or "FAIL".<br>
37 </body>