Title: [254541] trunk
- Revision
- 254541
- Author
- [email protected]
- Date
- 2020-01-14 15:45:52 -0800 (Tue, 14 Jan 2020)
Log Message
Supported mime types for encoding should be supported mime types for loading
https://bugs.webkit.org/show_bug.cgi?id=206239
Patch by Said Abou-Hallawa <[email protected]> on 2020-01-14
Reviewed by Simon Fraser.
Source/WebCore:
Consult isSupportedImageType() for the system supported UTI before
considering its mime type is allowed for the image DataURL encoding.
Test: fast/canvas/toDataURL-unsupportedTypes.html
* platform/MIMETypeRegistry.cpp:
(WebCore::MIMETypeRegistry::createMIMETypeRegistryThreadGlobalData):
LayoutTests:
* fast/canvas/toDataURL-unsupportedTypes-expected.txt: Added.
* fast/canvas/toDataURL-unsupportedTypes.html: Added.
Unsupported mime-types for encoding should fall back to 'image/png'.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (254540 => 254541)
--- trunk/LayoutTests/ChangeLog 2020-01-14 23:35:46 UTC (rev 254540)
+++ trunk/LayoutTests/ChangeLog 2020-01-14 23:45:52 UTC (rev 254541)
@@ -1,3 +1,14 @@
+2020-01-14 Said Abou-Hallawa <[email protected]>
+
+ Supported mime types for encoding should be supported mime types for loading
+ https://bugs.webkit.org/show_bug.cgi?id=206239
+
+ Reviewed by Simon Fraser.
+
+ * fast/canvas/toDataURL-unsupportedTypes-expected.txt: Added.
+ * fast/canvas/toDataURL-unsupportedTypes.html: Added.
+ Unsupported mime-types for encoding should fall back to 'image/png'.
+
2020-01-14 Myles C. Maxfield <[email protected]>
[Cocoa] Glyph lookup should be language-sensitive (specifically between Yiddish and Hebrew)
Added: trunk/LayoutTests/fast/canvas/toDataURL-unsupportedTypes-expected.txt (0 => 254541)
--- trunk/LayoutTests/fast/canvas/toDataURL-unsupportedTypes-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/toDataURL-unsupportedTypes-expected.txt 2020-01-14 23:45:52 UTC (rev 254541)
@@ -0,0 +1,14 @@
+This is a test of the unsupported mime-types for canvas.toDataURL().
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS canvas.toDataURL('image/heic') is canvas.toDataURL('image/png')
+PASS canvas.toDataURL('image/heic-sequence') is canvas.toDataURL('image/png')
+PASS canvas.toDataURL('image/vnd.adobe.photoshop') is canvas.toDataURL('image/png')
+PASS canvas.toDataURL('application/pdf') is canvas.toDataURL('image/png')
+PASS canvas.toDataURL('image/targa') is canvas.toDataURL('image/png')
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/canvas/toDataURL-unsupportedTypes.html (0 => 254541)
--- trunk/LayoutTests/fast/canvas/toDataURL-unsupportedTypes.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/toDataURL-unsupportedTypes.html 2020-01-14 23:45:52 UTC (rev 254541)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<head>
+ <script src=""
+</head>
+<body>
+ <canvas width="8" height="8"></canvas>
+ <script>
+ var canvas = document.querySelector("canvas");
+ canvas.width = 8;
+ canvas.height = 8;
+
+ description("This is a test of the unsupported mime-types for canvas.toDataURL().");
+ shouldBe("canvas.toDataURL('image/heic')", "canvas.toDataURL('image/png')");
+ shouldBe("canvas.toDataURL('image/heic-sequence')", "canvas.toDataURL('image/png')");
+ shouldBe("canvas.toDataURL('image/vnd.adobe.photoshop')", "canvas.toDataURL('image/png')");
+ shouldBe("canvas.toDataURL('application/pdf')", "canvas.toDataURL('image/png')");
+ shouldBe("canvas.toDataURL('image/targa')", "canvas.toDataURL('image/png')");
+ </script>
+ <script src=""
+</body>
Modified: trunk/Source/WebCore/ChangeLog (254540 => 254541)
--- trunk/Source/WebCore/ChangeLog 2020-01-14 23:35:46 UTC (rev 254540)
+++ trunk/Source/WebCore/ChangeLog 2020-01-14 23:45:52 UTC (rev 254541)
@@ -1,3 +1,18 @@
+2020-01-14 Said Abou-Hallawa <[email protected]>
+
+ Supported mime types for encoding should be supported mime types for loading
+ https://bugs.webkit.org/show_bug.cgi?id=206239
+
+ Reviewed by Simon Fraser.
+
+ Consult isSupportedImageType() for the system supported UTI before
+ considering its mime type is allowed for the image DataURL encoding.
+
+ Test: fast/canvas/toDataURL-unsupportedTypes.html
+
+ * platform/MIMETypeRegistry.cpp:
+ (WebCore::MIMETypeRegistry::createMIMETypeRegistryThreadGlobalData):
+
2020-01-14 Commit Queue <[email protected]>
Unreviewed, rolling out r254533 and r254535.
Modified: trunk/Source/WebCore/platform/MIMETypeRegistry.cpp (254540 => 254541)
--- trunk/Source/WebCore/platform/MIMETypeRegistry.cpp 2020-01-14 23:35:46 UTC (rev 254540)
+++ trunk/Source/WebCore/platform/MIMETypeRegistry.cpp 2020-01-14 23:45:52 UTC (rev 254541)
@@ -446,9 +446,10 @@
CFIndex count = CFArrayGetCount(supportedTypes.get());
for (CFIndex i = 0; i < count; i++) {
CFStringRef supportedType = reinterpret_cast<CFStringRef>(CFArrayGetValueAtIndex(supportedTypes.get(), i));
- String mimeType = MIMETypeForImageType(supportedType);
- if (!mimeType.isEmpty())
+ if (isSupportedImageType(supportedType)) {
+ String mimeType = MIMETypeForImageType(supportedType);
supportedImageMIMETypesForEncoding.add(mimeType);
+ }
}
#else
HashSet<String, ASCIICaseInsensitiveHash> supportedImageMIMETypesForEncoding = std::initializer_list<String> {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes