Index: Source/web/WebSharedWorkerImpl.cpp |
diff --git a/Source/web/WebSharedWorkerImpl.cpp b/Source/web/WebSharedWorkerImpl.cpp |
index 26bf424af4d35d9f31903a5aadbac66b2d246068..4b5cdf6086872ccb64fbe05fcc25191471a1bce8 100644 |
--- a/Source/web/WebSharedWorkerImpl.cpp |
+++ b/Source/web/WebSharedWorkerImpl.cpp |
@@ -182,6 +182,10 @@ void WebSharedWorkerImpl::stopWorkerThread() |
if (m_mainScriptLoader) { |
m_mainScriptLoader->cancel(); |
m_mainScriptLoader.clear(); |
+ if (client()) |
+ client()->workerScriptLoadFailed(); |
+ delete this; |
+ return; |
} |
if (m_workerThread) |
m_workerThread->stop(); |
@@ -347,17 +351,16 @@ void WebSharedWorkerImpl::onScriptLoaderFinished() |
{ |
ASSERT(m_loadingDocument); |
ASSERT(m_mainScriptLoader); |
- if (m_mainScriptLoader->failed() || m_askedToTerminate) { |
+ if (m_askedToTerminate) |
+ return; |
+ if (m_mainScriptLoader->failed()) { |
m_mainScriptLoader->cancel(); |
if (client()) |
client()->workerScriptLoadFailed(); |
// The SharedWorker was unable to load the initial script, so |
- // shut it down right here unless we're here handling a load |
- // cancellation failure triggered by an explicit shared worker |
- // termination call (via terminateWorkerContext().) |
- if (!m_askedToTerminate) |
- delete this; |
+ // shut it down right here. |
+ delete this; |
return; |
} |
WorkerThreadStartMode startMode = m_pauseWorkerContextOnStart ? PauseWorkerGlobalScopeOnStart : DontPauseWorkerGlobalScopeOnStart; |