bug294258_window.xhtml (2395B)
1 <?xml version="1.0"?> 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> 3 4 <window id="294258Test" 5 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 6 width="600" 7 height="600" 8 onload="setTimeout(nextTest, 0);" 9 title="bug 294258 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 // Define the generator-iterator for the tests. 16 var tests = testIterator(); 17 18 //// 19 // Execute the next test in the generator function. 20 // 21 function nextTest() { 22 tests.next(); 23 } 24 25 function $(id) { return TestWindow.getDocument().getElementById(id); } 26 27 //// 28 // Generator function for test steps for bug 294258: 29 // Form values should be preserved on reload. 30 // 31 function* testIterator() 32 { 33 // Load a page containing a form. 34 doPageNavigation( { 35 uri: getHttpUrl("bug294258_testcase.html"), 36 onNavComplete: nextTest 37 } ); 38 yield undefined; 39 40 // Change the data for each of the form fields, and reload. 41 $("text").value = "text value"; 42 $("checkbox").checked = true; 43 var file = SpecialPowers.Services.dirsvc.get("TmpD", Ci.nsIFile); 44 file.append("294258_test.file"); 45 file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o666); 46 let filePath = file.path; 47 $("file").value = filePath; 48 $("textarea").value = "textarea value"; 49 $("radio1").checked = true; 50 $("select").selectedIndex = 2; 51 doPageNavigation( { 52 reload: true, 53 onNavComplete: nextTest 54 } ); 55 yield undefined; 56 57 // Verify that none of the form data has changed. 58 is($("text").value, "text value", "Text value changed"); 59 is($("checkbox").checked, true, "Checkbox value changed"); 60 is($("file").value, filePath, "File value changed"); 61 is($("textarea").value, "textarea value", "Textarea value changed"); 62 is($("radio1").checked, true, "Radio value changed"); 63 is($("select").selectedIndex, 2, "Select value changed"); 64 65 // Tell the framework the test is finished. 66 finish(); 67 } 68 69 ]]></script> 70 71 <browser type="content" primary="true" flex="1" id="content" src="about:blank"/> 72 </window>