Bug 1909074. Don't pass OFFSET_BY_ORIGIN to GetResultingTransformMatrix when it's...
[gecko.git] / layout / style / test / test_visited_pref.html
blob481a71bfef2fcce1d9bec3512d650e412843db99
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=147777
5 -->
6 <head>
7 <title>Test for visited link coloring pref Bug 147777</title>
8 <script src="/tests/SimpleTest/SimpleTest.js"></script>
9 <script src="/tests/SimpleTest/WindowSnapshot.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
11 <style type="text/css">
13 :link { float: left; }
15 :visited { float: right; }
17 </style>
18 </head>
19 <body>
20 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=147777">Mozilla Bug 147777</a>
21 <iframe id="iframe" src="visited-pref-iframe.html" style="width: 10em; height: 5em"></iframe>
22 <pre id="test">
23 <script type="application/javascript">
24 /** Test for Bug 147777 **/
26 function reinsert_node(e) {
27 var sib = e.nextSibling;
28 var par = e.parentNode;
29 par.removeChild(e);
30 par.insertBefore(e, sib);
33 function get_pref()
35 return SpecialPowers.getBoolPref("layout.css.visited_links_enabled");
38 function snapshotsEqual(snap1, snap2)
40 return compareSnapshots(snap1, snap2, true)[0];
43 SimpleTest.waitForExplicitFinish();
44 SimpleTest.requestFlakyTimeout("untriaged");
45 window.addEventListener("load", step1);
47 var iframe, subdoc, subwin;
48 var link;
49 var start;
50 var timeout;
52 var unvisref; // reference image for unvisited style
54 function step1()
56 is(get_pref(), true, "pref defaults to true");
58 iframe = document.getElementById("iframe");
59 subdoc = iframe.contentDocument;
60 subwin = iframe.contentWindow;
61 link = subdoc.getElementById("link");
63 unvisref = snapshotWindow(subwin, false);
65 // Now set the href of the link to a location that's actually visited.
66 link.href = top.location;
68 start = Date.now();
70 // And wait for the link to get restyled when the history lets us
71 // know it is (asynchronously).
72 setTimeout(poll_for_visited_style, 100);
75 function poll_for_visited_style()
77 var snapshot = snapshotWindow(subwin, false);
78 if (snapshotsEqual(unvisref, snapshot)) {
79 // hasn't been styled yet
80 setTimeout(poll_for_visited_style, 100);
82 // If it never gets styled correctly, this test will fail because
83 // this loop will never complete.
84 } else {
85 var end = Date.now();
86 timeout = 3 * Math.max(end - start, 300);
87 SpecialPowers.pushPrefEnv({"set":[["layout.css.visited_links_enabled", false]]}, step2);
91 function step2()
93 // we don't handle dynamic changes of this pref; it only takes effect
94 // when a new page loads
95 reinsert_node(link);
97 setTimeout(step3, timeout);
100 function step3()
102 var snapshot = snapshotWindow(subwin, false);
103 ok(snapshotsEqual(unvisref, snapshot),
104 ":visited selector does not apply given false preference");
106 SimpleTest.finish();
109 </script>
110 </pre>
111 </body>
112 </html>