Title: [125327] branches/safari-536.26-branch

Diff

Modified: branches/safari-536.26-branch/LayoutTests/ChangeLog (125326 => 125327)


--- branches/safari-536.26-branch/LayoutTests/ChangeLog	2012-08-10 21:09:08 UTC (rev 125326)
+++ branches/safari-536.26-branch/LayoutTests/ChangeLog	2012-08-10 21:34:00 UTC (rev 125327)
@@ -1,5 +1,20 @@
-2012-08-010  Lucas Forschler  <[email protected]>
+2012-08-10  Lucas Forschler  <[email protected]>
 
+    Merge r125124.
+
+    2012-08-08  Brady Eidson  <[email protected]>
+
+            Google search query text reverts to original search query after multiple searches
+            <rdar://problem/10800686> and https://bugs.webkit.org/show_bug.cgi?id=93544
+
+            Reviewed by Darin Adler.
+
+            * fast/forms/autocomplete-off-with-default-value-does-not-clear-expected.txt: Added.
+            * fast/forms/autocomplete-off-with-default-value-does-not-clear.html: Added.
+            * fast/forms/resources/go-back.html: Added.
+
+2012-08-10  Lucas Forschler  <[email protected]>
+
     Rollout r124961.
     This was r124815 on trunk.
 

Copied: branches/safari-536.26-branch/LayoutTests/fast/forms/autocomplete-off-with-default-value-does-not-clear-expected.txt (from rev 125124, trunk/LayoutTests/fast/forms/autocomplete-off-with-default-value-does-not-clear-expected.txt) (0 => 125327)


--- branches/safari-536.26-branch/LayoutTests/fast/forms/autocomplete-off-with-default-value-does-not-clear-expected.txt	                        (rev 0)
+++ branches/safari-536.26-branch/LayoutTests/fast/forms/autocomplete-off-with-default-value-does-not-clear-expected.txt	2012-08-10 21:34:00 UTC (rev 125327)
@@ -0,0 +1,3 @@
+This page has a text input element with a default value and autocomplete set to off. When restored from the page cache its value should *not* be cleared.
+
+SomeNonDefaultValue

Copied: branches/safari-536.26-branch/LayoutTests/fast/forms/autocomplete-off-with-default-value-does-not-clear.html (from rev 125124, trunk/LayoutTests/fast/forms/autocomplete-off-with-default-value-does-not-clear.html) (0 => 125327)


--- branches/safari-536.26-branch/LayoutTests/fast/forms/autocomplete-off-with-default-value-does-not-clear.html	                        (rev 0)
+++ branches/safari-536.26-branch/LayoutTests/fast/forms/autocomplete-off-with-default-value-does-not-clear.html	2012-08-10 21:34:00 UTC (rev 125327)
@@ -0,0 +1,33 @@
+<script>
+
+if (window.testRunner) {
+	testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
+	testRunner.dumpAsText();
+	testRunner.waitUntilDone();
+}
+
+function loaded()
+{
+	document.getElementById("testInput").value = "SomeNonDefaultValue";
+	setTimeout("location.href = ''", 0);
+}
+
+function pageShown(evt)
+{
+	if (evt.persisted)
+		setTimeout("finishUp()", 0);
+}
+
+function finishUp()
+{
+	document.getElementById("logger").innerText = document.getElementById("testInput").value;
+	if (window.testRunner)
+		testRunner.notifyDone();
+}
+
+</script>
+<body _onload_="loaded()" _onpageshow_="pageShown(event)">
+This page has a text input element with a default value and autocomplete set to off.  When restored from the page cache its value should *not* be cleared.<br>
+<input id="testInput" type="test" autocomplete="off" value="DefaultValue">
+<div id="logger"></div>
+</body>

Copied: branches/safari-536.26-branch/LayoutTests/fast/forms/resources/go-back.html (from rev 125124, trunk/LayoutTests/fast/forms/resources/go-back.html) (0 => 125327)


