|
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 = Components.classes["@mozilla.org/file/directory_service;1"] |
|
44 .getService(Components.interfaces.nsIProperties) |
|
45 .get("TmpD", Components.interfaces.nsILocalFile); |
|
46 file.append("294258_test.file"); |
|
47 file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666); |
|
48 filePath = file.path; |
|
49 $("file").value = filePath; |
|
50 $("textarea").value = "textarea value"; |
|
51 $("radio1").checked = true; |
|
52 $("select").selectedIndex = 2; |
|
53 doPageNavigation( { |
|
54 reload: true, |
|
55 onNavComplete: nextTest |
|
56 } ); |
|
57 yield undefined; |
|
58 |
|
59 // Verify that none of the form data has changed. |
|
60 is($("text").value, "text value", "Text value changed"); |
|
61 is($("checkbox").checked, true, "Checkbox value changed"); |
|
62 is($("file").value, filePath, "File value changed"); |
|
63 is($("textarea").value, "textarea value", "Textarea value changed"); |
|
64 is($("radio1").checked, true, "Radio value changed"); |
|
65 is($("select").selectedIndex, 2, "Select value changed"); |
|
66 |
|
67 // Tell the framework the test is finished. Include the final 'yield' |
|
68 // statement to prevent a StopIteration exception from being thrown. |
|
69 finish(); |
|
70 yield undefined; |
|
71 } |
|
72 |
|
73 ]]></script> |
|
74 |
|
75 <browser type="content-primary" flex="1" id="content" src="about:blank"/> |
|
76 </window> |