Title: [255011] branches/safari-609-branch
Revision
255011
Author
[email protected]
Date
2020-01-23 13:43:37 -0800 (Thu, 23 Jan 2020)

Log Message

Cherry-pick r254541. rdar://problem/58605951

    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'.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-609-branch/LayoutTests/ChangeLog (255010 => 255011)


--- branches/safari-609-branch/LayoutTests/ChangeLog	2020-01-23 21:43:34 UTC (rev 255010)
+++ branches/safari-609-branch/LayoutTests/ChangeLog	2020-01-23 21:43:37 UTC (rev 255011)
@@ -1,5 +1,44 @@
 2020-01-23  Russell Epstein  <[email protected]>
 
+        Cherry-pick r254541. rdar://problem/58605951
+
+    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'.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254541 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-23  Russell Epstein  <[email protected]>
+
         Cherry-pick r254530. rdar://problem/58606272
 
     [iOS] fast/forms/contenteditable-font-optical-size.html landed flaky

Added: branches/safari-609-branch/LayoutTests/fast/canvas/toDataURL-unsupportedTypes-expected.txt (0 => 255011)


--- branches/safari-609-branch/LayoutTests/fast/canvas/toDataURL-unsupportedTypes-expected.txt	                        (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/canvas/toDataURL-unsupportedTypes-expected.txt	2020-01-23 21:43:37 UTC (rev 255011)
@@ -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: branches/safari-609-branch/LayoutTests/fast/canvas/toDataURL-unsupportedTypes.html (0 => 255011)


--- branches/safari-609-branch/LayoutTests/fast/canvas/toDataURL-unsupportedTypes.html	                        (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/canvas/toDataURL-unsupportedTypes.html	2020-01-23 21:43:37 UTC (rev 255011)
@@ -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: branches/safari-609-branch/Source/WebCore/ChangeLog (255010 => 255011)


--- branches/safari-609-branch/Source/WebCore/ChangeLog	2020-01-23 21:43:34 UTC (rev 255010)
+++ branches/safari-609-branch/Source/WebCore/ChangeLog	2020-01-23 21:43:37 UTC (rev 255011)
@@ -1,5 +1,48 @@
 2020-01-23  Russell Epstein  <[email protected]>
 
+        Cherry-pick r254541. rdar://problem/58605951
+
+    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'.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254541 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-23  Russell Epstein  <[email protected]>
+
         Cherry-pick r254512. rdar://problem/58606195
 
     A video element cannot enter fullscreen from PiP mode

Modified: branches/safari-609-branch/Source/WebCore/platform/MIMETypeRegistry.cpp (255010 => 255011)


--- branches/safari-609-branch/Source/WebCore/platform/MIMETypeRegistry.cpp	2020-01-23 21:43:34 UTC (rev 255010)
+++ branches/safari-609-branch/Source/WebCore/platform/MIMETypeRegistry.cpp	2020-01-23 21:43:37 UTC (rev 255011)
@@ -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

Reply via email to