Bug 1839316: part 5) Guard the "fetchpriority" attribute behind a pref. r=kershaw...
[gecko.git] / docshell / test / chrome / bug89419_window.xhtml
blob12b9dec65077ae06389e197051539862936c596c
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(runTests, 0);"
9 title="bug 89419 test">
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>
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.
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]]});
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 });
36 var first = await snapshotWindow(TestWindow.getWindow());
38 await new Promise(resolve => {
39 doPageNavigation({
40 uri: "about:blank",
41 onNavComplete: resolve,
42 });
43 });
45 var second = await snapshotWindow(TestWindow.getWindow());
46 function snapshotsEqual(snap1, snap2) {
47 return compareSnapshots(snap1, snap2, true)[0];
49 ok(!snapshotsEqual(first, second), "about:blank should not be the same as the image web page");
51 await new Promise(resolve => {
52 doPageNavigation({
53 back: true,
54 onNavComplete: resolve,
55 });
56 });
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");
62 // Tell the framework the test is finished.
63 finish();
66 ]]></script>
68 <browser type="content" primary="true" flex="1" id="content" src="about:blank"/>
69 </window>