[webkit-changes] [WebKit/WebKit] af134e: CSS @imports in HTML missing semi-colon and space ...

Ahmad Saleem noreply at github.com
Sat Aug 26 03:12:29 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: af134e645543841f47f56df5620d9fb742ef9426
      https://github.com/WebKit/WebKit/commit/af134e645543841f47f56df5620d9fb742ef9426
  Author: Ahmad Saleem <ahmad.saleem792+github at gmail.com>
  Date:   2023-08-26 (Sat, 26 Aug 2023)

  Changed paths:
    A LayoutTests/imported/w3c/web-platform-tests/loading/preloader-css-import-no-semicolon.tentative-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/loading/preloader-css-import-no-semicolon.tentative.html
    A LayoutTests/imported/w3c/web-platform-tests/loading/preloader-css-import-no-space.tentative-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/loading/preloader-css-import-no-space.tentative.html
    M LayoutTests/platform/glib/TestExpectations
    M LayoutTests/platform/wpe/TestExpectations
    M Source/WebCore/html/parser/CSSPreloadScanner.cpp
    M Source/WebCore/html/parser/CSSPreloadScanner.h

  Log Message:
  -----------
  CSS @imports in HTML missing semi-colon and space are mistakenly hidden from CSSPreload Scanner

https://bugs.webkit.org/show_bug.cgi?id=253462
rdar://problem/106666050

Reviewed by Ryosuke Niwa.

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

Merge: https://chromium.googlesource.com/chromium/src.git/+/60092ea1a78a62ab84983e321b95415a358b07eb

When scanning for @import rules to preload, CSSPreloadScanner terminates
a URL at ';' unconditionally. This is wrong as there might be ';' in a
URL, in which case we make a preload of a broken URL.

This patch scans URLs in a saner way:
- For urls given as a raw string, terminate at the ending quote
- Other those wrapped in a 'url()', terminate at the closing parenthesis

Note: We do not intend to write a full parser here, so it's still broken
in some cases (e.g., when the url contains ' ' or ')'). It's out of the
scope of this patch to fix them and already broken in current parser.

* Source/WebCore/html/parser/CSSPreloadScanner.cpp:
(CSSPreloadScanner::scan):
(CSSPreloadScanner::tokenize):
(CSSPreloadScanner::hasFinishedRuleValue):
* Source/WebCore/html/parser/CSSPreloadScanner.h: New bool function 'hasFinishedRuleValue'
* LayoutTests/imported/w3c/web-platform-tests/loading/preloader-css-import-no-space.tentative.html: Add Test Case
* LayoutTests/imported/w3c/web-platform-tests/loading/preloader-css-import-no-space.tentative-expected.txt: Add Test Case Expectation
* LayoutTests/imported/w3c/web-platform-tests/loading/preloader-css-import-no-semicolon.tentative.html: Add Test Case
* LayoutTests/imported/w3c/web-platform-tests/loading/preloader-css-import-no-semicolon.tentative-expected.txt: Add Test Case Expectation
* LayoutTests/platform/glib/TestExpectations: Add Platform Specific Expectation (for GTK-WK2) with bug reference due to 'libsoup' issue
* LayoutTests/platform/wpe/TestExpectations: Add Platform Specific Expectation (for WPE-WK2) with bug reference due to 'libsoup' issue

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




More information about the webkit-changes mailing list