Index: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js |
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js |
index fa988b277025184dbf7e5985522a3d5bd6f6175f..71dec57a9c15e23e11277fa8e77680b1159968bc 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js |
+++ b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js |
@@ -335,11 +335,10 @@ test(function() { |
assert_false(req.bodyUsed, |
'Request should not be flagged as used if it has not been ' + |
'consumed.'); |
- // See https://crbug.com/501195. |
var req2 = new Request(req); |
- assert_true(req.bodyUsed, |
- 'Request should be flagged as used if it does not have' + |
- 'body.'); |
+ assert_false(req.bodyUsed, |
+ 'Request should not be flagged as used if it does not ' + |
+ 'have body.'); |
assert_false(req2.bodyUsed, |
'Request should not be flagged as used if it has not been ' + |
'consumed.'); |
@@ -479,6 +478,13 @@ promise_test(function() { |
}); |
}, 'Request of GET/HEAD method cannot have RequestInit body.'); |
+test(() => { |
+ var req = new Request(URL, {method: 'POST', body: 'hello'}); |
+ req.text(); |
+ assert_true(req.bodyUsed); |
+ assert_throws({name: 'TypeError'}, () => { req.clone(); }); |
+ }, 'Used => clone'); |
+ |
promise_test(function() { |
var headers = new Headers; |
headers.set('Content-Language', 'ja'); |
@@ -488,6 +494,8 @@ promise_test(function() { |
body: new Blob(['Test Blob'], {type: 'test/type'}) |
}); |
var req2 = req.clone(); |
+ assert_false(req.bodyUsed); |
+ assert_false(req2.bodyUsed); |
// Change headers and of original request. |
req.headers.set('Content-Language', 'en'); |
assert_equals(req2.headers.get('Content-Language'), 'ja', |
@@ -499,13 +507,6 @@ promise_test(function() { |
return req2.text(); |
}).then(function(text) { |
assert_equals(text, 'Test Blob', 'Cloned request body should match.'); |
- return Promise.all([req.text(), req2.text()]); |
- }).then(function(texts) { |
- assert_equals(texts[0], '', 'The body is consumed.'); |
- assert_equals(texts[1], '', 'The body is consumed.'); |
- return req.clone().text(); |
- }).then(function(text) { |
- assert_equals(text, '', 'The body was consumed before cloned.'); |
}); |
}, 'Test clone behavior with loading content from Request.'); |
@@ -671,9 +672,6 @@ promise_test(function(t) { |
.then(function(blob) { |
assert_equals(blob.type, 'text/plain'); |
assert_equals(req.headers.get('Content-Type'), 'text/plain'); |
- return new Request(req).blob(); |
- }).then(function(blob) { |
- assert_equals(blob.type, 'text/plain'); |
}); |
}, 'MIME type for Blob with non-empty type'); |
@@ -741,17 +739,4 @@ promise_test(function(t) { |
}); |
}, 'Extract a MIME type (1)'); |
-promise_test(function(t) { |
- var req = new Request('http://localhost/', {method: 'POST', body: 'hello'}); |
- return req.text().then(function(text) { |
- assert_equals(text, 'hello'); |
- var req2 = new Request(req); |
- assert_true(req.bodyUsed); |
- assert_false(req2.bodyUsed); |
- return req2.text(); |
- }).then(function(text) { |
- assert_equals(text, ''); |
- }); |
- }, 'Consume and pass'); |
- |
done(); |