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

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

Issue 535193002: [ServiceWorker] Add NULL check of ExecutionContext in FetchBodyStream::readAsync (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move to Body.cpp and add comment Created 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/serviceworkers/Body.cpp
diff --git a/Source/modules/serviceworkers/Body.cpp b/Source/modules/serviceworkers/Body.cpp
index cd4088d1de1a9be07a2afe53363835d8d833a604..39d6ab2ebe576086e652d0ec60e9805393ae894c 100644
--- a/Source/modules/serviceworkers/Body.cpp
+++ b/Source/modules/serviceworkers/Body.cpp
@@ -19,6 +19,13 @@ ScriptPromise Body::readAsync(ScriptState* scriptState, ResponseType type)
if (m_bodyUsed)
return ScriptPromise::reject(scriptState, V8ThrowException::createTypeError("Already read", scriptState->isolate()));
+ // executionContext may be 0 if V8::TerminateExecution() is called in the
+ // main thread.
haraken 2014/09/11 16:20:01 Let's elaborate the comment a bit more. When the
horo 2014/09/11 16:49:55 Done.
+ // FIXME: Handle this case in more better way.
+ ExecutionContext* executionContext = scriptState->executionContext();
+ if (executionContext == 0)
haraken 2014/09/11 16:20:01 if (!executionContext)
horo 2014/09/11 16:49:55 Done.
+ return ScriptPromise();
+
m_bodyUsed = true;
m_responseType = type;
@@ -62,7 +69,7 @@ ScriptPromise Body::readAsync(ScriptState* scriptState, ResponseType type)
}
m_loader = adoptPtr(new FileReaderLoader(readType, this));
- m_loader->start(scriptState->executionContext(), blobHandle);
+ m_loader->start(executionContext, blobHandle);
return promise;
}
« 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