Title: [292011] branches/safari-613.2.4.1-branch
Revision
292011
Author
alanc...@apple.com
Date
2022-03-28 17:13:13 -0700 (Mon, 28 Mar 2022)

Log Message

Cherry-pick r291622. rdar://problem/90935942

    Fetching a Blob URL with an unbounded Range header do not generate a Content-Range response header
    https://bugs.webkit.org/show_bug.cgi?id=238170

    Reviewed by Eric Carlson.

    Source/WebCore:

    Test: fetch/fetch-blob-unbounded-range.html

    Handle the case where the request contains an unbounded range, and property calculate the rangeEnd
    to pass into ParsedContentRange.

    * platform/network/BlobResourceHandle.cpp:
    (WebCore::BlobResourceHandle::notifyResponseOnSuccess):

    Source/WebKit:

    Handle the case where the request contains an unbounded range, and property calculate the rangeEnd
    to pass into ParsedContentRange.

    * NetworkProcess/NetworkDataTaskBlob.cpp:
    (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):

    LayoutTests:

    * fetch/fetch-blob-unbounded-range-expected.txt: Added.
    * fetch/fetch-blob-unbounded-range.html: Added.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-613.2.4.1-branch/LayoutTests/ChangeLog (292010 => 292011)


--- branches/safari-613.2.4.1-branch/LayoutTests/ChangeLog	2022-03-29 00:00:29 UTC (rev 292010)
+++ branches/safari-613.2.4.1-branch/LayoutTests/ChangeLog	2022-03-29 00:13:13 UTC (rev 292011)
@@ -1,3 +1,48 @@
+2022-03-28  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r291622. rdar://problem/90935942
+
+    Fetching a Blob URL with an unbounded Range header do not generate a Content-Range response header
+    https://bugs.webkit.org/show_bug.cgi?id=238170
+    
+    Reviewed by Eric Carlson.
+    
+    Source/WebCore:
+    
+    Test: fetch/fetch-blob-unbounded-range.html
+    
+    Handle the case where the request contains an unbounded range, and property calculate the rangeEnd
+    to pass into ParsedContentRange.
+    
+    * platform/network/BlobResourceHandle.cpp:
+    (WebCore::BlobResourceHandle::notifyResponseOnSuccess):
+    
+    Source/WebKit:
+    
+    Handle the case where the request contains an unbounded range, and property calculate the rangeEnd
+    to pass into ParsedContentRange.
+    
+    * NetworkProcess/NetworkDataTaskBlob.cpp:
+    (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):
+    
+    LayoutTests:
+    
+    * fetch/fetch-blob-unbounded-range-expected.txt: Added.
+    * fetch/fetch-blob-unbounded-range.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291622 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-22  Jer Noble  <jer.no...@apple.com>
+
+            Fetching a Blob URL with an unbounded Range header do not generate a Content-Range response header
+            https://bugs.webkit.org/show_bug.cgi?id=238170
+
+            Reviewed by Eric Carlson.
+
+            * fetch/fetch-blob-unbounded-range-expected.txt: Added.
+            * fetch/fetch-blob-unbounded-range.html: Added.
+
 2022-03-21  Alan Coon  <alanc...@apple.com>
 
         Cherry-pick r291330. rdar://problem/90320701

Added: branches/safari-613.2.4.1-branch/LayoutTests/fetch/fetch-blob-unbounded-range-expected.txt (0 => 292011)


--- branches/safari-613.2.4.1-branch/LayoutTests/fetch/fetch-blob-unbounded-range-expected.txt	                        (rev 0)
+++ branches/safari-613.2.4.1-branch/LayoutTests/fetch/fetch-blob-unbounded-range-expected.txt	2022-03-29 00:13:13 UTC (rev 292011)
@@ -0,0 +1,4 @@
+
+PASS Bounded range request
+PASS Unbounded range request
+

Added: branches/safari-613.2.4.1-branch/LayoutTests/fetch/fetch-blob-unbounded-range.html (0 => 292011)


