Title: [266054] trunk
Revision
266054
Author
commit-qu...@webkit.org
Date
2020-08-24 05:29:24 -0700 (Mon, 24 Aug 2020)

Log Message

Make window.find not default the search string to undefined
https://bugs.webkit.org/show_bug.cgi?id=215757

Patch by Rob Buis <rb...@igalia.com> on 2020-08-24
Reviewed by Darin Adler.

Source/WebCore:

Make window.find not default the search string to undefined, instead
use the null string. Before this change window.find() would find a
hit in a page containing the text string "undefined".

Test: fast/text/window-find.html

* page/DOMWindow.idl:

LayoutTests:

Add tests to verify window.find() does not use "undefined"
as text string. This also fixes the logic of the test to
not always output PASS at the end.

* fast/text/window-find.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (266053 => 266054)


--- trunk/LayoutTests/ChangeLog	2020-08-24 09:55:13 UTC (rev 266053)
+++ trunk/LayoutTests/ChangeLog	2020-08-24 12:29:24 UTC (rev 266054)
@@ -1,3 +1,16 @@
+2020-08-24  Rob Buis  <rb...@igalia.com>
+
+        Make window.find not default the search string to undefined
+        https://bugs.webkit.org/show_bug.cgi?id=215757
+
+        Reviewed by Darin Adler.
+
+        Add tests to verify window.find() does not use "undefined"
+        as text string. This also fixes the logic of the test to
+        not always output PASS at the end.
+
+        * fast/text/window-find.html:
+
 2020-08-23  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Programmatic selection of text in a text field causes the highlight overlay to spill out

Modified: trunk/LayoutTests/fast/text/window-find.html (266053 => 266054)


--- trunk/LayoutTests/fast/text/window-find.html	2020-08-24 09:55:13 UTC (rev 266053)
+++ trunk/LayoutTests/fast/text/window-find.html	2020-08-24 12:29:24 UTC (rev 266054)
@@ -5,11 +5,16 @@
 if (window.testRunner)
     testRunner.dumpAsText();
 
+var passed = true;
+
 function fail(s) {
-    document.body.innerHTML = "FAIL: " + s;
+    document.body.innerHTML += "FAIL: " + s + "<br>";
+    passed = false;
 }
 
 function runTest() {
+    if (window.find()) fail('found: find with no parameters');
+    if (window.find('')) fail('found: empty string');
     if (window.find('nonsense')) fail('found: nonsense');
     if (window.find('nonsense', true)) fail('found: nonsense');
     if (window.find('nonsense', false)) fail('found: nonsense');
@@ -34,7 +39,7 @@
     if (!window.find('for', true, false, true)) fail('not found: for');
     if (window.find('FOR', true, false, true)) fail('found: FOR');
 
-    document.body.innerHTML = "This is a test for window.find(). SUCCESS!";
+    if (passed) document.body.innerHTML = "This is a test for window.find(). SUCCESS!";
 }
 
 </script>

Modified: trunk/Source/WebCore/ChangeLog (266053 => 266054)


--- trunk/Source/WebCore/ChangeLog	2020-08-24 09:55:13 UTC (rev 266053)
+++ trunk/Source/WebCore/ChangeLog	2020-08-24 12:29:24 UTC (rev 266054)
@@ -1,3 +1,18 @@
+2020-08-24  Rob Buis  <rb...@igalia.com>
+
+        Make window.find not default the search string to undefined
+        https://bugs.webkit.org/show_bug.cgi?id=215757
+
+        Reviewed by Darin Adler.
+
+        Make window.find not default the search string to undefined, instead
+        use the null string. Before this change window.find() would find a
+        hit in a page containing the text string "undefined".
+
+        Test: fast/text/window-find.html
+
+        * page/DOMWindow.idl:
+
 2020-08-24  Justin Uberti  <jus...@uberti.name>
 
         RTCRtpSynchronizationSource.rtpTimestamp is not present

Modified: trunk/Source/WebCore/page/DOMWindow.idl (266053 => 266054)


--- trunk/Source/WebCore/page/DOMWindow.idl	2020-08-24 09:55:13 UTC (rev 266053)
+++ trunk/Source/WebCore/page/DOMWindow.idl	2020-08-24 12:29:24 UTC (rev 266054)
@@ -159,7 +159,7 @@
     [Replaceable, CustomGetter] readonly attribute Event event;
     attribute DOMString defaultStatus;
     [ImplementedAs=defaultStatus] attribute DOMString defaultstatus; // For compatibility with legacy content.
-    boolean find(optional DOMString string = "undefined", optional boolean caseSensitive = false, optional boolean backwards = false, optional boolean wrap = false, optional boolean wholeWord = false, optional boolean searchInFrames = false, optional boolean showDialog = false); // FIXME: Using "undefined" as default parameter value is wrong.
+    boolean find(optional DOMString string, optional boolean caseSensitive = false, optional boolean backwards = false, optional boolean wrap = false, optional boolean wholeWord = false, optional boolean searchInFrames = false, optional boolean showDialog = false); // FIXME: Using "undefined" as default parameter value is wrong.
     [Replaceable] readonly attribute  boolean offscreenBuffering;
     [Replaceable] readonly attribute long screenLeft;
     [Replaceable] readonly attribute long screenTop;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to