Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Unified Diff: Source/modules/fetch/Response.cpp

Issue 1258933002: Make the Response constructor throw when status is a null body status and body is non-null (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/http/tests/fetch/script-tests/response.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/fetch/Response.cpp
diff --git a/Source/modules/fetch/Response.cpp b/Source/modules/fetch/Response.cpp
index 29c7c0de34933f6a711117f2692aea6a6a8abcba..e64e1b7a7b0ac51bc7c96894f1c3b87e3d2b5dff 100644
--- a/Source/modules/fetch/Response.cpp
+++ b/Source/modules/fetch/Response.cpp
@@ -153,9 +153,12 @@ Response* Response::create(ExecutionContext* context, const BodyInit& body, cons
Response* Response::create(ExecutionContext* context, Blob* body, const ResponseInit& responseInit, ExceptionState& exceptionState)
{
- // "1. If |init|'s status member is not in the range 200 to 599, throw a
- // RangeError."
- if (responseInit.status < 200 || 599 < responseInit.status) {
+ unsigned short status = responseInit.status;
+
+ // "1. If init's status member is either not in the range 200 to 599, inclusive,
+ // or is a null body status, throw a RangeError. A null body status is 101, 204, 205, or 304,
+ // spec link, See https://fetch.spec.whatwg.org/#null-body-status for details"
hiroshige 2015/07/29 11:49:11 According to the latest spec, - null body status c
shiva.jm 2015/07/30 09:10:42 Done.
+ if (status < 200 || status == 204 || status == 205 || status == 304 || 599 < status) {
hiroshige 2015/07/29 11:49:11 Please define isNullBodyStatus() in the anonymous
shiva.jm 2015/07/30 09:10:42 Done.
exceptionState.throwRangeError("Invalid status");
return 0;
}
« no previous file with comments | « LayoutTests/http/tests/fetch/script-tests/response.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698