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; |
} |