bug89419_window.xhtml (2389B)
1 <?xml version="1.0"?> 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> 3 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(runTests, 0);" 9 title="bug 89419 test"> 10 11 <script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" /> 12 <script type="application/javascript" src="docshell_helpers.js" /> 13 <script src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script> 14 15 <script type="application/javascript"><![CDATA[ 16 //// 17 // A visited link should have the :visited style applied 18 // to it when displayed on a page which was fetched from 19 // the bfcache. 20 // 21 async function runTests() { 22 // Disable rcwn to make cache behavior deterministic. 23 var {SpecialPowers} = window.arguments[0]; 24 await SpecialPowers.pushPrefEnv({"set":[["network.http.rcwn.enabled", false]]}); 25 26 // Load a test page containing an image referring to the sjs that returns 27 // a different redirect every time it's loaded. 28 await new Promise(resolve => { 29 doPageNavigation({ 30 uri: getHttpUrl("89419.html"), 31 onNavComplete: resolve, 32 preventBFCache: true, 33 }); 34 }) 35 36 var first = await snapshotWindow(TestWindow.getWindow()); 37 38 await new Promise(resolve => { 39 doPageNavigation({ 40 uri: "about:blank", 41 onNavComplete: resolve, 42 }); 43 }); 44 45 var second = await snapshotWindow(TestWindow.getWindow()); 46 function snapshotsEqual(snap1, snap2) { 47 return compareSnapshots(snap1, snap2, true)[0]; 48 } 49 ok(!snapshotsEqual(first, second), "about:blank should not be the same as the image web page"); 50 51 await new Promise(resolve => { 52 doPageNavigation({ 53 back: true, 54 onNavComplete: resolve, 55 }); 56 }); 57 58 var third = await snapshotWindow(TestWindow.getWindow()); 59 ok(!snapshotsEqual(third, second), "going back should not be the same as about:blank"); 60 ok(snapshotsEqual(first, third), "going back should be the same as the initial load"); 61 62 // Tell the framework the test is finished. 63 finish(); 64 } 65 66 ]]></script> 67 68 <browser type="content" primary="true" flex="1" id="content" src="about:blank"/> 69 </window>