--- branches/safari-613.2.4.1-branch/LayoutTests/fetch/fetch-blob-unbounded-range.html	                        (rev 0)
+++ branches/safari-613.2.4.1-branch/LayoutTests/fetch/fetch-blob-unbounded-range.html	2022-03-29 00:13:13 UTC (rev 292011)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<script src=''></script>
+<script src=''></script>
+<script>
+
+let buffer = Uint8Array.from([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
+let blob = new Blob([buffer]);
+let blobURL = URL.createObjectURL(blob);
+
+promise_test(async () => {
+    let response = await fetch(blobURL, {headers: new Headers({'Range': 'bytes=0-1'})});
+    assert_equals(response.status, 206);
+    assert_equals(response.headers.get('Content-Length'), '2');
+    assert_equals(response.headers.get('Content-Range'), 'bytes 0-1/10');
+}, "Bounded range request");
+
+promise_test(async () => {
+    let response = await fetch(blobURL, {headers: new Headers({'Range': 'bytes=8-'})});
+    assert_equals(response.status, 206);
+    assert_equals(response.headers.get('Content-Length'), '2');
+    assert_equals(response.headers.get('Content-Range'), 'bytes 8-9/10');
+}, "Unbounded range request");
+
+</script>

Modified: branches/safari-613.2.4.1-branch/Source/WebCore/ChangeLog (292010 => 292011)


--- branches/safari-613.2.4.1-branch/Source/WebCore/ChangeLog	2022-03-29 00:00:29 UTC (rev 292010)
+++ branches/safari-613.2.4.1-branch/Source/WebCore/ChangeLog	2022-03-29 00:13:13 UTC (rev 292011)
@@ -1,3 +1,53 @@
+2022-03-28  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r291622. rdar://problem/90935942
+
+    Fetching a Blob URL with an unbounded Range header do not generate a Content-Range response header
+    https://bugs.webkit.org/show_bug.cgi?id=238170
+    
+    Reviewed by Eric Carlson.
+    
+    Source/WebCore:
+    
+    Test: fetch/fetch-blob-unbounded-range.html
+    
+    Handle the case where the request contains an unbounded range, and property calculate the rangeEnd
+    to pass into ParsedContentRange.
+    
+    * platform/network/BlobResourceHandle.cpp:
+    (WebCore::BlobResourceHandle::notifyResponseOnSuccess):
+    
+    Source/WebKit:
+    
+    Handle the case where the request contains an unbounded range, and property calculate the rangeEnd
+    to pass into ParsedContentRange.
+    
+    * NetworkProcess/NetworkDataTaskBlob.cpp:
+    (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):
+    
+    LayoutTests:
+    
+    * fetch/fetch-blob-unbounded-range-expected.txt: Added.
+    * fetch/fetch-blob-unbounded-range.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291622 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-22  Jer Noble  <jer.no...@apple.com>
+
+            Fetching a Blob URL with an unbounded Range header do not generate a Content-Range response header
+            https://bugs.webkit.org/show_bug.cgi?id=238170
+
+            Reviewed by Eric Carlson.
+
+            Test: fetch/fetch-blob-unbounded-range.html
+
+            Handle the case where the request contains an unbounded range, and property calculate the rangeEnd
+            to pass into ParsedContentRange.
+
+            * platform/network/BlobResourceHandle.cpp:
+            (WebCore::BlobResourceHandle::notifyResponseOnSuccess):
+
 2022-03-22  Alex Christensen  <achristen...@webkit.org>
 
         Fix build on safari-613-branch

Modified: branches/safari-613.2.4.1-branch/Source/WebCore/platform/network/BlobResourceHandle.cpp (292010 => 292011)


--- branches/safari-613.2.4.1-branch/Source/WebCore/platform/network/BlobResourceHandle.cpp	2022-03-29 00:00:29 UTC (rev 292010)
+++ branches/safari-613.2.4.1-branch/Source/WebCore/platform/network/BlobResourceHandle.cpp	2022-03-29 00:13:13 UTC (rev 292011)
@@ -579,8 +579,13 @@
     addCrossOriginOpenerPolicyHeaders(response, m_blobData->policyContainer().crossOriginOpenerPolicy);
     addCrossOriginEmbedderPolicyHeaders(response, m_blobData->policyContainer().crossOriginEmbedderPolicy);
 
-    if (isRangeRequest)
-        response.setHTTPHeaderField(HTTPHeaderName::ContentRange, ParsedContentRange(m_rangeOffset, m_rangeEnd, m_totalSize).headerValue());
+    if (isRangeRequest) {
+        auto rangeEnd = m_rangeEnd;
+        if (rangeEnd == kPositionNotSpecified)
+            rangeEnd = m_totalSize - 1;
+
+        response.setHTTPHeaderField(HTTPHeaderName::ContentRange, ParsedContentRange(m_rangeOffset, rangeEnd, m_totalSize).headerValue());
+    }
     // FIXME: If a resource identified with a blob: URL is a File object, user agents must use that file's name attribute,
     // as if the response had a Content-Disposition header with the filename parameter set to the File's name attribute.
     // Notably, this will affect a name suggested in "File Save As".

Modified: branches/safari-613.2.4.1-branch/Source/WebKit/ChangeLog (292010 => 292011)


--- branches/safari-613.2.4.1-branch/Source/WebKit/ChangeLog	2022-03-29 00:00:29 UTC (rev 292010)
+++ branches/safari-613.2.4.1-branch/Source/WebKit/ChangeLog	2022-03-29 00:13:13 UTC (rev 292011)
@@ -1,3 +1,51 @@
+2022-03-28  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r291622. rdar://problem/90935942
+
+    Fetching a Blob URL with an unbounded Range header do not generate a Content-Range response header
+    https://bugs.webkit.org/show_bug.cgi?id=238170
+    
+    Reviewed by Eric Carlson.
+    
+    Source/WebCore:
+    
+    Test: fetch/fetch-blob-unbounded-range.html
+    
+    Handle the case where the request contains an unbounded range, and property calculate the rangeEnd
+    to pass into ParsedContentRange.
+    
+    * platform/network/BlobResourceHandle.cpp:
+    (WebCore::BlobResourceHandle::notifyResponseOnSuccess):
+    
+    Source/WebKit:
+    
+    Handle the case where the request contains an unbounded range, and property calculate the rangeEnd
+    to pass into ParsedContentRange.
+    
+    * NetworkProcess/NetworkDataTaskBlob.cpp:
+    (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):
+    
+    LayoutTests:
+    
+    * fetch/fetch-blob-unbounded-range-expected.txt: Added.
+    * fetch/fetch-blob-unbounded-range.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291622 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-22  Jer Noble  <jer.no...@apple.com>
+
+            Fetching a Blob URL with an unbounded Range header do not generate a Content-Range response header
+            https://bugs.webkit.org/show_bug.cgi?id=238170
+
+            Reviewed by Eric Carlson.
+
+            Handle the case where the request contains an unbounded range, and property calculate the rangeEnd
+            to pass into ParsedContentRange.
+
+            * NetworkProcess/NetworkDataTaskBlob.cpp:
+            (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):
+
 2022-03-25  Alex Christensen  <achristen...@webkit.org>
 
         Cherry pick r289026

Modified: branches/safari-613.2.4.1-branch/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.cpp (292010 => 292011)


--- branches/safari-613.2.4.1-branch/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.cpp	2022-03-29 00:00:29 UTC (rev 292010)
+++ branches/safari-613.2.4.1-branch/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.cpp	2022-03-29 00:13:13 UTC (rev 292011)
@@ -270,8 +270,13 @@
         addCrossOriginOpenerPolicyHeaders(response, m_blobData->policyContainer().crossOriginOpenerPolicy);
         addCrossOriginEmbedderPolicyHeaders(response, m_blobData->policyContainer().crossOriginEmbedderPolicy);
 
-        if (isRangeRequest)
-            response.setHTTPHeaderField(HTTPHeaderName::ContentRange, ParsedContentRange(m_rangeOffset, m_rangeEnd, m_totalSize).headerValue());
+        if (isRangeRequest) {
+            auto rangeEnd = m_rangeEnd;
+            if (rangeEnd == kPositionNotSpecified)
+                rangeEnd = m_totalSize - 1;
+
+            response.setHTTPHeaderField(HTTPHeaderName::ContentRange, ParsedContentRange(m_rangeOffset, rangeEnd, m_totalSize).headerValue());
+        }
         // FIXME: If a resource identified with a blob: URL is a File object, user agents must use that file's name attribute,
         // as if the response had a Content-Disposition header with the filename parameter set to the File's name attribute.
         // Notably, this will affect a name suggested in "File Save As".
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to