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

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

Issue 1305183009: CREDENTIAL: Extend FormData opacity to created Request objects (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Initializing variables is a good idea. Created 5 years, 3 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 | « Source/modules/fetch/Body.h ('k') | Source/modules/fetch/Request.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/fetch/Body.cpp
diff --git a/Source/modules/fetch/Body.cpp b/Source/modules/fetch/Body.cpp
index bb8c6f0576bb5ec63161f8adc19317fb60b14e7e..ba3b261ee538f8ec4359a807c8225e6342b21ac7 100644
--- a/Source/modules/fetch/Body.cpp
+++ b/Source/modules/fetch/Body.cpp
@@ -104,6 +104,9 @@ public:
ScriptPromise Body::arrayBuffer(ScriptState* scriptState)
{
+ if (m_opaque)
+ return ScriptPromise::reject(scriptState, V8ThrowException::createTypeError(scriptState->isolate(), "The body is opaque."));
+
if (bodyUsed())
return ScriptPromise::reject(scriptState, V8ThrowException::createTypeError(scriptState->isolate(), "Already read"));
@@ -124,6 +127,9 @@ ScriptPromise Body::arrayBuffer(ScriptState* scriptState)
ScriptPromise Body::blob(ScriptState* scriptState)
{
+ if (m_opaque)
+ return ScriptPromise::reject(scriptState, V8ThrowException::createTypeError(scriptState->isolate(), "The body is opaque."));
+
if (bodyUsed())
return ScriptPromise::reject(scriptState, V8ThrowException::createTypeError(scriptState->isolate(), "Already read"));
@@ -140,6 +146,9 @@ ScriptPromise Body::blob(ScriptState* scriptState)
ScriptPromise Body::json(ScriptState* scriptState)
{
+ if (m_opaque)
+ return ScriptPromise::reject(scriptState, V8ThrowException::createTypeError(scriptState->isolate(), "The body is opaque."));
+
if (bodyUsed())
return ScriptPromise::reject(scriptState, V8ThrowException::createTypeError(scriptState->isolate(), "Already read"));
@@ -155,6 +164,9 @@ ScriptPromise Body::json(ScriptState* scriptState)
ScriptPromise Body::text(ScriptState* scriptState)
{
+ if (m_opaque)
+ return ScriptPromise::reject(scriptState, V8ThrowException::createTypeError(scriptState->isolate(), "The body is opaque."));
+
if (bodyUsed())
return ScriptPromise::reject(scriptState, V8ThrowException::createTypeError(scriptState->isolate(), "Already read"));
@@ -186,7 +198,10 @@ bool Body::hasPendingActivity() const
return bodyBuffer()->hasPendingActivity();
}
-Body::Body(ExecutionContext* context) : ActiveDOMObject(context), m_bodyPassed(false)
+Body::Body(ExecutionContext* context)
+ : ActiveDOMObject(context)
+ , m_bodyPassed(false)
+ , m_opaque(false)
{
suspendIfNeeded();
}
« no previous file with comments | « Source/modules/fetch/Body.h ('k') | Source/modules/fetch/Request.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698