[webkit-changes] [WebKit/WebKit] c31f4e: link at rel=stylesheet: Don’t load if bad MIME type, ...

sideshowbarker noreply at github.com
Wed Sep 27 14:10:09 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c31f4e6a298d56fd8fee979fbef060b001c7674e
      https://github.com/WebKit/WebKit/commit/c31f4e6a298d56fd8fee979fbef060b001c7674e
  Author: Michael[tm] Smith <mike at w3.org>
  Date:   2023-09-27 (Wed, 27 Sep 2023)

  Changed paths:
    A LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/resources/stylesheet-bad-mime-type-empty.css
    A LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/resources/stylesheet-bad-mime-type-empty.css.headers
    A LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/resources/stylesheet-bad-mime-type.css
    A LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/resources/stylesheet-bad-mime-type.css.headers
    A LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/stylesheet-bad-mime-type-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/stylesheet-bad-mime-type.html
    A LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/stylesheet-bad-mime-type-expected.txt
    M Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp

  Log Message:
  -----------
  link at rel=stylesheet: Don’t load if bad MIME type, even if resource is empty
https://bugs.webkit.org/show_bug.cgi?id=261811

Reviewed by Chris Dumez.

When a resource from a <link rel=stylesheet> element has a non-CSS MIME
type and is also empty (has no body/data), this change ensures that
WebKit fully conforms to the requirement in the HTML standard at
https://html.spec.whatwg.org/multipage/links.html#link-type-stylesheet
that no “load” event is fired at the element.

The change also ensures that a “Did not parse stylesheet… because non
CSS MIME types are not allowed in strict mode” error is logged to the
Web Inspector console.

Otherwise, without this change, WebKit fires a “load” event in this case —
and so, doesn’t conform to the relevant requirement in the HTML standard —
and also logs no error to the Web Inspector console.

* LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/resources/stylesheet-bad-mime-type-empty.css: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/resources/stylesheet-bad-mime-type-empty.css.headers: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/resources/stylesheet-bad-mime-type.css: Added.
(body):
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/resources/stylesheet-bad-mime-type.css.headers: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/stylesheet-bad-mime-type-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/stylesheet-bad-mime-type.html: Added.
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/stylesheet-bad-mime-type-expected.txt: Added.
Changed expectations to have http://web-platform.test:8800 URL in console message, rather than http://localhost:8800
* Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp:
(WebCore::CachedCSSStyleSheet::sheetText const):

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




More information about the webkit-changes mailing list