|
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 type="application/javascript" 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 <iframe id="display" src="visited_image_loading_frame.html"></iframe> |
|
14 <pre id="test"> |
|
15 <script type="application/ecmascript" src="visited_image_loading.sjs?reset"></script> |
|
16 <script type="application/javascript"> |
|
17 |
|
18 /** Test for Bug 557287 **/ |
|
19 |
|
20 SimpleTest.waitForExplicitFinish(); |
|
21 |
|
22 var subdoc, subwin; |
|
23 |
|
24 window.addEventListener("load", run, false); |
|
25 |
|
26 function run() |
|
27 { |
|
28 var frame = document.getElementById("display"); |
|
29 subdoc = frame.contentDocument; |
|
30 subwin = frame.contentWindow; |
|
31 setTimeout(check_link_styled, 50); |
|
32 } |
|
33 |
|
34 function visitedDependentComputedStyle(win, elem, property) { |
|
35 return SpecialPowers.DOMWindowUtils |
|
36 .getVisitedDependentComputedStyle(elem, "", property); |
|
37 } |
|
38 |
|
39 function check_link_styled() |
|
40 { |
|
41 var vislink = subdoc.getElementById("visited"); |
|
42 var bgcolor = |
|
43 visitedDependentComputedStyle(subwin, vislink, "background-color"); |
|
44 if (bgcolor == "rgb(128, 0, 128)") { |
|
45 // We've done our async :visited processing and restyled accordingly. |
|
46 // Make sure that we've actually painted before finishing the test. |
|
47 subwin.addEventListener("MozAfterPaint", paint_listener, false); |
|
48 // do something that forces a paint |
|
49 subdoc.body.appendChild(subdoc.createTextNode("new text node")); |
|
50 } else { |
|
51 setTimeout(check_link_styled, 50); |
|
52 } |
|
53 } |
|
54 |
|
55 function paint_listener(event) |
|
56 { |
|
57 subwin.removeEventListener("MozAfterPaint", paint_listener, false); |
|
58 var s = document.createElement("script"); |
|
59 s.src = "visited_image_loading.sjs?waitforresult"; |
|
60 document.body.appendChild(s); |
|
61 } |
|
62 |
|
63 </script> |
|
64 </pre> |
|
65 </body> |
|
66 </html> |