bug92598_window.xhtml (3077B)
1 <?xml version="1.0"?> 2 3 <!-- This Source Code Form is subject to the terms of the Mozilla Public 4 - License, v. 2.0. If a copy of the MPL was not distributed with this 5 - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> 6 7 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> 8 9 <window id="92598Test" 10 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 11 width="600" 12 height="600" 13 onload="onLoad();" 14 title="92598 test"> 15 16 <script src="chrome://mochikit/content/chrome-harness.js" /> 17 <script type="application/javascript" src="docshell_helpers.js" /> 18 <script type="application/javascript"><![CDATA[ 19 var gBrowser; 20 var gTestsIterator; 21 22 function onLoad() { 23 gBrowser = document.getElementById("content"); 24 gTestsIterator = testsIterator(); 25 nextTest(); 26 } 27 28 function nextTest() { 29 gTestsIterator.next(); 30 } 31 32 function* testsIterator() { 33 // Load a page with a no-cache header, followed by a simple page 34 // On pagehide, first page should report it is not being persisted 35 var test1DocURI = "http://mochi.test:8888/chrome/docshell/test/chrome/92598_nostore.html"; 36 37 doPageNavigation({ 38 uri: test1DocURI, 39 eventsToListenFor: ["load", "pageshow"], 40 expectedEvents: [ { type: "load", 41 title: "test1" }, 42 { type: "pageshow", 43 title: "test1", 44 persisted: false } ], 45 onNavComplete: nextTest 46 }); 47 yield undefined; 48 49 var test2Doc = "data:text/html,<html><head><title>test2</title></head>" + 50 "<body>test2</body></html>"; 51 52 doPageNavigation({ 53 uri: test2Doc, 54 eventsToListenFor: ["load", "pageshow", "pagehide"], 55 expectedEvents: [ { type: "pagehide", 56 title: "test1", 57 persisted: false }, 58 { type: "load", 59 title: "test2" }, 60 { type: "pageshow", 61 title: "test2", 62 persisted: false } ], 63 onNavComplete: nextTest 64 }); 65 yield undefined; 66 67 // Now go back in history. First page should not have been cached. 68 // Check persisted property to confirm 69 doPageNavigation({ 70 back: true, 71 eventsToListenFor: ["load", "pageshow", "pagehide"], 72 expectedEvents: [ { type: "pagehide", 73 title: "test2", 74 persisted: true }, 75 { type: "load", 76 title: "test1" }, 77 { type: "pageshow", 78 title: "test1", 79 persisted: false } ], 80 onNavComplete: nextTest 81 }); 82 yield undefined; 83 84 finish(); 85 } 86 ]]></script> 87 88 <browser type="content" primary="true" flex="1" id="content" remote="true" maychangeremoteness="true" /> 89 </window>