Title: [289526] trunk
Revision
289526
Author
[email protected]
Date
2022-02-10 03:10:45 -0800 (Thu, 10 Feb 2022)

Log Message

[:has() pseudo-class] Nullptr crash with non-function :has
https://bugs.webkit.org/show_bug.cgi?id=236431
rdar://87061239

Reviewed by Cameron McCormack.

LayoutTests/imported/w3c:

* web-platform-tests/css/selectors/parsing/parse-has-expected.txt:
* web-platform-tests/css/selectors/parsing/parse-has.html:

Source/WebCore:

Test: fast/selectors/malformed-has.html

* css/parser/CSSSelectorParser.cpp:
(WebCore::isOnlyPseudoClassFunction):

:has() is legal, plain :has is not.

LayoutTests:

* fast/selectors/malformed-has-expected.txt: Added.
* fast/selectors/malformed-has.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (289525 => 289526)


--- trunk/LayoutTests/ChangeLog	2022-02-10 10:36:23 UTC (rev 289525)
+++ trunk/LayoutTests/ChangeLog	2022-02-10 11:10:45 UTC (rev 289526)
@@ -1,3 +1,14 @@
+2022-02-10  Antti Koivisto  <[email protected]>
+
+        [:has() pseudo-class] Nullptr crash with non-function :has
+        https://bugs.webkit.org/show_bug.cgi?id=236431
+        rdar://87061239
+
+        Reviewed by Cameron McCormack.
+
+        * fast/selectors/malformed-has-expected.txt: Added.
+        * fast/selectors/malformed-has.html: Added.
+
 2022-02-10  Martin Robinson  <[email protected]>
 
         [macOS arm64] imported/w3c/web-platform-tests/css/css-transforms/perspective-transforms-equivalence.html is consistently failing

Added: trunk/LayoutTests/fast/selectors/malformed-has-expected.txt (0 => 289526)


--- trunk/LayoutTests/fast/selectors/malformed-has-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/selectors/malformed-has-expected.txt	2022-02-10 11:10:45 UTC (rev 289526)
@@ -0,0 +1 @@
+This test passes if it doesn't crash.

Added: trunk/LayoutTests/fast/selectors/malformed-has.html (0 => 289526)


--- trunk/LayoutTests/fast/selectors/malformed-has.html	                        (rev 0)
+++ trunk/LayoutTests/fast/selectors/malformed-has.html	2022-02-10 11:10:45 UTC (rev 289526)
@@ -0,0 +1,9 @@
+<style>
+div:has { color: red; }
+</style>
+<div>This test passes if it doesn't crash.</div>
+
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (289525 => 289526)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-10 10:36:23 UTC (rev 289525)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-10 11:10:45 UTC (rev 289526)
@@ -1,3 +1,14 @@
+2022-02-10  Antti Koivisto  <[email protected]>
+
+        [:has() pseudo-class] Nullptr crash with non-function :has
+        https://bugs.webkit.org/show_bug.cgi?id=236431
+        rdar://87061239
+
+        Reviewed by Cameron McCormack.
+
+        * web-platform-tests/css/selectors/parsing/parse-has-expected.txt:
+        * web-platform-tests/css/selectors/parsing/parse-has.html:
+
 2022-02-10  Martin Robinson  <[email protected]>
 
         [macOS arm64] imported/w3c/web-platform-tests/css/css-transforms/perspective-transforms-equivalence.html is consistently failing

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/parsing/parse-has-expected.txt (289525 => 289526)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/parsing/parse-has-expected.txt	2022-02-10 10:36:23 UTC (rev 289525)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/parsing/parse-has-expected.txt	2022-02-10 11:10:45 UTC (rev 289526)
@@ -25,4 +25,7 @@
 PASS "*|*:has(*)" should be a valid selector
 PASS ":has(*|*)" should be a valid selector
 PASS ".a:has()" should be an invalid selector
+PASS ":has" should be an invalid selector
+PASS ".a:has" should be an invalid selector
+PASS ".a:has b" should be an invalid selector
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/parsing/parse-has.html (289525 => 289526)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/parsing/parse-has.html	2022-02-10 10:36:23 UTC (rev 289525)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/parsing/parse-has.html	2022-02-10 11:10:45 UTC (rev 289526)
@@ -33,4 +33,7 @@
   test_valid_selector('*|*:has(*)', ':has(*)');
   test_valid_selector(':has(*|*)', ':has(*)');
   test_invalid_selector('.a:has()');
-</script>
\ No newline at end of file
+  test_invalid_selector(':has');
+  test_invalid_selector('.a:has');
+  test_invalid_selector('.a:has b');
+</script>

Modified: trunk/Source/WebCore/ChangeLog (289525 => 289526)


--- trunk/Source/WebCore/ChangeLog	2022-02-10 10:36:23 UTC (rev 289525)
+++ trunk/Source/WebCore/ChangeLog	2022-02-10 11:10:45 UTC (rev 289526)
@@ -1,3 +1,18 @@
+2022-02-10  Antti Koivisto  <[email protected]>
+
+        [:has() pseudo-class] Nullptr crash with non-function :has
+        https://bugs.webkit.org/show_bug.cgi?id=236431
+        rdar://87061239
+
+        Reviewed by Cameron McCormack.
+
+        Test: fast/selectors/malformed-has.html
+
+        * css/parser/CSSSelectorParser.cpp:
+        (WebCore::isOnlyPseudoClassFunction):
+
+        :has() is legal, plain :has is not.
+
 2022-02-10  Kimmo Kinnunen  <[email protected]>
 
         Introduce a RemoteMediaSampleProxy to represent captured video frames used in Media Streams and present in GPUP

Modified: trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp (289525 => 289526)


--- trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp	2022-02-10 10:36:23 UTC (rev 289525)
+++ trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp	2022-02-10 11:10:45 UTC (rev 289526)
@@ -590,6 +590,7 @@
     case CSSSelector::PseudoClassIs:
     case CSSSelector::PseudoClassMatches:
     case CSSSelector::PseudoClassWhere:
+    case CSSSelector::PseudoClassHas:
     case CSSSelector::PseudoClassNthChild:
     case CSSSelector::PseudoClassNthLastChild:
     case CSSSelector::PseudoClassNthOfType:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to