Title: [269875] trunk
Revision
269875
Author
[email protected]
Date
2020-11-16 13:45:15 -0800 (Mon, 16 Nov 2020)

Log Message

FileReaderLoader::convertToDataURL should use application/octet-stream if MIME type is empty
https://bugs.webkit.org/show_bug.cgi?id=218993

Patch by Alex Christensen <[email protected]> on 2020-11-16
Reviewed by Geoffrey Garen.

LayoutTests/imported/w3c:

* web-platform-tests/FileAPI/reading-data-section/filereader_readAsDataURL-expected.txt:

Source/WebCore:

This matches Chrome and Firefox, and is covered by a web platform test.

* fileapi/FileReaderLoader.cpp:
(WebCore::FileReaderLoader::convertToDataURL):

LayoutTests:

* fast/files/read-blob-async-expected.txt:
* fast/files/workers/worker-read-blob-async-expected.txt:
* fast/files/workers/worker-read-blob-sync-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (269874 => 269875)


--- trunk/LayoutTests/ChangeLog	2020-11-16 21:27:11 UTC (rev 269874)
+++ trunk/LayoutTests/ChangeLog	2020-11-16 21:45:15 UTC (rev 269875)
@@ -1,3 +1,14 @@
+2020-11-16  Alex Christensen  <[email protected]>
+
+        FileReaderLoader::convertToDataURL should use application/octet-stream if MIME type is empty
+        https://bugs.webkit.org/show_bug.cgi?id=218993
+
+        Reviewed by Geoffrey Garen.
+
+        * fast/files/read-blob-async-expected.txt:
+        * fast/files/workers/worker-read-blob-async-expected.txt:
+        * fast/files/workers/worker-read-blob-sync-expected.txt:
+
 2020-11-13  Ryan Haddad  <[email protected]>
 
         Unreviewed test gardening, land expectations for rdar://71039166.

Modified: trunk/LayoutTests/fast/files/read-blob-async-expected.txt (269874 => 269875)


--- trunk/LayoutTests/fast/files/read-blob-async-expected.txt	2020-11-16 21:27:11 UTC (rev 269874)
+++ trunk/LayoutTests/fast/files/read-blob-async-expected.txt	2020-11-16 21:45:15 UTC (rev 269875)
@@ -64,8 +64,8 @@
 readyState: 1
 Received load event
 readyState: 2
-result size: 21
-result: data:;base64,Rmlyc3Q=
+result size: 45
+result: data:application/octet-stream;base64,Rmlyc3Q=
 Received loadend event
 Test reading a blob containing single text as data URL (optional content type provided)
 readyState: 0

Modified: trunk/LayoutTests/fast/files/workers/worker-read-blob-async-expected.txt (269874 => 269875)


--- trunk/LayoutTests/fast/files/workers/worker-read-blob-async-expected.txt	2020-11-16 21:27:11 UTC (rev 269874)
+++ trunk/LayoutTests/fast/files/workers/worker-read-blob-async-expected.txt	2020-11-16 21:45:15 UTC (rev 269875)
@@ -65,8 +65,8 @@
 readyState: 1
 Received load event
 readyState: 2
-result size: 21
-result: data:;base64,Rmlyc3Q=
+result size: 45
+result: data:application/octet-stream;base64,Rmlyc3Q=
 Received loadend event
 Test reading a blob containing single text as data URL (optional content type provided)
 readyState: 0

Modified: trunk/LayoutTests/fast/files/workers/worker-read-blob-sync-expected.txt (269874 => 269875)


--- trunk/LayoutTests/fast/files/workers/worker-read-blob-sync-expected.txt	2020-11-16 21:27:11 UTC (rev 269874)
+++ trunk/LayoutTests/fast/files/workers/worker-read-blob-sync-expected.txt	2020-11-16 21:45:15 UTC (rev 269875)
@@ -27,8 +27,8 @@
 result: First
 Received exception undefined: TypeError
 Test reading a blob containing single text as data URL
-result size: 21
-result: data:;base64,Rmlyc3Q=
+result size: 45
+result: data:application/octet-stream;base64,Rmlyc3Q=
 Received exception undefined: TypeError
 Test reading a blob containing single text as data URL (optional content type provided)
 result size: 29

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (269874 => 269875)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-11-16 21:27:11 UTC (rev 269874)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-11-16 21:45:15 UTC (rev 269875)
@@ -1,3 +1,12 @@
+2020-11-16  Alex Christensen  <[email protected]>
+
+        FileReaderLoader::convertToDataURL should use application/octet-stream if MIME type is empty
+        https://bugs.webkit.org/show_bug.cgi?id=218993
+
+        Reviewed by Geoffrey Garen.
+
+        * web-platform-tests/FileAPI/reading-data-section/filereader_readAsDataURL-expected.txt:
+
 2020-11-16  Yusuke Suzuki  <[email protected]>
 
         Import latest wpt/wasm tests

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/reading-data-section/filereader_readAsDataURL-expected.txt (269874 => 269875)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/reading-data-section/filereader_readAsDataURL-expected.txt	2020-11-16 21:27:11 UTC (rev 269874)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/reading-data-section/filereader_readAsDataURL-expected.txt	2020-11-16 21:45:15 UTC (rev 269875)
@@ -1,5 +1,5 @@
 
 PASS FileReader readyState during readAsDataURL
 PASS readAsDataURL result for Blob with specified MIME type
-FAIL readAsDataURL result for Blob with unspecified MIME type assert_equals: expected "data:application/octet-stream;base64,VEVTVA==" but got "data:;base64,VEVTVA=="
+PASS readAsDataURL result for Blob with unspecified MIME type
 

Modified: trunk/Source/WebCore/ChangeLog (269874 => 269875)


--- trunk/Source/WebCore/ChangeLog	2020-11-16 21:27:11 UTC (rev 269874)
+++ trunk/Source/WebCore/ChangeLog	2020-11-16 21:45:15 UTC (rev 269875)
@@ -1,3 +1,15 @@
+2020-11-16  Alex Christensen  <[email protected]>
+
+        FileReaderLoader::convertToDataURL should use application/octet-stream if MIME type is empty
+        https://bugs.webkit.org/show_bug.cgi?id=218993
+
+        Reviewed by Geoffrey Garen.
+
+        This matches Chrome and Firefox, and is covered by a web platform test.
+
+        * fileapi/FileReaderLoader.cpp:
+        (WebCore::FileReaderLoader::convertToDataURL):
+
 2020-11-16  Megan Gardner  <[email protected]>
 
         Speculative fix for localizableStrings.string in WebCore

Modified: trunk/Source/WebCore/fileapi/FileReaderLoader.cpp (269874 => 269875)


--- trunk/Source/WebCore/fileapi/FileReaderLoader.cpp	2020-11-16 21:27:11 UTC (rev 269874)
+++ trunk/Source/WebCore/fileapi/FileReaderLoader.cpp	2020-11-16 21:45:15 UTC (rev 269875)
@@ -346,7 +346,10 @@
         return;
     }
 
-    builder.append(m_dataType);
+    if (m_dataType.isEmpty())
+        builder.append("application/octet-stream");
+    else
+        builder.append(m_dataType);
     builder.appendLiteral(";base64,");
 
     Vector<char> out;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to