Skip to content

Commit

Permalink
Auto merge of #29640 - CYBAI:fix-response-empty-init, r=<try>
Browse files Browse the repository at this point in the history
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.

With this PR, we can fix the TIMEOUT in `/fetch/content-type/response.window.html` so I think it should fix #22304.

---

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22304
- [x] There are tests for these changes
  • Loading branch information
bors-servo committed Apr 18, 2023
2 parents 0acc345 + 11b142c commit 708ba3e
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 908 deletions.
5 changes: 5 additions & 0 deletions components/script/dom/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,226 +1,10 @@
[stream-safe-creation.any.html]
expected: TIMEOUT
[throwing Object.prototype.start accessor should not affect stream creation by 'consumeEmptyResponse']
expected: TIMEOUT

[Object.prototype.start accessor returning invalid value should not affect stream creation by 'consumeEmptyResponse']
expected: NOTRUN

[throwing Object.prototype.type accessor should not affect stream creation by 'consumeEmptyResponse']
expected: NOTRUN

[Object.prototype.type accessor returning invalid value should not affect stream creation by 'consumeEmptyResponse']
expected: NOTRUN

[throwing Object.prototype.size accessor should not affect stream creation by 'consumeEmptyResponse']
expected: NOTRUN

[Object.prototype.size accessor returning invalid value should not affect stream creation by 'consumeEmptyResponse']
expected: NOTRUN

[throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'consumeEmptyResponse']
expected: NOTRUN

[Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'consumeEmptyResponse']
expected: NOTRUN

[Object.prototype.start function which errors the stream should not affect stream creation by 'consumeEmptyResponse']
expected: NOTRUN

[throwing Object.prototype.start accessor should not affect stream creation by 'consumeNonEmptyResponse']
expected: NOTRUN

[Object.prototype.start accessor returning invalid value should not affect stream creation by 'consumeNonEmptyResponse']
expected: NOTRUN

[throwing Object.prototype.type accessor should not affect stream creation by 'consumeNonEmptyResponse']
expected: NOTRUN

[Object.prototype.type accessor returning invalid value should not affect stream creation by 'consumeNonEmptyResponse']
expected: NOTRUN

[throwing Object.prototype.size accessor should not affect stream creation by 'consumeNonEmptyResponse']
expected: NOTRUN

[Object.prototype.size accessor returning invalid value should not affect stream creation by 'consumeNonEmptyResponse']
expected: NOTRUN

[throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'consumeNonEmptyResponse']
expected: NOTRUN

[Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'consumeNonEmptyResponse']
expected: NOTRUN

[Object.prototype.start function which errors the stream should not affect stream creation by 'consumeNonEmptyResponse']
expected: NOTRUN

[throwing Object.prototype.start accessor should not affect stream creation by 'consumeEmptyRequest']
expected: NOTRUN

[Object.prototype.start accessor returning invalid value should not affect stream creation by 'consumeEmptyRequest']
expected: NOTRUN

[throwing Object.prototype.type accessor should not affect stream creation by 'consumeEmptyRequest']
expected: NOTRUN

[Object.prototype.type accessor returning invalid value should not affect stream creation by 'consumeEmptyRequest']
expected: NOTRUN

[throwing Object.prototype.size accessor should not affect stream creation by 'consumeEmptyRequest']
expected: NOTRUN

[Object.prototype.size accessor returning invalid value should not affect stream creation by 'consumeEmptyRequest']
expected: NOTRUN

[throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'consumeEmptyRequest']
expected: NOTRUN

[Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'consumeEmptyRequest']
expected: NOTRUN

[Object.prototype.start function which errors the stream should not affect stream creation by 'consumeEmptyRequest']
expected: NOTRUN

[throwing Object.prototype.start accessor should not affect stream creation by 'consumeNonEmptyRequest']
expected: NOTRUN

[Object.prototype.start accessor returning invalid value should not affect stream creation by 'consumeNonEmptyRequest']
expected: NOTRUN

