Index: third_party/WebKit/Source/modules/fetch/BlobBytesConsumer.cpp |
diff --git a/third_party/WebKit/Source/modules/fetch/BlobBytesConsumer.cpp b/third_party/WebKit/Source/modules/fetch/BlobBytesConsumer.cpp |
index 19087874f63b0ed3d0c6747cf43a6451fddfe2af..ee586c0253242c7113c9b2fe9329df08afa18f6c 100644 |
--- a/third_party/WebKit/Source/modules/fetch/BlobBytesConsumer.cpp |
+++ b/third_party/WebKit/Source/modules/fetch/BlobBytesConsumer.cpp |
@@ -231,8 +231,14 @@ void BlobBytesConsumer::didFinishLoading(unsigned long identifier, |
void BlobBytesConsumer::didFail(const ResourceError& e) { |
if (e.isCancellation()) { |
- DCHECK_EQ(PublicState::Closed, m_state); |
- return; |
+ // |m_loader| can be canceled when |
+ // - this object explicitly cancels it, or |
+ // - the global context is shutting down. |
+ // In the first case, |m_state| should be Closed. |
+ if (getExecutionContext() && !getExecutionContext()->isContextDestroyed()) |
+ DCHECK_EQ(PublicState::Closed, m_state); |
+ if (m_state == PublicState::Closed) |
+ return; |
} |
DCHECK_EQ(PublicState::ReadableOrWaiting, m_state); |
m_loader = nullptr; |