diff options
author | cybai <cyb.ai.815@gmail.com> | 2023-04-17 17:07:17 +0900 |
---|---|---|
committer | cybai <cyb.ai.815@gmail.com> | 2023-04-27 14:18:36 +0900 |
commit | 7c9c786053da4801000a07c9fc4c9f10b7504cb2 (patch) | |
tree | f8bbd3763e2946a73365bb088ea3dd31a64f8bc6 /components/script/dom/response.rs | |
parent | 7eca93bb7a1f5a87e50a5fadcd16adbfb79d566e (diff) | |
download | servo-7c9c786053da4801000a07c9fc4c9f10b7504cb2.tar.gz servo-7c9c786053da4801000a07c9fc4c9f10b7504cb2.zip |
Reset to in-memory stream with empty byte sequence for None init body
Because the response body stream is initialized with FetchResponse, it
cannot be processed with in-memory empty sequence. Thus, instead of
using the FetchResponse stream, we'll reset it to Memory body stream
with empty byte sequence if there's no init body.
Diffstat (limited to 'components/script/dom/response.rs')
-rw-r--r-- | components/script/dom/response.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/components/script/dom/response.rs b/components/script/dom/response.rs index 11f51b75414..d7e4486afd5 100644 --- a/components/script/dom/response.rs +++ b/components/script/dom/response.rs @@ -144,6 +144,11 @@ impl Response { )?; } }; + } else { + // Reset FetchResponse to an in-memory stream with empty byte sequence here for + // no-init-body case + let stream = ReadableStream::new_from_bytes(&global, Vec::with_capacity(0)); + r.body_stream.set(Some(&*stream)); } Ok(r) |