Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 261131@main (151a757). https://bugs.webkit.org/show_bug.c…
…gi?id=253046 Image types enabled by additionalSupportedImageTypes do not show up in the Accept: header https://bugs.webkit.org/show_bug.cgi?id=253046 rdar://106006530 Reviewed by Said Abou-Hallawa. We can simply augment the Accept: header with the mime types of these image formats. * LayoutTests/http/tests/misc/heic-accept-header-expected.txt: Added. * LayoutTests/http/tests/misc/heic-accept-header.html: Added. * LayoutTests/http/tests/misc/resources/image-heic-accept.py: Added. * Source/WebCore/loader/cache/CachedResourceRequest.cpp: (WebCore::acceptHeaderValueForAdditionalSupportedImageMIMETypes): (WebCore::acceptHeaderValueForImageResource): Canonical link: https://commits.webkit.org/261131@main
- Loading branch information
Showing
8 changed files
with
77 additions
and
0 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
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,3 @@ | ||
Tests that HEIC is sent in the accept header if it's enabled. | ||
|
||
PASS |
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,29 @@ | ||
<!DOCTYPE html><!-- webkit-test-runner [ additionalSupportedImageTypes=public.heic;public.heics ] --> | ||
<html> | ||
<head> | ||
<script> | ||
if (window.testRunner) { | ||
testRunner.dumpAsText() | ||
testRunner.waitUntilDone(); | ||
} | ||
|
||
function test() { | ||
var image = document.getElementById("testImage"); | ||
var result = document.getElementById("result"); | ||
|
||
if (image.width == 400 && image.height == 400) | ||
result.innerHTML = "PASS"; | ||
else | ||
result.innerHTML = "FAIL"; | ||
|
||
if (window.testRunner) | ||
testRunner.notifyDone(); | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
Tests that HEIC is sent in the accept header if it's enabled.<br> | ||
<img id="testImage" src="resources/image-heic-accept.py" onload="test()" onerror="test()"/> | ||
<div id="result"/> | ||
</body> | ||
</html> |
Binary file not shown.
27 changes: 27 additions & 0 deletions
27
LayoutTests/http/tests/misc/resources/image-heic-accept.py
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,27 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import sys | ||
|
||
http_accept = os.environ.get('HTTP_ACCEPT', '') | ||
|
||
if 'image/heic' in http_accept: | ||
sys.stdout.write( | ||
'Content-Type: image/heic\r\n' | ||
'Cache-Control: no-store\r\n' | ||
'Connection: close\r\n\r\n' | ||
) | ||
|
||
sys.stdout.flush() | ||
with open(os.path.join(os.path.dirname(__file__), 'green-400x400.heic'), 'rb') as fn: | ||
sys.stdout.buffer.write(fn.read()) | ||
else: | ||
sys.stdout.write( | ||
'Content-Type: image/jpg\r\n' | ||
'Cache-Control: no-store\r\n' | ||
'Connection: close\r\n\r\n' | ||
) | ||
|
||
sys.stdout.flush() | ||
with open(os.path.join(os.path.dirname(__file__), 'compass.jpg'), 'rb') as fn: | ||
sys.stdout.buffer.write(fn.read()) |
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
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