Title: [149466] trunk
Revision
149466
Author
timothy_hor...@apple.com
Date
2013-05-01 17:15:28 -0700 (Wed, 01 May 2013)

Log Message

<object data="" data URL>"> MIME types aren't case-insensitive
https://bugs.webkit.org/show_bug.cgi?id=115494

Reviewed by Darin Adler.

Test: fast/images/object-data-url-case-insensitivity.html

MIME types are defined to be case-insensitive, but many places in WebCore
only compare them against lower-case strings. Most entry points for MIME
types lower-case them, but mimeTypeFromDataURL doesn't, causing, for example,
data:image/png;... to work, but data:iMaGe/PNG;... to fail.

To fix this, lower-case the string returned from mimeTypeFromDataURL.

* platform/KURL.cpp:
(WebCore::mimeTypeFromDataURL):

Add a testcase that ensures that iMaGe/PNG == image/png when it comes to
the MIME type specified in a data URL provided to <object> via its
'data' attribute.

* fast/images/object-data-url-case-insensitivity-expected.html: Added.
* fast/images/object-data-url-case-insensitivity.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (149465 => 149466)


--- trunk/LayoutTests/ChangeLog	2013-05-02 00:02:29 UTC (rev 149465)
+++ trunk/LayoutTests/ChangeLog	2013-05-02 00:15:28 UTC (rev 149466)
@@ -1,3 +1,17 @@
+2013-05-01  Tim Horton  <timothy_hor...@apple.com>
+
+        <object data="" data URL>"> MIME types aren't case-insensitive
+        https://bugs.webkit.org/show_bug.cgi?id=115494
+
+        Reviewed by Darin Adler.
+
+        Add a testcase that ensures that iMaGe/PNG == image/png when it comes to
+        the MIME type specified in a data URL provided to <object> via its
+        'data' attribute.
+
+        * fast/images/object-data-url-case-insensitivity-expected.html: Added.
+        * fast/images/object-data-url-case-insensitivity.html: Added.
+
 2013-05-01  Hans Muller  <hmul...@adobe.com>
 
         [CSS Exclusions] Programmatic layout tests fail when subpixel layout is disabled

Added: trunk/LayoutTests/fast/images/object-data-url-case-insensitivity-expected.html (0 => 149466)


--- trunk/LayoutTests/fast/images/object-data-url-case-insensitivity-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/images/object-data-url-case-insensitivity-expected.html	2013-05-02 00:15:28 UTC (rev 149466)
@@ -0,0 +1,4 @@
+Should see two green squares if object-tag data="" MIME types are case-insensitive.<br/>
+
+<img width="200" height="200" src=""
+<img width="200" height="200" src=""
\ No newline at end of file

Added: trunk/LayoutTests/fast/images/object-data-url-case-insensitivity.html (0 => 149466)


--- trunk/LayoutTests/fast/images/object-data-url-case-insensitivity.html	                        (rev 0)
+++ trunk/LayoutTests/fast/images/object-data-url-case-insensitivity.html	2013-05-02 00:15:28 UTC (rev 149466)
@@ -0,0 +1,4 @@
+Should see two green squares if object-tag data="" MIME types are case-insensitive.<br/>
+
+<object width="200" height="200" data=""
+<object width="200" height="200" data=""
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (149465 => 149466)


--- trunk/Source/WebCore/ChangeLog	2013-05-02 00:02:29 UTC (rev 149465)
+++ trunk/Source/WebCore/ChangeLog	2013-05-02 00:15:28 UTC (rev 149466)
@@ -1,3 +1,22 @@
+2013-05-01  Tim Horton  <timothy_hor...@apple.com>
+
+        <object data="" data URL>"> MIME types aren't case-insensitive
+        https://bugs.webkit.org/show_bug.cgi?id=115494
+
+        Reviewed by Darin Adler.
+
+        Test: fast/images/object-data-url-case-insensitivity.html
+
+        MIME types are defined to be case-insensitive, but many places in WebCore
+        only compare them against lower-case strings. Most entry points for MIME
+        types lower-case them, but mimeTypeFromDataURL doesn't, causing, for example,
+        data:image/png;... to work, but data:iMaGe/PNG;... to fail.
+
+        To fix this, lower-case the string returned from mimeTypeFromDataURL.
+
+        * platform/KURL.cpp:
+        (WebCore::mimeTypeFromDataURL):
+
 2013-05-01  Ryosuke Niwa  <rn...@webkit.org>
 
         [Mac] Text replacement should use correction indicator

Modified: trunk/Source/WebCore/platform/KURL.cpp (149465 => 149466)


--- trunk/Source/WebCore/platform/KURL.cpp	2013-05-02 00:02:29 UTC (rev 149465)
+++ trunk/Source/WebCore/platform/KURL.cpp	2013-05-02 00:15:28 UTC (rev 149466)
@@ -1889,7 +1889,7 @@
         index = url.find(',');
     if (index != notFound) {
         if (index > 5)
-            return url.substring(5, index - 5);
+            return url.substring(5, index - 5).lower();
         return "text/plain"; // Data URLs with no MIME type are considered text/plain.
     }
     return "";
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to