Chromium Code Reviews| Index: Source/modules/fetch/Request.cpp |
| diff --git a/Source/modules/fetch/Request.cpp b/Source/modules/fetch/Request.cpp |
| index 8e26455835b151b4c93e53dd1096be81aea80c8c..82e6f5ad415045af0344498b0e441dcafa50d56b 100644 |
| --- a/Source/modules/fetch/Request.cpp |
| +++ b/Source/modules/fetch/Request.cpp |
| @@ -49,6 +49,15 @@ Request* Request::createRequestWithRequestOrString(ScriptState* scriptState, Req |
| // "1. Let |temporaryBody| be null." |
| RefPtr<BlobDataHandle> temporaryBody; |
| + if (inputRequest) { |
| + // We check bodyUsed even when the body is null in spite of the |
| + // spec. See https://github.com/whatwg/fetch/issues/61 for details. |
| + if (inputRequest->bodyUsed()) { |
|
tyoshino (SeeGerritForStatus)
2015/06/18 06:34:34
are these if-s separated intentionally?
yhirano
2015/06/18 06:44:24
Yes.
|
| + exceptionState.throwTypeError("Cannot construct a Request with a Request object that has already been used."); |
| + return nullptr; |
| + } |
| + } |
| + |
| // "2. If |input| is a Request object and |input|'s body is non-null, run |
| // these substeps:" |
| if (inputRequest && inputRequest->hasBody()) { |
| @@ -243,7 +252,9 @@ Request* Request::createRequestWithRequestOrString(ScriptState* scriptState, Req |
| // "31. If |input| is a Request object and |input|'s body is non-null, run |
| // these substeps:" |
| - if (inputRequest && inputRequest->hasBody()) { |
| + // We set bodyUsed even when the body is null in spite of the |
| + // spec. See https://github.com/whatwg/fetch/issues/61 for details. |
| + if (inputRequest) { |
| // "1. Set |input|'s body to null." |
| inputRequest->setBodyBlobHandle(nullptr); |
| // "2. Set |input|'s used flag." |