Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=557287 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 557287</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 10 | </head> |
michael@0 | 11 | <body> |
michael@0 | 12 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=557287">Mozilla Bug 147777</a> |
michael@0 | 13 | <iframe id="display" src="visited_image_loading_frame.html"></iframe> |
michael@0 | 14 | <pre id="test"> |
michael@0 | 15 | <script type="application/ecmascript" src="visited_image_loading.sjs?reset"></script> |
michael@0 | 16 | <script type="application/javascript"> |
michael@0 | 17 | |
michael@0 | 18 | /** Test for Bug 557287 **/ |
michael@0 | 19 | |
michael@0 | 20 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 21 | |
michael@0 | 22 | var subdoc, subwin; |
michael@0 | 23 | |
michael@0 | 24 | window.addEventListener("load", run, false); |
michael@0 | 25 | |
michael@0 | 26 | function run() |
michael@0 | 27 | { |
michael@0 | 28 | var frame = document.getElementById("display"); |
michael@0 | 29 | subdoc = frame.contentDocument; |
michael@0 | 30 | subwin = frame.contentWindow; |
michael@0 | 31 | setTimeout(check_link_styled, 50); |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | function visitedDependentComputedStyle(win, elem, property) { |
michael@0 | 35 | return SpecialPowers.DOMWindowUtils |
michael@0 | 36 | .getVisitedDependentComputedStyle(elem, "", property); |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | function check_link_styled() |
michael@0 | 40 | { |
michael@0 | 41 | var vislink = subdoc.getElementById("visited"); |
michael@0 | 42 | var bgcolor = |
michael@0 | 43 | visitedDependentComputedStyle(subwin, vislink, "background-color"); |
michael@0 | 44 | if (bgcolor == "rgb(128, 0, 128)") { |
michael@0 | 45 | // We've done our async :visited processing and restyled accordingly. |
michael@0 | 46 | // Make sure that we've actually painted before finishing the test. |
michael@0 | 47 | subwin.addEventListener("MozAfterPaint", paint_listener, false); |
michael@0 | 48 | // do something that forces a paint |
michael@0 | 49 | subdoc.body.appendChild(subdoc.createTextNode("new text node")); |
michael@0 | 50 | } else { |
michael@0 | 51 | setTimeout(check_link_styled, 50); |
michael@0 | 52 | } |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | function paint_listener(event) |
michael@0 | 56 | { |
michael@0 | 57 | subwin.removeEventListener("MozAfterPaint", paint_listener, false); |
michael@0 | 58 | var s = document.createElement("script"); |
michael@0 | 59 | s.src = "visited_image_loading.sjs?waitforresult"; |
michael@0 | 60 | document.body.appendChild(s); |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | </script> |
michael@0 | 64 | </pre> |
michael@0 | 65 | </body> |
michael@0 | 66 | </html> |