Index: third_party/WebKit/Source/core/fetch/DocumentResource.cpp |
diff --git a/third_party/WebKit/Source/core/fetch/DocumentResource.cpp b/third_party/WebKit/Source/core/fetch/DocumentResource.cpp |
index aab75f75f9c939b780a973889aa8041dcfd10c7e..d076e1ad6b38d9a33360100f2e9760fb45edfc03 100644 |
--- a/third_party/WebKit/Source/core/fetch/DocumentResource.cpp |
+++ b/third_party/WebKit/Source/core/fetch/DocumentResource.cpp |
@@ -67,7 +67,7 @@ String DocumentResource::encoding() const |
void DocumentResource::checkNotify() |
{ |
- if (m_data) { |
+ if (m_data && mimeTypeAllowed()) { |
StringBuilder decodedText; |
decodedText.append(m_decoder->decode(m_data->data(), m_data->size())); |
decodedText.append(m_decoder->flush()); |
@@ -78,6 +78,18 @@ void DocumentResource::checkNotify() |
Resource::checkNotify(); |
} |
+bool DocumentResource::mimeTypeAllowed() const |
+{ |
+ ASSERT(type() == SVGDocument); |
+ AtomicString mimeType = response().mimeType(); |
+ if (response().isHTTP()) |
+ mimeType = httpContentType(); |
+ return mimeType == "image/svg+xml" |
+ || mimeType == "text/xml" |
+ || mimeType == "application/xml" |
+ || mimeType == "application/xhtml+xml"; |
+} |
+ |
PassRefPtrWillBeRawPtr<Document> DocumentResource::createDocument(const KURL& url) |
{ |
switch (type()) { |