docshell/test/chrome/bug89419_window.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/docshell/test/chrome/bug89419_window.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,82 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     1.6 +
     1.7 +<window id="89419Test"
     1.8 +        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
     1.9 +        width="600"
    1.10 +        height="600"
    1.11 +        onload="setTimeout(nextTest,0);"
    1.12 +        title="bug 89419 test">
    1.13 +
    1.14 +  <script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
    1.15 +  <script type="text/javascript"
    1.16 +          src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
    1.17 +  <script type="text/javascript"
    1.18 +          src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
    1.19 +  <script type="text/javascript"
    1.20 +          src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
    1.21 +  <script type="application/javascript" src="docshell_helpers.js" />
    1.22 +  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
    1.23 +
    1.24 +  <script type="application/javascript"><![CDATA[
    1.25 +    // Define the generator-iterator for the tests.
    1.26 +    var tests = testIterator();
    1.27 +
    1.28 +    ////
    1.29 +    // Execute the next test in the generator function.
    1.30 +    //
    1.31 +    function nextTest() {
    1.32 +      tests.next();
    1.33 +    }
    1.34 +
    1.35 +    ////
    1.36 +    // Generator function for test steps for bug 89419:
    1.37 +    // A visited link should have the :visited style applied
    1.38 +    // to it when displayed on a page which was fetched from
    1.39 +    // the bfcache.
    1.40 +    //
    1.41 +    function testIterator()
    1.42 +    {
    1.43 +      // Load a test page containing an image referring to the sjs that returns
    1.44 +      // a different redirect every time it's loaded.
    1.45 +      doPageNavigation({
    1.46 +        uri: getHttpUrl("89419.html"),
    1.47 +        onNavComplete: nextTest,
    1.48 +        preventBFCache: true
    1.49 +      });
    1.50 +      yield undefined;
    1.51 +
    1.52 +      var first = snapshotWindow(TestWindow.getWindow());
    1.53 +
    1.54 +      doPageNavigation({
    1.55 +        uri: "about:blank",
    1.56 +        onNavComplete: nextTest
    1.57 +      });
    1.58 +      yield undefined;
    1.59 +
    1.60 +      var second = snapshotWindow(TestWindow.getWindow());
    1.61 +      function snapshotsEqual(snap1, snap2) {
    1.62 +        return compareSnapshots(snap1, snap2, true)[0];
    1.63 +      }
    1.64 +      ok(!snapshotsEqual(first, second), "about:blank should not be the same as the image web page");
    1.65 +
    1.66 +      doPageNavigation({
    1.67 +        back: true,
    1.68 +        onNavComplete: nextTest
    1.69 +      });
    1.70 +      yield undefined;
    1.71 +
    1.72 +      var third = snapshotWindow(TestWindow.getWindow());
    1.73 +      ok(!snapshotsEqual(third, second), "going back should not be the same as about:blank");
    1.74 +      ok(snapshotsEqual(first, third), "going back should be the same as the initial load");
    1.75 +
    1.76 +      // Tell the framework the test is finished.  Include the final 'yield'
    1.77 +      // statement to prevent a StopIteration exception from being thrown.
    1.78 +      finish();
    1.79 +      yield undefined;
    1.80 +    }
    1.81 +
    1.82 +  ]]></script>
    1.83 +
    1.84 +  <browser type="content-primary" flex="1" id="content" src="about:blank"/>
    1.85 +</window>

mercurial