Bug 1839315: part 4) Link from `SheetLoadData::mWasAlternate` to spec. r=emilio DONTBUILD
[gecko.git] / layout / style / test / test_visited_image_loading.html
blob09aae8e53ce13543096accf746828337495cdc42
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=557287
5 -->
6 <head>
7 <title>Test for Bug 557287</title>
8 <script src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
10 </head>
11 <body>
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=557287">Mozilla Bug 147777</a>
13 <pre id="test">
14 <script type="application/ecmascript" src="visited_image_loading.sjs?reset"></script>
15 <script type="application/javascript">
17 /** Test for Bug 557287 **/
19 SimpleTest.waitForExplicitFinish();
20 SimpleTest.requestFlakyTimeout("untriaged");
22 var subdoc, subwin;
24 window.addEventListener("load", run);
26 function run()
28 subwin = window.open("visited_image_loading_frame.html", "_blank");
29 subwin.addEventListener("load", function() {
30 subdoc = subwin.document;
31 setTimeout(check_link_styled, 50);
32 });
35 function visitedDependentComputedStyle(win, elem, property) {
36 return SpecialPowers.DOMWindowUtils
37 .getVisitedDependentComputedStyle(elem, "", property);
40 function check_link_styled()
42 var vislink = subdoc.getElementById("visited");
43 var bgcolor =
44 visitedDependentComputedStyle(subwin, vislink, "background-color");
45 if (bgcolor == "rgb(128, 0, 128)") {
46 // We've done our async :visited processing and restyled accordingly.
47 // Make sure that we've actually painted before finishing the test.
48 subwin.addEventListener("MozAfterPaint", paint_listener);
49 // do something that forces a paint
50 subdoc.body.appendChild(subdoc.createTextNode("new text node"));
51 } else {
52 setTimeout(check_link_styled, 50);
56 function paint_listener(event)
58 subwin.removeEventListener("MozAfterPaint", paint_listener);
59 var s = document.createElement("script");
60 s.src = "visited_image_loading.sjs?waitforresult";
61 document.body.appendChild(s);
62 subwin.close();
65 </script>
66 </pre>
67 </body>
68 </html>