docshell/test/chrome/bug89419_window.xul

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <?xml version="1.0"?>
     2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     4 <window id="89419Test"
     5         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
     6         width="600"
     7         height="600"
     8         onload="setTimeout(nextTest,0);"
     9         title="bug 89419 test">
    11   <script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
    12   <script type="text/javascript"
    13           src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
    14   <script type="text/javascript"
    15           src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
    16   <script type="text/javascript"
    17           src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
    18   <script type="application/javascript" src="docshell_helpers.js" />
    19   <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
    21   <script type="application/javascript"><![CDATA[
    22     // Define the generator-iterator for the tests.
    23     var tests = testIterator();
    25     ////
    26     // Execute the next test in the generator function.
    27     //
    28     function nextTest() {
    29       tests.next();
    30     }
    32     ////
    33     // Generator function for test steps for bug 89419:
    34     // A visited link should have the :visited style applied
    35     // to it when displayed on a page which was fetched from
    36     // the bfcache.
    37     //
    38     function testIterator()
    39     {
    40       // Load a test page containing an image referring to the sjs that returns
    41       // a different redirect every time it's loaded.
    42       doPageNavigation({
    43         uri: getHttpUrl("89419.html"),
    44         onNavComplete: nextTest,
    45         preventBFCache: true
    46       });
    47       yield undefined;
    49       var first = snapshotWindow(TestWindow.getWindow());
    51       doPageNavigation({
    52         uri: "about:blank",
    53         onNavComplete: nextTest
    54       });
    55       yield undefined;
    57       var second = snapshotWindow(TestWindow.getWindow());
    58       function snapshotsEqual(snap1, snap2) {
    59         return compareSnapshots(snap1, snap2, true)[0];
    60       }
    61       ok(!snapshotsEqual(first, second), "about:blank should not be the same as the image web page");
    63       doPageNavigation({
    64         back: true,
    65         onNavComplete: nextTest
    66       });
    67       yield undefined;
    69       var third = snapshotWindow(TestWindow.getWindow());
    70       ok(!snapshotsEqual(third, second), "going back should not be the same as about:blank");
    71       ok(snapshotsEqual(first, third), "going back should be the same as the initial load");
    73       // Tell the framework the test is finished.  Include the final 'yield'
    74       // statement to prevent a StopIteration exception from being thrown.
    75       finish();
    76       yield undefined;
    77     }
    79   ]]></script>
    81   <browser type="content-primary" flex="1" id="content" src="about:blank"/>
    82 </window>

mercurial