From b1add125477b584e09d7dff9bc370ab34ce020f2 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Wed, 2 Oct 2019 22:31:10 +0000 Subject: [PATCH] Bug 1444166 [wpt PR 9931] - Add used body replacement test for Request constructor, a=testonly Automatic update from web-platform-testsFetch: add used body replacement test for Request constructor See Fetch change https://github.com/whatwg/fetch/pull/675. Specifically, that PR allows Requests with disturbed bodies to be used as the first parameter to the Request constructor, as long as the RequestInit dictionary contains a body member with which to replace the used body. As of this writing, no browser implements this change. wpt-commits: e87f38097902e16348d4e17f4fe3bc2d0112bff1 wpt-pr: 9931 wpt-commits: e87f38097902e16348d4e17f4fe3bc2d0112bff1 wpt-pr: 9931 UltraBlame original commit: ad7b8e6c381646d827339d34e4ac9db07654bcc8 --- testing/web-platform/meta/MANIFEST.json | 2 +- .../fetch/api/request/request-disturbed.html | 131 ++++++++++++++++++ 2 files changed, 132 insertions(+), 1 deletion(-) diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index 95a8a09a1d594..1d83fa6ce9b0e 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -3660416,7 +3660416,7 @@ html : [ " -47a1771e5ce32b63cf4b378a87c5d53ee486c246 +62d53aaa3cefd7f76f315ab3f3aa1cd5d5a4e4a0 " " testharness diff --git a/testing/web-platform/tests/fetch/api/request/request-disturbed.html b/testing/web-platform/tests/fetch/api/request/request-disturbed.html index 1563fe7d7f499..3bb34c0b0746b 100644 --- a/testing/web-platform/tests/fetch/api/request/request-disturbed.html +++ b/testing/web-platform/tests/fetch/api/request/request-disturbed.html @@ -489,6 +489,129 @@ ( ) { +assert_true +( +bodyConsumed +. +bodyUsed +" +bodyUsed +is +true +when +request +is +disturbed +" +) +; +const +originalBody += +bodyConsumed +. +body +; +const +bodyReplaced += +new +Request +( +bodyConsumed +{ +body +: +" +Replaced +body +" +} +) +; +assert_not_equals +( +bodyReplaced +. +body +originalBody +" +new +request +' +s +body +is +new +" +) +; +assert_false +( +bodyReplaced +. +bodyUsed +" +bodyUsed +is +false +when +request +is +not +disturbed +" +) +; +return +bodyReplaced +. +text +( +) +. +then +( +text += +> +{ +assert_equals +( +text +" +Replaced +body +" +) +; +} +) +; +} +" +Check +creating +a +new +request +with +a +new +body +from +a +disturbed +request +" +) +; +promise_test +( +function +( +) +{ var bodyRequest = @@ -611,6 +734,10 @@ . text ( +) +. +then +( text = > @@ -780,6 +907,10 @@ . text ( +) +. +then +( text = >