Diff
Modified: branches/safari-613.1.17.0-branch/LayoutTests/ChangeLog (291972 => 291973)
--- branches/safari-613.1.17.0-branch/LayoutTests/ChangeLog 2022-03-28 17:25:14 UTC (rev 291972)
+++ branches/safari-613.1.17.0-branch/LayoutTests/ChangeLog 2022-03-28 17:29:42 UTC (rev 291973)
@@ -1,3 +1,48 @@
+2022-03-28 Alan Coon <alanc...@apple.com>
+
+ Cherry-pick r291622. rdar://problem/90501108
+
+ 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-02-18 Russell Epstein <repst...@apple.com>
Cherry-pick r290156. rdar://problem/89154452
Added: branches/safari-613.1.17.0-branch/LayoutTests/fetch/fetch-blob-unbounded-range-expected.txt (0 => 291973)
--- branches/safari-613.1.17.0-branch/LayoutTests/fetch/fetch-blob-unbounded-range-expected.txt (rev 0)
+++ branches/safari-613.1.17.0-branch/LayoutTests/fetch/fetch-blob-unbounded-range-expected.txt 2022-03-28 17:29:42 UTC (rev 291973)
@@ -0,0 +1,4 @@
+
+PASS Bounded range request
+PASS Unbounded range request
+
Added: branches/safari-613.1.17.0-branch/LayoutTests/fetch/fetch-blob-unbounded-range.html (0 => 291973)
--- branches/safari-613.1.17.0-branch/LayoutTests/fetch/fetch-blob-unbounded-range.html (rev 0)
+++ branches/safari-613.1.17.0-branch/LayoutTests/fetch/fetch-blob-unbounded-range.html 2022-03-28 17:29:42 UTC (rev 291973)
@@ -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.1.17.0-branch/Source/WebCore/ChangeLog (291972 => 291973)
--- branches/safari-613.1.17.0-branch/Source/WebCore/ChangeLog 2022-03-28 17:25:14 UTC (rev 291972)
+++ branches/safari-613.1.17.0-branch/Source/WebCore/ChangeLog 2022-03-28 17:29:42 UTC (rev 291973)
@@ -1,3 +1,53 @@
+2022-03-28 Alan Coon <alanc...@apple.com>
+
+ Cherry-pick r291622. rdar://problem/90501108
+
+ 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-02-18 Russell Epstein <repst...@apple.com>
Cherry-pick r290152. rdar://problem/88327814
Modified: branches/safari-613.1.17.0-branch/Source/WebCore/platform/network/BlobResourceHandle.cpp (291972 => 291973)
--- branches/safari-613.1.17.0-branch/Source/WebCore/platform/network/BlobResourceHandle.cpp 2022-03-28 17:25:14 UTC (rev 291972)
+++ branches/safari-613.1.17.0-branch/Source/WebCore/platform/network/BlobResourceHandle.cpp 2022-03-28 17:29:42 UTC (rev 291973)
@@ -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.1.17.0-branch/Source/WebKit/ChangeLog (291972 => 291973)
--- branches/safari-613.1.17.0-branch/Source/WebKit/ChangeLog 2022-03-28 17:25:14 UTC (rev 291972)
+++ branches/safari-613.1.17.0-branch/Source/WebKit/ChangeLog 2022-03-28 17:29:42 UTC (rev 291973)
@@ -1,3 +1,51 @@
+2022-03-28 Alan Coon <alanc...@apple.com>
+
+ Cherry-pick r291622. rdar://problem/90501108
+
+ 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-02-17 Russell Epstein <repst...@apple.com>
Cherry-pick r290005. rdar://problem/87596724
Modified: branches/safari-613.1.17.0-branch/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.cpp (291972 => 291973)
--- branches/safari-613.1.17.0-branch/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.cpp 2022-03-28 17:25:14 UTC (rev 291972)
+++ branches/safari-613.1.17.0-branch/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.cpp 2022-03-28 17:29:42 UTC (rev 291973)
@@ -269,8 +269,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".