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

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

Issue 2564503002: Fix BlobBytesConsumer state assumption on cancellation (Closed)
Patch Set: fix Created 4 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698