Bug 1839316: part 5) Guard the "fetchpriority" attribute behind a pref. r=kershaw...
[gecko.git] / docshell / test / chrome / bug582176_window.xhtml
blobb43220a2feee087b4657eab57f3bf36597611da0
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
4 <window id="303267Test"
5 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
6 width="600"
7 height="600"
8 onload="runTest();"
9 title="bug 582176 test">
11 <script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js" />
12 <script type="application/javascript" src="docshell_helpers.js" />
13 <script type="application/javascript"><![CDATA[
14 ////
15 // Bug 582176.
17 async function runTest()
19 enableBFCache(true);
21 var notificationCount = 0;
23 let onGlobalCreation = () => {
24 ++notificationCount;
27 await promisePageNavigation({
28 uri: "http://mochi.test:8888/chrome/docshell/test/chrome/582176_dummy.html",
29 onGlobalCreation,
30 });
31 is(await SpecialPowers.spawn(TestWindow.getBrowser(), [], () => {
32 let testVar = content.testVar;
33 content.testVar = 1;
34 return testVar;
35 }), undefined,
36 "variable unexpectedly there already");
37 is(notificationCount, 1, "Should notify on first navigation");
39 await promisePageNavigation({
40 uri: "http://mochi.test:8888/chrome/docshell/test/chrome/582176_dummy.html?2",
41 onGlobalCreation,
42 });
43 is(await SpecialPowers.spawn(TestWindow.getBrowser(), [], () => {
44 return content.testVar;
45 }), undefined,
46 "variable should no longer be there");
47 is(notificationCount, 2, "Should notify on second navigation");
49 await promisePageNavigation({
50 back: true,
51 });
52 is(await SpecialPowers.spawn(TestWindow.getBrowser(), [], () => {
53 return content.testVar;
54 }), 1,
55 "variable should still be there");
56 is(notificationCount, 2, "Should not notify on back navigation");
58 await promisePageNavigation({
59 uri: "http://mochi.test:8888/chrome/docshell/test/chrome/582176_xml.xml",
60 onGlobalCreation,
61 });
62 is(await SpecialPowers.spawn(TestWindow.getBrowser(), [], () => {
63 return content.document.body.textContent;
64 }), "xslt result",
65 "Transform performed successfully");
66 is(notificationCount, 3, "Should notify only once on XSLT navigation");
68 // Tell the framework the test is finished.
69 finish();
72 ]]></script>
73 <browser type="content" primary="true" flex="1" id="content" remote="true" maychangeremoteness="true" />
74 </window>