[throwing Object.prototype.type accessor should not affect stream creation by 'consumeNonEmptyRequest']
expected: NOTRUN

[Object.prototype.type accessor returning invalid value should not affect stream creation by 'consumeNonEmptyRequest']
expected: NOTRUN

[throwing Object.prototype.size accessor should not affect stream creation by 'consumeNonEmptyRequest']
expected: NOTRUN

[Object.prototype.size accessor returning invalid value should not affect stream creation by 'consumeNonEmptyRequest']
expected: NOTRUN

[throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'consumeNonEmptyRequest']
expected: NOTRUN

[Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'consumeNonEmptyRequest']
expected: NOTRUN

[Object.prototype.start function which errors the stream should not affect stream creation by 'consumeNonEmptyRequest']
expected: NOTRUN


[stream-safe-creation.any.serviceworker.html]
expected: ERROR
[stream-safe-creation]
expected: FAIL


[stream-safe-creation.any.sharedworker.html]
expected: ERROR

[stream-safe-creation.any.worker.html]
expected: TIMEOUT
[throwing Object.prototype.start accessor should not affect stream creation by 'consumeEmptyResponse']
expected: TIMEOUT

[Object.prototype.start accessor returning invalid value should not affect stream creation by 'consumeEmptyResponse']
expected: NOTRUN

[throwing Object.prototype.type accessor should not affect stream creation by 'consumeEmptyResponse']
expected: NOTRUN

[Object.prototype.type accessor returning invalid value should not affect stream creation by 'consumeEmptyResponse']
expected: NOTRUN

[throwing Object.prototype.size accessor should not affect stream creation by 'consumeEmptyResponse']
expected: NOTRUN

[Object.prototype.size accessor returning invalid value should not affect stream creation by 'consumeEmptyResponse']
expected: NOTRUN

[throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'consumeEmptyResponse']
expected: NOTRUN

[Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'consumeEmptyResponse']
expected: NOTRUN

[Object.prototype.start function which errors the stream should not affect stream creation by 'consumeEmptyResponse']
expected: NOTRUN

[throwing Object.prototype.start accessor should not affect stream creation by 'consumeNonEmptyResponse']
expected: NOTRUN

[Object.prototype.start accessor returning invalid value should not affect stream creation by 'consumeNonEmptyResponse']
expected: NOTRUN

[throwing Object.prototype.type accessor should not affect stream creation by 'consumeNonEmptyResponse']
expected: NOTRUN

[Object.prototype.type accessor returning invalid value should not affect stream creation by 'consumeNonEmptyResponse']
expected: NOTRUN

[throwing Object.prototype.size accessor should not affect stream creation by 'consumeNonEmptyResponse']
expected: NOTRUN

[Object.prototype.size accessor returning invalid value should not affect stream creation by 'consumeNonEmptyResponse']
expected: NOTRUN

[throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'consumeNonEmptyResponse']
expected: NOTRUN

[Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'consumeNonEmptyResponse']
expected: NOTRUN

[Object.prototype.start function which errors the stream should not affect stream creation by 'consumeNonEmptyResponse']
expected: NOTRUN

[throwing Object.prototype.start accessor should not affect stream creation by 'consumeEmptyRequest']
expected: NOTRUN

[Object.prototype.start accessor returning invalid value should not affect stream creation by 'consumeEmptyRequest']
expected: NOTRUN

[throwing Object.prototype.type accessor should not affect stream creation by 'consumeEmptyRequest']
expected: NOTRUN

[Object.prototype.type accessor returning invalid value should not affect stream creation by 'consumeEmptyRequest']
expected: NOTRUN

[throwing Object.prototype.size accessor should not affect stream creation by 'consumeEmptyRequest']
expected: NOTRUN

[Object.prototype.size accessor returning invalid value should not affect stream creation by 'consumeEmptyRequest']
expected: NOTRUN

[throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'consumeEmptyRequest']
expected: NOTRUN

[Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'consumeEmptyRequest']
expected: NOTRUN

[Object.prototype.start function which errors the stream should not affect stream creation by 'consumeEmptyRequest']
expected: NOTRUN

[throwing Object.prototype.start accessor should not affect stream creation by 'consumeNonEmptyRequest']
expected: NOTRUN

[Object.prototype.start accessor returning invalid value should not affect stream creation by 'consumeNonEmptyRequest']
expected: NOTRUN

[throwing Object.prototype.type accessor should not affect stream creation by 'consumeNonEmptyRequest']
expected: NOTRUN

[Object.prototype.type accessor returning invalid value should not affect stream creation by 'consumeNonEmptyRequest']
expected: NOTRUN

[throwing Object.prototype.size accessor should not affect stream creation by 'consumeNonEmptyRequest']
expected: NOTRUN

[Object.prototype.size accessor returning invalid value should not affect stream creation by 'consumeNonEmptyRequest']
expected: NOTRUN

[throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'consumeNonEmptyRequest']
expected: NOTRUN

[Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'consumeNonEmptyRequest']
expected: NOTRUN

[Object.prototype.start function which errors the stream should not affect stream creation by 'consumeNonEmptyRequest']
expected: NOTRUN
[stream-safe-creation]
expected: FAIL
Original file line number Diff line number Diff line change
Expand Up @@ -5,91 +5,52 @@
expected: ERROR

[response-consume-empty.any.worker.html]
expected: TIMEOUT
[Consume response's body as text]
expected: TIMEOUT
expected: FAIL
[Consume response's body as json (error case)]
expected: NOTRUN
expected: FAIL

[Consume response's body as blob]
expected: NOTRUN
[Consume empty URLSearchParams response body as text]
expected: NOTRUN
expected: FAIL
[Consume response's body as formData without correct type (error case)]
expected: NOTRUN

[Consume empty blob response body as text]
expected: NOTRUN

[Consume empty text response body as arrayBuffer]
expected: NOTRUN

[Consume empty text response body as text]
expected: NOTRUN

[Consume empty blob response body as arrayBuffer]
expected: NOTRUN
expected: FAIL

[Consume response's body as arrayBuffer]
expected: NOTRUN
expected: FAIL
[Consume empty FormData response body as text]
expected: NOTRUN
expected: FAIL
[Consume response's body as formData with correct multipart type (error case)]
expected: NOTRUN
expected: FAIL

[Consume response's body as formData with correct urlencoded type]
expected: NOTRUN
[Consume empty ArrayBuffer response body as text]
expected: NOTRUN
expected: FAIL
[response-consume-empty.any.html]
expected: TIMEOUT
[Consume response's body as text]
expected: TIMEOUT
expected: FAIL

[Consume response's body as json (error case)]
expected: NOTRUN
expected: FAIL
[Consume response's body as blob]
expected: NOTRUN

[Consume empty URLSearchParams response body as text]
expected: NOTRUN
expected: FAIL

[Consume response's body as formData without correct type (error case)]
expected: NOTRUN
[Consume empty blob response body as text]
expected: NOTRUN
[Consume empty text response body as arrayBuffer]
expected: NOTRUN
[Consume empty text response body as text]
expected: NOTRUN
[Consume empty blob response body as arrayBuffer]
expected: NOTRUN
expected: FAIL
[Consume response's body as arrayBuffer]
expected: NOTRUN
expected: FAIL

[Consume empty FormData response body as text]
expected: NOTRUN
expected: FAIL

[Consume response's body as formData with correct multipart type (error case)]
expected: NOTRUN
expected: FAIL
[Consume response's body as formData with correct urlencoded type]
expected: NOTRUN

[Consume empty ArrayBuffer response body as text]
expected: NOTRUN

expected: FAIL
Loading

0 comments on commit 708ba3e

Please sign in to comment.