docshell/test/chrome/bug294258_window.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
michael@0 3
michael@0 4 <window id="294258Test"
michael@0 5 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 6 width="600"
michael@0 7 height="600"
michael@0 8 onload="setTimeout(nextTest,0);"
michael@0 9 title="bug 294258 test">
michael@0 10
michael@0 11 <script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
michael@0 12 <script type="application/javascript" src="docshell_helpers.js" />
michael@0 13 <script type="application/javascript"><![CDATA[
michael@0 14
michael@0 15 // Define the generator-iterator for the tests.
michael@0 16 var tests = testIterator();
michael@0 17
michael@0 18 ////
michael@0 19 // Execute the next test in the generator function.
michael@0 20 //
michael@0 21 function nextTest() {
michael@0 22 tests.next();
michael@0 23 }
michael@0 24
michael@0 25 function $(id) { return TestWindow.getDocument().getElementById(id); }
michael@0 26
michael@0 27 ////
michael@0 28 // Generator function for test steps for bug 294258:
michael@0 29 // Form values should be preserved on reload.
michael@0 30 //
michael@0 31 function testIterator()
michael@0 32 {
michael@0 33 // Load a page containing a form.
michael@0 34 doPageNavigation( {
michael@0 35 uri: getHttpUrl("bug294258_testcase.html"),
michael@0 36 onNavComplete: nextTest
michael@0 37 } );
michael@0 38 yield undefined;
michael@0 39
michael@0 40 // Change the data for each of the form fields, and reload.
michael@0 41 $("text").value = "text value";
michael@0 42 $("checkbox").checked = true;
michael@0 43 var file = Components.classes["@mozilla.org/file/directory_service;1"]
michael@0 44 .getService(Components.interfaces.nsIProperties)
michael@0 45 .get("TmpD", Components.interfaces.nsILocalFile);
michael@0 46 file.append("294258_test.file");
michael@0 47 file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
michael@0 48 filePath = file.path;
michael@0 49 $("file").value = filePath;
michael@0 50 $("textarea").value = "textarea value";
michael@0 51 $("radio1").checked = true;
michael@0 52 $("select").selectedIndex = 2;
michael@0 53 doPageNavigation( {
michael@0 54 reload: true,
michael@0 55 onNavComplete: nextTest
michael@0 56 } );
michael@0 57 yield undefined;
michael@0 58
michael@0 59 // Verify that none of the form data has changed.
michael@0 60 is($("text").value, "text value", "Text value changed");
michael@0 61 is($("checkbox").checked, true, "Checkbox value changed");
michael@0 62 is($("file").value, filePath, "File value changed");
michael@0 63 is($("textarea").value, "textarea value", "Textarea value changed");
michael@0 64 is($("radio1").checked, true, "Radio value changed");
michael@0 65 is($("select").selectedIndex, 2, "Select value changed");
michael@0 66
michael@0 67 // Tell the framework the test is finished. Include the final 'yield'
michael@0 68 // statement to prevent a StopIteration exception from being thrown.
michael@0 69 finish();
michael@0 70 yield undefined;
michael@0 71 }
michael@0 72
michael@0 73 ]]></script>
michael@0 74
michael@0 75 <browser type="content-primary" flex="1" id="content" src="about:blank"/>
michael@0 76 </window>

mercurial