[webkit-changes] [WebKit/WebKit] 0d17dc: Accept image/jpg for compatibility reasons

Chris Dumez noreply at github.com
Fri Oct 7 07:38:09 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0d17dc0c310f9b1d05268ab63e967c38133892f0
      https://github.com/WebKit/WebKit/commit/0d17dc0c310f9b1d05268ab63e967c38133892f0
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2022-10-07 (Fri, 07 Oct 2022)

  Changed paths:
    A LayoutTests/http/tests/images/jpg-invalid-content-type-expected.html
    A LayoutTests/http/tests/images/jpg-invalid-content-type.html
    M Source/WebCore/platform/MIMETypeRegistry.cpp
    M Source/WebCore/platform/graphics/cg/ImageBufferUtilitiesCG.cpp

  Log Message:
  -----------
  Accept image/jpg for compatibility reasons
https://bugs.webkit.org/show_bug.cgi?id=246131
rdar://100835192

Reviewed by Said Abou-Hallawa and Darin Adler.

Blink & Gecko seem to render JPEG images served with `Content-Type: image/jpg`
while WebKit decides to download it because the correct content type is
supposed to be `image/jpeg`. This is an interoperability risk so we should
align.

In this patch, we now treat `image/jpg` as a valid JPEG content type to align
with other browser engines.

Also revert a couple of unintended changes that were made in 237163 at main:
- The logic in normalizedImageMIMEType() was for CURL only but the condition got
  mistakenly reversed.
- The normalized MIME type was previously used for both supportedImageMIMETypeSet
  and additionalSupportedImageMIMETypes. However, 237163 at main stopped using the
  normalized MIME type for supportedImageMIMETypeSet.

* LayoutTests/http/tests/images/jpg-invalid-content-type-expected.html: Added.
* LayoutTests/http/tests/images/jpg-invalid-content-type.html: Added.
* Source/WebCore/platform/MIMETypeRegistry.cpp:
(WebCore::MIMETypeRegistry::isSupportedImageMIMEType):

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




More information about the webkit-changes mailing list