Bug 441930 – Page refresh of textarea disabled via Javascript fails to display content. r=bz

This commit is contained in:
Ben Newman 2008-08-14 12:06:40 +02:00
Родитель f20fab3c6c
Коммит 6ce63e6655
4 изменённых файлов: 62 добавлений и 2 удалений

Просмотреть файл

@ -947,8 +947,9 @@ nsHTMLTextAreaElement::RestoreState(nsPresState* aState)
nsAutoString value;
nsresult rv =
aState->GetStateProperty(NS_LITERAL_STRING("value"), value);
NS_ASSERTION(NS_SUCCEEDED(rv), "value restore failed!");
SetValue(value);
if (rv == NS_STATE_PROPERTY_EXISTS) {
SetValue(value);
}
nsAutoString disabled;
rv = aState->GetStateProperty(NS_LITERAL_STRING("disabled"), disabled);

Просмотреть файл

@ -118,6 +118,8 @@ _TEST_FILES = test_bug589.html \
test_bug428135.xhtml \
test_bug430351.html \
test_bug430392.html \
bug441930_iframe.html \
test_bug441930.html \
$(NULL)
libs:: $(_TEST_FILES)

Просмотреть файл

@ -0,0 +1,27 @@
<html>
<body>
The content of this <code>textarea</code> should not disappear on page reload:<br />
<textarea>This text should not disappear on page reload!</textarea>
<script>
var ta = document.getElementsByTagName("textarea").item(0);
if (!parent.reloaded) {
parent.reloaded = true;
ta.disabled = true;
location.reload();
} else {
// Primary regression test:
parent.isnot(ta.value, "",
"Content of dynamically disabled textarea disappeared on page reload.");
// Bonus regression test: changing the textarea's defaultValue after
// reloading should also update the textarea's value.
var newDefaultValue = "new default value";
ta.defaultValue = newDefaultValue;
parent.is(ta.value, newDefaultValue,
"Changing the defaultValue attribute of a textarea fails to update its value attribute.");
parent.SimpleTest.finish();
}
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,30 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=441930
-->
<head>
<title>Test for Bug 441930</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=441930">Mozilla Bug 441930</a>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 441930: see bug441930_iframe.html **/
SimpleTest.waitForExplicitFinish();
</script>
</pre>
<p id="display">
<iframe src="bug441930_iframe.html"></iframe>
</p>
<div id="content" style="display: none">
</div>
</body>
</html>