Title: [236031] trunk
Revision
236031
Author
[email protected]
Date
2018-09-15 07:08:47 -0700 (Sat, 15 Sep 2018)

Log Message

2018-09-15  Rob Buis  <[email protected]>

        XMLHttpRequest::createResponseBlob() should create a Blob with type for empty response
        https://bugs.webkit.org/show_bug.cgi?id=189627

        Reviewed by Alexey Proskuryakov.

        Right now we return an empty Blob without type when the response is empty, but
        it should always include the type [1].

        Test: web-platform-tests/xhr/overridemimetype-blob.html

        [1] https://xhr.spec.whatwg.org/#blob-response

        * xml/XMLHttpRequest.cpp:
        (WebCore::XMLHttpRequest::createResponseBlob):

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (236030 => 236031)


--- trunk/LayoutTests/ChangeLog	2018-09-15 01:20:27 UTC (rev 236030)
+++ trunk/LayoutTests/ChangeLog	2018-09-15 14:08:47 UTC (rev 236031)
@@ -1,3 +1,13 @@
+2018-09-15  Rob Buis  <[email protected]>
+
+        XMLHttpRequest::createResponseBlob() should create a Blob with type for empty response
+        https://bugs.webkit.org/show_bug.cgi?id=189627
+
+        Reviewed by Alexey Proskuryakov.
+
+        * fast/files/xhr-response-blob-expected.txt:
+        * fast/files/xhr-response-blob.html:
+
 2018-09-14  Megan Gardner  <[email protected]>
 
         Additional tests for conic gradients

Modified: trunk/LayoutTests/fast/files/xhr-response-blob-expected.txt (236030 => 236031)


--- trunk/LayoutTests/fast/files/xhr-response-blob-expected.txt	2018-09-15 01:20:27 UTC (rev 236030)
+++ trunk/LayoutTests/fast/files/xhr-response-blob-expected.txt	2018-09-15 14:08:47 UTC (rev 236031)
@@ -16,5 +16,5 @@
 PASS xhr.responseType is "blob"
 PASS xhr.response is null
 PASS xhr.response instanceof Blob is true
-PASS xhr.response.type is ""
+PASS xhr.response.type is "application/octet-stream"
 

Modified: trunk/LayoutTests/fast/files/xhr-response-blob.html (236030 => 236031)


--- trunk/LayoutTests/fast/files/xhr-response-blob.html	2018-09-15 01:20:27 UTC (rev 236030)
+++ trunk/LayoutTests/fast/files/xhr-response-blob.html	2018-09-15 14:08:47 UTC (rev 236031)
@@ -34,7 +34,7 @@
 
 testBlob("resources/UTF8.txt", "text/plain", function() {
     testBlob("resources/does_not_exist.txt", "", function() {
-        testBlob("resources/empty-file", "", function() {
+        testBlob("resources/empty-file", "application/octet-stream", function() {
             if (window.testRunner)
                 testRunner.notifyDone();
         })

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (236030 => 236031)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-09-15 01:20:27 UTC (rev 236030)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-09-15 14:08:47 UTC (rev 236031)
@@ -1,3 +1,12 @@
+2018-09-15  Rob Buis  <[email protected]>
+
+        XMLHttpRequest::createResponseBlob() should create a Blob with type for empty response
+        https://bugs.webkit.org/show_bug.cgi?id=189627
+
+        Reviewed by Alexey Proskuryakov.
+
+        * web-platform-tests/xhr/overridemimetype-blob-expected.txt:
+
 2018-09-14  Ms2ger  <[email protected]>
 
         Remove some obsolete XHR tests

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/overridemimetype-blob-expected.txt (236030 => 236031)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/overridemimetype-blob-expected.txt	2018-09-15 01:20:27 UTC (rev 236030)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/overridemimetype-blob-expected.txt	2018-09-15 14:08:47 UTC (rev 236031)
@@ -1,5 +1,5 @@
 
-FAIL Use text/xml as fallback MIME type assert_equals: expected "text/xml" but got ""
+PASS Use text/xml as fallback MIME type 
 PASS Use text/xml as fallback MIME type, 2 
 FAIL Loading data… promise_test: Unhandled rejection with value: object "TypeError: undefined is not a function (near '...tests.forEach...')"
 

Modified: trunk/Source/WebCore/ChangeLog (236030 => 236031)


--- trunk/Source/WebCore/ChangeLog	2018-09-15 01:20:27 UTC (rev 236030)
+++ trunk/Source/WebCore/ChangeLog	2018-09-15 14:08:47 UTC (rev 236031)
@@ -1,3 +1,20 @@
+2018-09-15  Rob Buis  <[email protected]>
+
+        XMLHttpRequest::createResponseBlob() should create a Blob with type for empty response
+        https://bugs.webkit.org/show_bug.cgi?id=189627
+
+        Reviewed by Alexey Proskuryakov.
+
+        Right now we return an empty Blob without type when the response is empty, but
+        it should always include the type [1].
+
+        Test: web-platform-tests/xhr/overridemimetype-blob.html
+
+        [1] https://xhr.spec.whatwg.org/#blob-response
+
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::createResponseBlob):
+
 2018-09-14  Basuke Suzuki  <[email protected]>
 
         [Curl] Bug fix on some inaccurate values in NetworkLoadMetrics.

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (236030 => 236031)


--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp	2018-09-15 01:20:27 UTC (rev 236030)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp	2018-09-15 14:08:47 UTC (rev 236031)
@@ -220,12 +220,10 @@
     ASSERT(responseType() == ResponseType::Blob);
     ASSERT(doneWithoutErrors());
 
-    if (!m_binaryResponseBuilder)
-        return Blob::create();
-
     // FIXME: We just received the data from NetworkProcess, and are sending it back. This is inefficient.
     Vector<uint8_t> data;
-    data.append(m_binaryResponseBuilder->data(), m_binaryResponseBuilder->size());
+    if (m_binaryResponseBuilder)
+        data.append(m_binaryResponseBuilder->data(), m_binaryResponseBuilder->size());
     m_binaryResponseBuilder = nullptr;
     String normalizedContentType = Blob::normalizedContentType(responseMIMEType()); // responseMIMEType defaults to text/xml which may be incorrect.
     return Blob::create(WTFMove(data), normalizedContentType);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to