PNG mask images are loaded with Accept:image/svg+xml
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Jul 2015 17:22:27 +0000 (17:22 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Jul 2015 17:22:27 +0000 (17:22 +0000)
commit4ef5328c0e115db37f090454189182f589b12523
treec98165bf8bec7c9f426f5229096ddbc477f86c1d
parent5545be5ea97f6ca66a7853ad606793fd71239ea8
PNG mask images are loaded with Accept:image/svg+xml
https://bugs.webkit.org/show_bug.cgi?id=146509
Source/WebCore:

rdar://problem/21584740

Reviewed by Simon Fraser.

For some strange reason MaskImageOperation code loads all mask images, including non-SVG ones
using CachedSVGDocument. Resulting bad accept header may cause server to reject the request.

This is far from ideal but as a quick fix we can override the accept header for mask images to
allow any image type.

Test: http/tests/misc/mask-image-accept.html

* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
* loader/cache/CachedResourceRequest.h:
(WebCore::CachedResourceRequest::acceptOverride):
(WebCore::CachedResourceRequest::setAcceptOverride):
* loader/cache/CachedSVGDocumentReference.cpp:
(WebCore::CachedSVGDocumentReference::load):
* loader/cache/CachedSVGDocumentReference.h:
(WebCore::CachedSVGDocumentReference::loadRequested):
(WebCore::CachedSVGDocumentReference::setAcceptsAnyImageType):
(WebCore::CachedSVGDocumentReference::document):
* platform/graphics/MaskImageOperation.cpp:
(WebCore::MaskImageOperation::ensureCachedSVGDocumentReference):

LayoutTests:

Reviewed by Simon Fraser.

* http/tests/misc/mask-image-accept-expected.html: Added.
* http/tests/misc/mask-image-accept.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@186180 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/http/tests/misc/mask-image-accept-expected.html [new file with mode: 0644]
LayoutTests/http/tests/misc/mask-image-accept.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/loader/cache/CachedResourceLoader.cpp
Source/WebCore/loader/cache/CachedResourceRequest.h
Source/WebCore/loader/cache/CachedSVGDocumentReference.cpp
Source/WebCore/loader/cache/CachedSVGDocumentReference.h
Source/WebCore/platform/graphics/MaskImageOperation.cpp