From 28ce677a13b979cf3d862d9753b746bb309131dd Mon Sep 17 00:00:00 2001 From: "hausmann@webkit.org" Date: Tue, 5 May 2009 08:24:13 +0000 Subject: [PATCH] 2009-05-04 Jakub Wieczorek Reviewed by Simon Hausmann. As Qtish implementation of MIMETypeRegistry::getMIMETypeForExtension() returns the application/octet-stream mimetype when it can't associate extension with any mimetype, it can happen that the application/octet-stream mimetype will hit the list of supported image formats. For instance, it is possible when QImageReader or QImageWriter support an extension that is not in the extensions map. Make sure that this mimetype is not treated as displayable image type. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@43214 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- WebCore/ChangeLog | 17 +++++++++++++++++ WebCore/platform/MIMETypeRegistry.cpp | 5 +++++ 2 files changed, 22 insertions(+) diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 90a9eb48c92..9c246ccbf2f 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,20 @@ +2009-05-04 Jakub Wieczorek + + Reviewed by Simon Hausmann. + + As Qtish implementation of MIMETypeRegistry::getMIMETypeForExtension() + returns the application/octet-stream mimetype when it can't associate + extension with any mimetype, it can happen that the application/octet-stream + mimetype will hit the list of supported image formats. For instance, + it is possible when QImageReader or QImageWriter support an extension + that is not in the extensions map. + + Make sure that this mimetype is not treated as displayable image type. + + * platform/MIMETypeRegistry.cpp: + (WebCore::initializeSupportedImageMIMETypes): + (WebCore::initializeSupportedImageMIMETypesForEncoding): + 2009-05-03 Eric Seidel Reviewed by Simon Fraser. diff --git a/WebCore/platform/MIMETypeRegistry.cpp b/WebCore/platform/MIMETypeRegistry.cpp index 8f987357fea..a85d706b642 100644 --- a/WebCore/platform/MIMETypeRegistry.cpp +++ b/WebCore/platform/MIMETypeRegistry.cpp @@ -100,6 +100,9 @@ static void initializeSupportedImageMIMETypes() supportedImageMIMETypes->add(mimeType); supportedImageResourceMIMETypes->add(mimeType); } + + supportedImageMIMETypes->remove("application/octet-stream"); + supportedImageResourceMIMETypes->remove("application/octet-stream"); #else // assume that all implementations at least support the following standard // image types: @@ -145,6 +148,8 @@ static void initializeSupportedImageMIMETypesForEncoding() String mimeType = MIMETypeRegistry::getMIMETypeForExtension(formats.at(i).constData()); supportedImageMIMETypesForEncoding->add(mimeType); } + + supportedImageMIMETypesForEncoding->remove("application/octet-stream"); #elif PLATFORM(CAIRO) supportedImageMIMETypesForEncoding->add("image/png"); #endif -- GitLab