docshell/test/chrome/bug89419_window.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial