[webkit-changes] [WebKit/WebKit] f3dcaa: [CSS Highlight API] REGRESSION(270146 at main): Crash...

Tim Nguyen noreply at github.com
Sat Nov 4 09:20:30 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f3dcaa105e40967837c37e998f2383c22ec0b99c
      https://github.com/WebKit/WebKit/commit/f3dcaa105e40967837c37e998f2383c22ec0b99c
  Author: Tim Nguyen <ntim at apple.com>
  Date:   2023-11-04 (Sat, 04 Nov 2023)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/highlight-pseudo-parsing-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/highlight-pseudo-parsing.html
    A LayoutTests/imported/w3c/web-platform-tests/css/cssom/invalid-pseudo-elements-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/css/cssom/invalid-pseudo-elements.html
    M Source/WebCore/css/parser/CSSSelectorParser.cpp

  Log Message:
  -----------
  [CSS Highlight API] REGRESSION(270146 at main): Crash trying to serialize `::highlight`
https://bugs.webkit.org/show_bug.cgi?id=264204
rdar://117943689

Reviewed by Simon Fraser.

270146 at main made the correct assumption that `::highlight` should not parse without a function argument...

Except it does parse successfully, this leads to this testcase crashing:
```
<style>
    ::highlight {}
</style>
<script>
  onload = () => {
    document.styleSheets[0].cssRules[0].selectorText;
  };
</script>
```

In this testcase, document.styleSheets[0].cssRules[0] should be undefined.

Reject `::highlight` with no argument at parse-time and add related WPTs.

* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/highlight-pseudo-parsing-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/highlight-pseudo-parsing.html:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/invalid-pseudo-elements-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/invalid-pseudo-elements.html: Added.
* Source/WebCore/css/parser/CSSSelectorParser.cpp:
(WebCore::isOnlyPseudoElementFunction):

Canonical link: https://commits.webkit.org/270229@main




More information about the webkit-changes mailing list