Title: [216443] trunk
Revision
216443
Author
jiewen_...@apple.com
Date
2017-05-08 12:17:29 -0700 (Mon, 08 May 2017)

Log Message

Search events should not fire synchronously for search type input elements with incremental attribute set
https://bugs.webkit.org/show_bug.cgi?id=171376
<rdar://problem/31863296>

Reviewed by Chris Dumez.

Source/WebCore:

For some reasons, we fire search events immediately for search type input elements with incremental
attribute set only when the length of the input equals to zero. This behaviour should be prevented
as event listeners in the middle might perform unexpectedly.

Test: fast/forms/search/search-incremental-crash.html

* html/SearchInputType.cpp:
(WebCore::SearchInputType::startSearchEventTimer):

LayoutTests:

* fast/forms/search/search-incremental-crash-expected.txt: Added.
* fast/forms/search/search-incremental-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (216442 => 216443)


--- trunk/LayoutTests/ChangeLog	2017-05-08 18:58:09 UTC (rev 216442)
+++ trunk/LayoutTests/ChangeLog	2017-05-08 19:17:29 UTC (rev 216443)
@@ -1,3 +1,14 @@
+2017-05-04  Jiewen Tan  <jiewen_...@apple.com>
+
+        Search events should not fire synchronously for search type input elements with incremental attribute set
+        https://bugs.webkit.org/show_bug.cgi?id=171376
+        <rdar://problem/31863296>
+
+        Reviewed by Chris Dumez.
+
+        * fast/forms/search/search-incremental-crash-expected.txt: Added.
+        * fast/forms/search/search-incremental-crash.html: Added.
+
 2017-05-08  Zalan Bujtas  <za...@apple.com>
 
         Text overlaps on http://www.duden.de/rechtschreibung/Acre

Added: trunk/LayoutTests/fast/forms/search/search-incremental-crash-expected.txt (0 => 216443)


--- trunk/LayoutTests/fast/forms/search/search-incremental-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/search/search-incremental-crash-expected.txt	2017-05-08 19:17:29 UTC (rev 216443)
@@ -0,0 +1 @@
+ Test passes if WebKit doesn't crash.

Added: trunk/LayoutTests/fast/forms/search/search-incremental-crash.html (0 => 216443)


--- trunk/LayoutTests/fast/forms/search/search-incremental-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/search/search-incremental-crash.html	2017-05-08 19:17:29 UTC (rev 216443)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    var runcount = 0;
+    function go() {
+        runcount++;
+        if (runcount > 2)
+            return;
+
+        i.type = "foo";
+        i.select();
+        i.type = "search";
+
+        document._onsearch_ = document.body.onload;
+
+        document.execCommand("insertHTML", false, "");
+    }
+</script>
+</head>
+<body _onload_=go()>
+<input id="i" type="checkbox" incremental="incremental">
+Test passes if WebKit doesn't crash.
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (216442 => 216443)


--- trunk/Source/WebCore/ChangeLog	2017-05-08 18:58:09 UTC (rev 216442)
+++ trunk/Source/WebCore/ChangeLog	2017-05-08 19:17:29 UTC (rev 216443)
@@ -1,3 +1,20 @@
+2017-05-04  Jiewen Tan  <jiewen_...@apple.com>
+
+        Search events should not fire synchronously for search type input elements with incremental attribute set
+        https://bugs.webkit.org/show_bug.cgi?id=171376
+        <rdar://problem/31863296>
+
+        Reviewed by Chris Dumez.
+
+        For some reasons, we fire search events immediately for search type input elements with incremental
+        attribute set only when the length of the input equals to zero. This behaviour should be prevented
+        as event listeners in the middle might perform unexpectedly.
+
+        Test: fast/forms/search/search-incremental-crash.html
+
+        * html/SearchInputType.cpp:
+        (WebCore::SearchInputType::startSearchEventTimer):
+
 2017-05-08  Zalan Bujtas  <za...@apple.com>
 
         Text overlaps on http://www.duden.de/rechtschreibung/Acre

Modified: trunk/Source/WebCore/html/SearchInputType.cpp (216442 => 216443)


--- trunk/Source/WebCore/html/SearchInputType.cpp	2017-05-08 18:58:09 UTC (rev 216442)
+++ trunk/Source/WebCore/html/SearchInputType.cpp	2017-05-08 19:17:29 UTC (rev 216443)
@@ -161,8 +161,7 @@
     unsigned length = element().innerTextValue().length();
 
     if (!length) {
-        stopSearchEventTimer();
-        element().onSearch();
+        m_searchEventTimer.startOneShot(0_ms);
         return;
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to