--- branches/safari-536.26-branch/LayoutTests/fast/forms/resources/go-back.html	                        (rev 0)
+++ branches/safari-536.26-branch/LayoutTests/fast/forms/resources/go-back.html	2012-08-10 21:34:00 UTC (rev 125327)
@@ -0,0 +1,3 @@
+<body _onload_="setTimeout('history.back();', 0);">
+Going back...
+</body>

Modified: branches/safari-536.26-branch/Source/WebCore/ChangeLog (125326 => 125327)


--- branches/safari-536.26-branch/Source/WebCore/ChangeLog	2012-08-10 21:09:08 UTC (rev 125326)
+++ branches/safari-536.26-branch/Source/WebCore/ChangeLog	2012-08-10 21:34:00 UTC (rev 125327)
@@ -1,3 +1,29 @@
+2012-08-10  Lucas Forschler  <[email protected]>
+
+    Merge r125124.
+
+    2012-08-08  Brady Eidson  <[email protected]>
+
+            Google search query text reverts to original search query after multiple searches
+            <rdar://problem/10800686> and https://bugs.webkit.org/show_bug.cgi?id=93544
+
+            Reviewed by Darin Adler.
+
+            For security sensitive fields we normally clear "autocomplete=off" form elements when
+            restoring a page from the page cache.
+
+            If the element is textual and has a defaultValue then "clearing" it actually restores 
+            the default value.
+
+            There's no scenario we can imagine where that makes sense so we should not reset the 
+            value in such fields.
+
+            Test: fast/forms/autocomplete-off-with-default-value-does-not-clear.html
+
+            * html/HTMLInputElement.cpp:
+            (WebCore::HTMLInputElement::parseAttribute): Update suspension callback registration as needed.
+            (WebCore::HTMLInputElement::needsSuspensionCallback): Don't reset text fields with a non-empty default value.
+
 2012-08-07  Lucas Forschler  <[email protected]>
 
     Merge 123121

Modified: branches/safari-536.26-branch/Source/WebCore/html/HTMLInputElement.cpp (125326 => 125327)


--- branches/safari-536.26-branch/Source/WebCore/html/HTMLInputElement.cpp	2012-08-10 21:09:08 UTC (rev 125326)
+++ branches/safari-536.26-branch/Source/WebCore/html/HTMLInputElement.cpp	2012-08-10 21:34:00 UTC (rev 125327)
@@ -717,6 +717,12 @@
     } else if (attr->name() == typeAttr) {
         updateType();
     } else if (attr->name() == valueAttr) {
+        // Changes to the value attribute may change whether or not this element has a default value.
+        // If this field is autocomplete=off that might affect the return value of needsSuspensionCallback.
+        if (m_autocomplete == Off) {
+            unregisterForSuspensionCallbackIfNeeded();
+            registerForSuspensionCallbackIfNeeded();
+        }
         // We only need to setChanged if the form is looking at the default value right now.
         if (!hasDirtyValue()) {
             updatePlaceholderVisibility(false);
@@ -1403,7 +1409,17 @@
 
 bool HTMLInputElement::needsSuspensionCallback()
 {
-    return m_autocomplete == Off || m_inputType->shouldResetOnDocumentActivation();
+    if (m_inputType->shouldResetOnDocumentActivation())
+        return true;
+
+    // Sensitive input elements are marked with autocomplete=off, and we want to wipe them out
+    // when going back; returning true here arranges for us to call reset at the time
+    // the page is restored. Non-empty textual default values indicate that the field
+    // is not really sensitive -- there's no default value for an account number --
+    // and we would see unexpected results if we reset to something other than blank.
+    bool isSensitive = m_autocomplete == Off && !(m_inputType->isTextType() && !defaultValue().isEmpty());
+
+    return isSensitive;
 }
 
 void HTMLInputElement::registerForSuspensionCallbackIfNeeded()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to