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) diff --git a/tests/wpt/metadata-layout-2020/fetch/api/basic/stream-safe-creation.any.js.ini b/tests/wpt/metadata-layout-2020/fetch/api/basic/stream-safe-creation.any.js.ini index ad69e2d0c19..f48fb507bbb 100644 --- a/tests/wpt/metadata-layout-2020/fetch/api/basic/stream-safe-creation.any.js.ini +++ b/tests/wpt/metadata-layout-2020/fetch/api/basic/stream-safe-creation.any.js.ini @@ -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 diff --git a/tests/wpt/metadata-layout-2020/fetch/api/response/response-consume-empty.any.js.ini b/tests/wpt/metadata-layout-2020/fetch/api/response/response-consume-empty.any.js.ini index 3545e56c57e..1e555d38f07 100644 --- a/tests/wpt/metadata-layout-2020/fetch/api/response/response-consume-empty.any.js.ini +++ b/tests/wpt/metadata-layout-2020/fetch/api/response/response-consume-empty.any.js.ini @@ -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 diff --git a/tests/wpt/metadata-layout-2020/fetch/content-type/response.window.js.ini b/tests/wpt/metadata-layout-2020/fetch/content-type/response.window.js.ini index df1b6f0e51b..fb99623b59d 100644 --- a/tests/wpt/metadata-layout-2020/fetch/content-type/response.window.js.ini +++ b/tests/wpt/metadata-layout-2020/fetch/content-type/response.window.js.ini @@ -1,307 +1,162 @@ [response.window.html] - expected: TIMEOUT [fetch(): combined response Content-Type: text/plain ] - expected: NOTRUN - - [Response: combined response Content-Type: text/plain;charset=gbk text/plain;charset=windows-1252] - expected: NOTRUN - - [Request: combined response Content-Type: */* text/html] - expected: NOTRUN + expected: FAIL [fetch(): separate response Content-Type: text/html;" \\" text/plain] - expected: NOTRUN - - [Response: combined response Content-Type: text/html */*] - expected: NOTRUN - - [fetch(): separate response Content-Type: */* text/html] - expected: NOTRUN + expected: FAIL [fetch(): separate response Content-Type: text/html;" text/plain] - expected: NOTRUN + expected: FAIL [