2 <?xml-stylesheet href=
"chrome://global/skin" type=
"text/css"?>
4 <window id=
"294258Test"
5 xmlns=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
8 onload=
"setTimeout(nextTest, 0);"
9 title=
"bug 294258 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[
15 // Define the generator-iterator for the tests.
16 var tests = testIterator();
19 // Execute the next test in the generator function.
25 function $(id) { return TestWindow.getDocument().getElementById(id); }
28 // Generator function for test steps for bug
294258:
29 // Form values should be preserved on reload.
31 function* testIterator()
33 // Load a page containing a form.
35 uri: getHttpUrl(
"bug294258_testcase.html"),
36 onNavComplete: nextTest
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;
53 onNavComplete: nextTest
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");
65 // Tell the framework the test is finished.
71 <browser type=
"content" primary=
"true" flex=
"1" id=
"content" src=
"about:blank"/>