Title: [243647] trunk
Revision
243647
Author
mcatanz...@igalia.com
Date
2019-03-29 09:11:02 -0700 (Fri, 29 Mar 2019)

Log Message

HTMLInputElement::setEditingValue should not fail if renderer doesn't exist
https://bugs.webkit.org/show_bug.cgi?id=195708

Reviewed by Wenson Hsieh.

Source/WebCore:

HTMLInputElement::setEditingValue currently returns early if the element's renderer() is
null. This is causing the Epiphany password manager to fail to remember passwords on
https://www.geico.com/ except for navigations through page cache.

This check was originally added to avoid some assertion, but I don't know which one, and
there's definitely not any assertion hit nowadays in this case. Probably there are more
guards checking if renderer() is null elsewhere in the code nowadays, closer to where it's
really needed.

Test: fast/forms/editing-value-null-renderer.html

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setEditingValue):

LayoutTests:

This is a copy of fast/forms/editing-value.html, except the form is not displayed. The input
value should still change.

* fast/forms/editing-value-null-renderer-expected.txt: Added.
* fast/forms/editing-value-null-renderer.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (243646 => 243647)


--- trunk/LayoutTests/ChangeLog	2019-03-29 15:56:41 UTC (rev 243646)
+++ trunk/LayoutTests/ChangeLog	2019-03-29 16:11:02 UTC (rev 243647)
@@ -1,3 +1,16 @@
+2019-03-29  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        HTMLInputElement::setEditingValue should not fail if renderer doesn't exist
+        https://bugs.webkit.org/show_bug.cgi?id=195708
+
+        Reviewed by Wenson Hsieh.
+
+        This is a copy of fast/forms/editing-value.html, except the form is not displayed. The input
+        value should still change.
+
+        * fast/forms/editing-value-null-renderer-expected.txt: Added.
+        * fast/forms/editing-value-null-renderer.html: Added.
+
 2019-03-28  Antoine Quint  <grao...@apple.com>
 
         All PointerEvent.isTrusted is always false.

Added: trunk/LayoutTests/fast/forms/editing-value-null-renderer-expected.txt (0 => 243647)


--- trunk/LayoutTests/fast/forms/editing-value-null-renderer-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/editing-value-null-renderer-expected.txt	2019-03-29 16:11:02 UTC (rev 243647)
@@ -0,0 +1,12 @@
+This tests setting the editing value of an input.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS oninput event was fired.
+PASS input.value is "foo"
+PASS document.querySelector(":invalid") is input
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/forms/editing-value-null-renderer.html (0 => 243647)


--- trunk/LayoutTests/fast/forms/editing-value-null-renderer.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/editing-value-null-renderer.html	2019-03-29 16:11:02 UTC (rev 243647)
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<input type="email" id="test" placeholder="FAIL: placeholder should disappear" style="display: none">
+
+<script>
+description('This tests setting the editing value of an input.');
+
+var input = document.getElementById('test');
+input._onchange_ = function() {
+    testFailed("onchange event was fired.");
+};
+input._oninput_ = function() {
+    testPassed("oninput event was fired.");
+};
+
+input.focus();
+if (window.internals) {
+    internals.setEditingValue(input, " foo ");
+} else {
+    debug('This test requires window.internals object.');
+}
+shouldBe('input.value', '"foo"');
+shouldBe('document.querySelector(":invalid")', 'input');
+input.blur();
+
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (243646 => 243647)


--- trunk/Source/WebCore/ChangeLog	2019-03-29 15:56:41 UTC (rev 243646)
+++ trunk/Source/WebCore/ChangeLog	2019-03-29 16:11:02 UTC (rev 243647)
@@ -1,3 +1,24 @@
+2019-03-29  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        HTMLInputElement::setEditingValue should not fail if renderer doesn't exist
+        https://bugs.webkit.org/show_bug.cgi?id=195708
+
+        Reviewed by Wenson Hsieh.
+
+        HTMLInputElement::setEditingValue currently returns early if the element's renderer() is
+        null. This is causing the Epiphany password manager to fail to remember passwords on
+        https://www.geico.com/ except for navigations through page cache.
+
+        This check was originally added to avoid some assertion, but I don't know which one, and
+        there's definitely not any assertion hit nowadays in this case. Probably there are more
+        guards checking if renderer() is null elsewhere in the code nowadays, closer to where it's
+        really needed.
+
+        Test: fast/forms/editing-value-null-renderer.html
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::setEditingValue):
+
 2019-03-29  Chris Dumez  <cdu...@apple.com>
 
         Unreviewed, rebaseline WPT test after r243638.

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (243646 => 243647)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2019-03-29 15:56:41 UTC (rev 243646)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2019-03-29 16:11:02 UTC (rev 243647)
@@ -1036,8 +1036,9 @@
 
 void HTMLInputElement::setEditingValue(const String& value)
 {
-    if (!renderer() || !isTextField())
+    if (!isTextField())
         return;
+
     setInnerTextValue(value);
     subtreeHasChanged();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to