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

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

Issue 1418813004: [Fetch API] Reflect spec changes of bodyUsed property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
Index: third_party/WebKit/Source/modules/fetch/Response.cpp
diff --git a/third_party/WebKit/Source/modules/fetch/Response.cpp b/third_party/WebKit/Source/modules/fetch/Response.cpp
index a7d2421779c49e3e92b48b318430457c06533cd1..7ca6de459e0389fae07f31b3ad6a1c8f7836fc7d 100644
--- a/third_party/WebKit/Source/modules/fetch/Response.cpp
+++ b/third_party/WebKit/Source/modules/fetch/Response.cpp
@@ -339,7 +339,7 @@ Headers* Response::headers() const
Response* Response::clone(ExceptionState& exceptionState)
{
- if (bodyUsed()) {
+ if (isBodyLocked() || bodyUsed()) {
exceptionState.throwTypeError("Response body is already used");
return nullptr;
}
@@ -390,6 +390,11 @@ bool Response::hasBody() const
return m_response->internalBuffer();
}
+bool Response::bodyUsed()
+{
+ return internalBodyBuffer() && internalBodyBuffer()->stream()->isDisturbed();
+}
+
String Response::mimeType() const
{
return m_response->mimeType();
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/Response.h ('k') | third_party/WebKit/Source/modules/fetch/Response.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698