From d47b17d37df8590e4fc2abc249ee33e3ce612251 Mon Sep 17 00:00:00 2001 From: Marcos Casagrande Date: Wed, 12 Oct 2022 09:23:33 +0200 Subject: [PATCH] fix(ext/fetch): throw TypeError on read failure (#16219) --- ext/fetch/lib.rs | 2 +- tools/wpt/expectation.json | 24 ++++++------------------ 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/ext/fetch/lib.rs b/ext/fetch/lib.rs index b8f784284a..c141c3065d 100644 --- a/ext/fetch/lib.rs +++ b/ext/fetch/lib.rs @@ -509,7 +509,7 @@ impl Resource for FetchResponseBodyResource { // safely call `await` on it without creating a race condition. Some(_) => match reader.as_mut().next().await.unwrap() { Ok(chunk) => assert!(chunk.is_empty()), - Err(err) => break Err(AnyError::from(err)), + Err(err) => break Err(type_error(err.to_string())), }, None => break Ok(BufView::empty()), } diff --git a/tools/wpt/expectation.json b/tools/wpt/expectation.json index 828eb079d7..d5560ffb6b 100644 --- a/tools/wpt/expectation.json +++ b/tools/wpt/expectation.json @@ -2921,7 +2921,9 @@ "accept-header.any.worker.html": true, "conditional-get.any.html": false, "conditional-get.any.worker.html": false, - "error-after-response.any.html": false, + "error-after-response.any.html": { + "ignore": true + }, "header-value-combining.any.html": false, "header-value-combining.any.worker.html": false, "header-value-null-byte.any.html": true, @@ -3218,20 +3220,8 @@ } }, "content-encoding": { - "bad-gzip-body.any.html": [ - "Consuming the body of a resource with bad gzip content with arrayBuffer() should reject", - "Consuming the body of a resource with bad gzip content with blob() should reject", - "Consuming the body of a resource with bad gzip content with formData() should reject", - "Consuming the body of a resource with bad gzip content with json() should reject", - "Consuming the body of a resource with bad gzip content with text() should reject" - ], - "bad-gzip-body.any.worker.html": [ - "Consuming the body of a resource with bad gzip content with arrayBuffer() should reject", - "Consuming the body of a resource with bad gzip content with blob() should reject", - "Consuming the body of a resource with bad gzip content with formData() should reject", - "Consuming the body of a resource with bad gzip content with json() should reject", - "Consuming the body of a resource with bad gzip content with text() should reject" - ] + "bad-gzip-body.any.html": true, + "bad-gzip-body.any.worker.html": true }, "content-length": { "api-and-duplicate-headers.any.html": [ @@ -3242,9 +3232,7 @@ "XMLHttpRequest and duplicate Content-Length/Content-Type headers", "fetch() and duplicate Content-Length/Content-Type headers" ], - "too-long.window.html": [ - "Content-Length header value of network response exceeds response body" - ] + "too-long.window.html": true }, "content-type": { "multipart.window.html": true