1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/test/test_bug345339.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,73 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=345339 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 345339</title> 1.11 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.13 +</head> 1.14 +<body> 1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=345339">Mozilla Bug 345339</a> 1.16 +<p id="display"></p> 1.17 +<div id="content" style="display: none"> 1.18 +</div> 1.19 + <iframe id="testframe" 1.20 + src="http://mochi.test:8888/tests/content/base/test/345339_iframe.html"> 1.21 + </iframe> 1.22 +<pre id="test"> 1.23 +<script class="testbody" type="text/javascript"> 1.24 +/** Test for Bug 345339 **/ 1.25 +SimpleTest.waitForExplicitFinish(); 1.26 + 1.27 +var filePath; 1.28 + 1.29 +function afterLoad() { 1.30 + var iframeDoc = $("testframe").contentDocument; 1.31 + 1.32 + /* change all the form controls */ 1.33 + iframeDoc.getElementById("select").selectedIndex = 1; 1.34 + iframeDoc.getElementById("radio2").checked = true; 1.35 + iframeDoc.getElementById("password").value = "123456"; 1.36 + iframeDoc.getElementById("hidden").value = "gecko"; 1.37 + 1.38 + var file = SpecialPowers.Cc["@mozilla.org/file/directory_service;1"] 1.39 + .getService(SpecialPowers.Ci.nsIProperties) 1.40 + .get("TmpD", SpecialPowers.Ci.nsILocalFile); 1.41 + file.append("345339_test.file"); 1.42 + file.createUnique(SpecialPowers.Ci.nsIFile.NORMAL_FILE_TYPE, 0666); 1.43 + filePath = file.path; 1.44 + 1.45 + SpecialPowers.wrap(iframeDoc).getElementById("file").value = filePath; 1.46 + 1.47 + /* Reload the page */ 1.48 + $("testframe").setAttribute("onload", "afterReload()"); 1.49 + iframeDoc.location.reload(); 1.50 +} 1.51 + 1.52 +addLoadEvent(afterLoad); 1.53 + 1.54 +function afterReload() { 1.55 + var iframeDoc = $("testframe").contentDocument; 1.56 + 1.57 + is(iframeDoc.getElementById("select").selectedIndex, 1, 1.58 + "select element selected index preserved"); 1.59 + is(iframeDoc.getElementById("radio1").checked, false, 1.60 + "radio button #1 value preserved"); 1.61 + is(iframeDoc.getElementById("radio2").checked, true, 1.62 + "radio button #2 value preserved"); 1.63 + isnot(iframeDoc.getElementById("password").value, "123456", 1.64 + "password field value forgotten"); 1.65 + is(iframeDoc.getElementById("hidden").value, "gecko", 1.66 + "hidden field value preserved"); 1.67 + is(SpecialPowers.wrap(iframeDoc).getElementById("file").value, filePath, 1.68 + "file field value preserved"); 1.69 + 1.70 + SimpleTest.finish(); 1.71 +} 1.72 +</script> 1.73 +</pre> 1.74 +</body> 1.75 +</html> 1.76 +