OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/fetch/Body.h" | 5 #include "modules/fetch/Body.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
9 #include "bindings/core/v8/V8ArrayBuffer.h" | 9 #include "bindings/core/v8/V8ArrayBuffer.h" |
10 #include "bindings/core/v8/V8ThrowException.h" | 10 #include "bindings/core/v8/V8ThrowException.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 return bodyBuffer() && bodyBuffer()->isStreamDisturbed(); | 204 return bodyBuffer() && bodyBuffer()->isStreamDisturbed(); |
205 } | 205 } |
206 | 206 |
207 bool Body::isBodyLocked() | 207 bool Body::isBodyLocked() |
208 { | 208 { |
209 return bodyBuffer() && bodyBuffer()->isStreamLocked(); | 209 return bodyBuffer() && bodyBuffer()->isStreamLocked(); |
210 } | 210 } |
211 | 211 |
212 bool Body::hasPendingActivity() const | 212 bool Body::hasPendingActivity() const |
213 { | 213 { |
214 if (getExecutionContext()->activeDOMObjectsAreStopped()) | 214 if (!getExecutionContext() || getExecutionContext()->activeDOMObjectsAreStop
ped()) |
215 return false; | 215 return false; |
216 if (!bodyBuffer()) | 216 if (!bodyBuffer()) |
217 return false; | 217 return false; |
218 return bodyBuffer()->hasPendingActivity(); | 218 return bodyBuffer()->hasPendingActivity(); |
219 } | 219 } |
220 | 220 |
221 Body::Body(ExecutionContext* context) : ActiveScriptWrappable(this) , ContextLif
ecycleObserver(context) {} | 221 Body::Body(ExecutionContext* context) : ActiveScriptWrappable(this) , ContextLif
ecycleObserver(context) {} |
222 | 222 |
223 ScriptPromise Body::rejectInvalidConsumption(ScriptState* scriptState) | 223 ScriptPromise Body::rejectInvalidConsumption(ScriptState* scriptState) |
224 { | 224 { |
225 if (isBodyLocked() || bodyUsed()) | 225 if (isBodyLocked() || bodyUsed()) |
226 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), "Already read")); | 226 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), "Already read")); |
227 return ScriptPromise(); | 227 return ScriptPromise(); |
228 } | 228 } |
229 | 229 |
230 } // namespace blink | 230 } // namespace blink |
OLD | NEW |