[webkit-changes] [WebKit/WebKit] 7e1bc9: XPath: Do not accept whitespace characters other t...

Ahmad Saleem noreply at github.com
Mon Apr 24 07:42:05 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7e1bc9e89bee15c3828b75aa012d3d398de57ae3
      https://github.com/WebKit/WebKit/commit/7e1bc9e89bee15c3828b75aa012d3d398de57ae3
  Author: Ahmad Saleem <ahmad.saleem792+github at gmail.com>
  Date:   2023-04-24 (Mon, 24 Apr 2023)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/domxpath/fn-normalize-space-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/domxpath/lexical-structure-expected.txt
    M Source/WebCore/xml/XPathFunctions.cpp
    M Source/WebCore/xml/XPathParser.cpp
    M Source/WebCore/xml/XPathUtil.cpp
    M Source/WebCore/xml/XPathUtil.h

  Log Message:
  -----------
  XPath: Do not accept whitespace characters other than #x20, #x9, #xD, and #xA & fix normalize-space()

https://bugs.webkit.org/show_bug.cgi?id=255841

Reviewed by Chris Dumez.

This patch aligns WebKit with Blink / Chromium and Gecko / Firefox.

Merge: https://chromium.googlesource.com/chromium/src.git/+/01fd8522eaf35abdfa468f79333b350df96e1b62 &
https://chromium.googlesource.com/chromium/src.git/+/66c3b1b0ce745473f6478e1fa042d71f00ee9d47

This patch aligns WebKit with web-spec [1] & [2] and also fixes XML white spaces handling; #x20, #x9, #xD, and #xA.
We incorrectly handled other white spaces such as U+3000.

[1] https://www.w3.org/TR/1999/REC-xpath-19991116/#function-normalize-space
[2] https://www.w3.org/TR/1999/REC-xpath-19991116/#NT-ExprWhitespace

* Source/WebCore/xml/XPathFunctions.cpp:
(FunNormalizeSpace::evaluate):
* Source/WebCore/xml/XPathUtil.cpp:
(isXMLSpace): Introduce new bool function
* Source/WebCore/xml/XPathUtil.h: new bool function definition
* Source/WebCore/xml/XPathParser.cpp:
(Parser::skipWS): Use new 'isXMLSpace' function
* LayoutTests/imported/w3c/web-platform-tests/domxpath/lexical-structure-expected.txt: Rebaselined
* LayoutTests/imported/w3c/web-platform-tests/domxpath/fn-normalize-space-expected.txt: Rebaselined

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




More information about the webkit-changes mailing list