Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
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@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@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
- Loading branch information
Showing
4 changed files
with
34 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<DOCTYPE html> | ||
<html> | ||
<body> | ||
<p>Tests that a JPEG image served with `Content-Type: image/jpg` gets rendered, and not downloaded.</p> | ||
<iframe id="testFrame" src="/resources/square20.jpg"></iframe> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<DOCTYPE html> | ||
<html> | ||
<body> | ||
<p>Tests that a JPEG image served with `Content-Type: image/jpg` gets rendered, and not downloaded.</p> | ||
<iframe id="testFrame" src="about:blank"></iframe> | ||
<script> | ||
if (window.testRunner) | ||
testRunner.waitUntilDone(); | ||
|
||
let testFrame = document.getElementById("testFrame"); | ||
testFrame.src = "/resources/load-and-stall.py?name=square20.jpg&mimeType=image%2Fjpg"; | ||
testFrame.onload = () => { | ||
if (window.testRunner) | ||
testRunner.notifyDone(); | ||
}; | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters