2007-11-06 Rodney Dawes <dobey@wayofthemonkey.com>
authormrowe@apple.com <mrowe@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Nov 2007 00:02:04 +0000 (00:02 +0000)
committermrowe@apple.com <mrowe@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Nov 2007 00:02:04 +0000 (00:02 +0000)
        Fix http://bugs.webkit.org/attachment.cgi?id=17043&action=view
        Bug 15766: [GTK] WebKit sometimes spews binary data as text/plain into iframes

        FrameLoaderClient::objectContentType needs to check with the MIMETypeRegistry
        to determine whether the given MIME type is displayable as an image or non-image.

        * WebCoreSupport/FrameLoaderClientGtk.cpp:
        (FrameLoaderClient::objectContentType): Change logic to match that in
        the Windows and Mac ports.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27491 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/gtk/ChangeLog
WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp

index e94d389f4f63a1ac8dfe2c286f858c533d311d11..ee711df6034b20a1dcfa40184a91bddace34be0b 100644 (file)
@@ -1,3 +1,15 @@
+2007-11-06  Rodney Dawes  <dobey@wayofthemonkey.com>
+
+        Fix http://bugs.webkit.org/attachment.cgi?id=17043&action=view
+        Bug 15766: [GTK] WebKit sometimes spews binary data as text/plain into iframes
+
+        FrameLoaderClient::objectContentType needs to check with the MIMETypeRegistry
+        to determine whether the given MIME type is displayable as an image or non-image.
+
+        * WebCoreSupport/FrameLoaderClientGtk.cpp:
+        (FrameLoaderClient::objectContentType): Change logic to match that in
+        the Windows and Mac ports.
+
 2007-11-05  Christian Dywan  <christian@twotoasts.de>
 
         Reviewed by Maciej.
index defabc8f5fbf7f99771ce40fffe93e427138729d..e21c7d81eb8533153c42531980b478a1d746f7e0 100644 (file)
@@ -300,14 +300,20 @@ Widget* FrameLoaderClient::createJavaAppletWidget(const IntSize&, Element*, cons
 
 ObjectContentType FrameLoaderClient::objectContentType(const KURL& url, const String& mimeType)
 {
-    if (url.isEmpty())
-        return ObjectContentType();
-
-    // TODO: use more than just the extension to determine the content type?
-    String rtype = MIMETypeRegistry::getMIMETypeForPath(url.path());
-    if (!rtype.isEmpty())
-        return ObjectContentFrame;
-    return ObjectContentType();
+    String type = mimeType;
+    if (type.isEmpty())
+        type = MIMETypeRegistry::getMIMETypeForExtension(url.path().mid(url.path().findRev('.') + 1));
+
+    if (type.isEmpty())
+        return WebCore::ObjectContentFrame;
+
+    if (MIMETypeRegistry::isSupportedImageMIMEType(type))
+        return WebCore::ObjectContentImage;
+
+    if (MIMETypeRegistry::isSupportedNonImageMIMEType(type))
+        return WebCore::ObjectContentFrame;
+
+    return WebCore::ObjectContentNone;
 }
 
 String FrameLoaderClient::overrideMediaType() const