bug582176_window.xhtml (2536B)
1 <?xml version="1.0"?> 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> 3 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"> 10 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. 16 // 17 async function runTest() 18 { 19 enableBFCache(true); 20 21 var notificationCount = 0; 22 23 let onGlobalCreation = () => { 24 ++notificationCount; 25 }; 26 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"); 38 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"); 48 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"); 57 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"); 67 68 // Tell the framework the test is finished. 69 finish(); 70 } 71 72 ]]></script> 73 <browser type="content" primary="true" flex="1" id="content" remote="true" maychangeremoteness="true" /> 74 </window>