Index: Source/modules/fetch/Response.cpp |
diff --git a/Source/modules/fetch/Response.cpp b/Source/modules/fetch/Response.cpp |
index 29c7c0de34933f6a711117f2692aea6a6a8abcba..e477da3611dd79ddcf75581a93a61313270d45d6 100644 |
--- a/Source/modules/fetch/Response.cpp |
+++ b/Source/modules/fetch/Response.cpp |
@@ -153,14 +153,23 @@ Response* Response::create(ExecutionContext* context, const BodyInit& body, cons |
Response* Response::create(ExecutionContext* context, Blob* body, const ResponseInit& responseInit, ExceptionState& exceptionState) |
{ |
+ unsigned short status = responseInit.status; |
+ |
// "1. If |init|'s status member is not in the range 200 to 599, throw a |
// RangeError." |
- if (responseInit.status < 200 || 599 < responseInit.status) { |
+ if (status < 200 || 599 < status) { |
exceptionState.throwRangeError("Invalid status"); |
philipj_slow
2015/07/27 11:36:08
ExceptionMessages::indexOutsideRange("status", sta
shiva.jm
2015/07/28 09:17:27
Done.
|
return 0; |
} |
- // "2. If |init|'s statusText member does not match the Reason-Phrase |
+ // "2. If init's status member is a null body status and body is non-null, |
+ // throw a TypeError. |
+ if ((status == 101 || status == 204 || status == 205 || status == 304) && body) { |
philipj_slow
2015/07/27 11:36:08
A helper for this would make it more obvious, as o
shiva.jm
2015/07/27 11:56:11
Done.
shiva.jm
2015/07/27 11:56:11
Done.
|
+ exceptionState.throwTypeError("Invalid status"); |
tyoshino (SeeGerritForStatus)
2015/07/27 11:26:52
Let's make this distinguishable with an error in t
hiroshige
2015/07/27 11:30:47
I'd like to make the message here more informative
shiva.jm
2015/07/27 11:56:11
Done.
shiva.jm
2015/07/27 11:56:11
Done.
shiva.jm
2015/07/27 11:56:11
Done.
|
+ return 0; |
+ } |
+ |
+ // "3. If |init|'s statusText member does not match the Reason-Phrase |
// token production, throw a TypeError." |
if (!isValidReasonPhrase(responseInit.statusText)) { |
exceptionState.throwTypeError("Invalid statusText"); |