Skip to content
Permalink
Browse files
2010-10-18 Kent Tamura <tkent@chromium.org>
        Reviewed by Dimitri Glazkov.

        Should not save state of a detached form control.
        https://bugs.webkit.org/show_bug.cgi?id=47811

        * fast/forms/state-save-of-detached-control-expected.txt: Added.
        * fast/forms/state-save-of-detached-control.html: Added.
2010-10-18  Kent Tamura  <tkent@chromium.org>

        Reviewed by Dimitri Glazkov.

        Should not save state of a detached form control.
        https://bugs.webkit.org/show_bug.cgi?id=47811

        Test: fast/forms/state-save-of-detached-control.html

        * html/HTMLFormControlElement.cpp:
        (WebCore::HTMLFormControlElementWithState::shouldSaveAndRestoreFormControlState):
          If the node is detached, don't save the state.

Canonical link: https://commits.webkit.org/60592@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@70027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
tkent-google committed Oct 19, 2010
1 parent f8d9342 commit f763199468a37278b4a5b2f65edd5166bf433dd5
Showing 5 changed files with 74 additions and 1 deletion.
@@ -1,3 +1,13 @@
2010-10-18 Kent Tamura <tkent@chromium.org>

Reviewed by Dimitri Glazkov.

Should not save state of a detached form control.
https://bugs.webkit.org/show_bug.cgi?id=47811

* fast/forms/state-save-of-detached-control-expected.txt: Added.
* fast/forms/state-save-of-detached-control.html: Added.

2010-10-18 Oliver Hunt <oliver@apple.com>

Reviewed by Sam Weinig.
@@ -0,0 +1,5 @@
Test to NOT save state of a detached form control.

PASS document.getElementById("input2").value is ""


@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
<script src="../../fast/js/resources/js-test-pre.js"></script>
</head>
<body onload="runTest()">
<p>Test to NOT save state of a detached form control.</p>
<div id="console"></div>

<input id=emptyOnFirstVisit>
<form action="data:text/html,<script>history.back()&lt;/script>" id=form1>
<input name=user id=input2>
</form>

<script>
var i1;

function runTest()
{
var form1 = document.getElementById('form1');
var state = document.getElementById('emptyOnFirstVisit');
if (!state.value) {
// First visit.
if (window.layoutTestController)
layoutTestController.waitUntilDone();
state.value = 'visited';

form1.innerHTML = '<input name=user id=input1>';
i1 = document.getElementById('input1');
i1.value = 'value1';
form1.removeChild(i1);
// Submit form in a timeout to make sure that we create a new back/forward list item.
setTimeout(function() {document.getElementById('form1').submit();}, 0);
} else {
// Second visit.
shouldBe('document.getElementById("input2").value', '""'); // Not 'value1'.

if (window.layoutTestController)
layoutTestController.notifyDone();
}
}
</script>
</body>
</html>
@@ -1,3 +1,16 @@
2010-10-18 Kent Tamura <tkent@chromium.org>

Reviewed by Dimitri Glazkov.

Should not save state of a detached form control.
https://bugs.webkit.org/show_bug.cgi?id=47811

Test: fast/forms/state-save-of-detached-control.html

* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElementWithState::shouldSaveAndRestoreFormControlState):
If the node is detached, don't save the state.

2010-10-18 Xan Lopez <xlopez@igalia.com>

Reviewed by Martin Robinson.
@@ -440,7 +440,7 @@ bool HTMLFormControlElementWithState::autoComplete() const
bool HTMLFormControlElementWithState::shouldSaveAndRestoreFormControlState() const
{
// We don't save/restore control state in a form with autocomplete=off.
return autoComplete();
return attached() && autoComplete();
}

void HTMLFormControlElementWithState::finishParsingChildren()

0 comments on commit f763199

Please sign in to comment.