Index: Source/core/streams/ReadableStreamImpl.h |
diff --git a/Source/core/streams/ReadableStreamImpl.h b/Source/core/streams/ReadableStreamImpl.h |
index 719fe8e040a940fe2c8cb9456434f1bfc9b3cee0..27ee8ce5de6082de5f5ac03a844e1ce77a46e360 100644 |
--- a/Source/core/streams/ReadableStreamImpl.h |
+++ b/Source/core/streams/ReadableStreamImpl.h |
@@ -118,18 +118,12 @@ public: |
DEFINE_INLINE_VIRTUAL_TRACE() |
{ |
visitor->trace(m_strategy); |
-#if ENABLE(OILPAN) |
visitor->trace(m_pendingReads); |
-#endif |
ReadableStream::trace(visitor); |
} |
private: |
-#if ENABLE(OILPAN) |
using PendingReads = HeapDeque<Member<ScriptPromiseResolver>>; |
-#else |
- using PendingReads = Deque<RefPtr<ScriptPromiseResolver>>; |
-#endif |
// ReadableStream methods |
bool isQueueEmpty() const override { return m_queue.isEmpty(); } |
@@ -142,8 +136,11 @@ private: |
void resolveAllPendingReadsAsDone() override |
{ |
for (auto& resolver : m_pendingReads) { |
- ScriptState::Scope scope(resolver->scriptState()); |
- resolver->resolve(v8IteratorResultDone(resolver->scriptState())); |
+ ScriptState* scriptState = resolver->scriptState(); |
+ if (!scriptState->contextIsValid()) |
+ continue; |
+ ScriptState::Scope scope(scriptState); |
+ resolver->resolve(v8IteratorResultDone(scriptState)); |
} |
m_pendingReads.clear(); |
} |
@@ -180,8 +177,10 @@ bool ReadableStreamImpl<ChunkTypeTraits>::enqueue(typename ChunkTypeTraits::Pass |
return enqueuePostAction(); |
} |
- RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = m_pendingReads.takeFirst(); |
+ ScriptPromiseResolver* resolver = m_pendingReads.takeFirst(); |
ScriptState* scriptState = resolver->scriptState(); |
+ if (!scriptState->contextIsValid()) |
+ return false; |
ScriptState::Scope scope(scriptState); |
resolver->resolve(v8IteratorResult(scriptState, chunk)); |
return enqueuePostAction(); |