layout/style/test/test_visited_image_loading_empty.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/style/test/test_visited_image_loading_empty.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,66 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=557287
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 557287</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.13 +</head>
    1.14 +<body>
    1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=557287">Mozilla Bug 147777</a>
    1.16 +<iframe id="display" src="visited_image_loading_frame_empty.html"></iframe>
    1.17 +<pre id="test">
    1.18 +<script type="application/ecmascript" src="visited_image_loading.sjs?reset"></script>
    1.19 +<script type="application/javascript">
    1.20 +
    1.21 +/** Test for Bug 557287 **/
    1.22 +
    1.23 +SimpleTest.waitForExplicitFinish();
    1.24 +
    1.25 +var subdoc, subwin;
    1.26 +
    1.27 +window.addEventListener("load", run, false);
    1.28 +
    1.29 +function run()
    1.30 +{
    1.31 +  var frame = document.getElementById("display");
    1.32 +  subdoc = frame.contentDocument;
    1.33 +  subwin = frame.contentWindow;
    1.34 +  setTimeout(check_link_styled, 50);
    1.35 +}
    1.36 +
    1.37 +function visitedDependentComputedStyle(win, elem, property) {
    1.38 +  return SpecialPowers.DOMWindowUtils
    1.39 +           .getVisitedDependentComputedStyle(elem, "", property);
    1.40 +}
    1.41 +
    1.42 +function check_link_styled()
    1.43 +{
    1.44 +  var vislink = subdoc.getElementById("visited");
    1.45 +  var bgcolor =
    1.46 +    visitedDependentComputedStyle(subwin, vislink, "background-color");
    1.47 +  if (bgcolor == "rgb(128, 0, 128)") {
    1.48 +    // We've done our async :visited processing and restyled accordingly.
    1.49 +    // Make sure that we've actually painted before finishing the test.
    1.50 +    subwin.addEventListener("MozAfterPaint", paint_listener, false);
    1.51 +    // do something that forces a paint
    1.52 +    subdoc.body.appendChild(subdoc.createTextNode("new text node"));
    1.53 +  } else {
    1.54 +    setTimeout(check_link_styled, 50);
    1.55 +  }
    1.56 +}
    1.57 +
    1.58 +function paint_listener(event)
    1.59 +{
    1.60 +  subwin.removeEventListener("MozAfterPaint", paint_listener, false);
    1.61 +  var s = document.createElement("script");
    1.62 +  s.src = "visited_image_loading.sjs?waitforresult";
    1.63 +  document.body.appendChild(s);
    1.64 +}
    1.65 +
    1.66 +</script>
    1.67 +</pre>
    1.68 +</body>
    1.69 +</html>

mercurial