Chromium Code Reviews| Index: Source/web/WebSharedWorkerImpl.cpp |
| diff --git a/Source/web/WebSharedWorkerImpl.cpp b/Source/web/WebSharedWorkerImpl.cpp |
| index 1d7d6881361626e888c845e4315715faa8fb596a..d155a87534669214a9f599f73696ac27a1af1db2 100644 |
| --- a/Source/web/WebSharedWorkerImpl.cpp |
| +++ b/Source/web/WebSharedWorkerImpl.cpp |
| @@ -181,6 +181,9 @@ void WebSharedWorkerImpl::stopWorkerThread() |
| if (m_mainScriptLoader) { |
| m_mainScriptLoader->cancel(); |
| m_mainScriptLoader.clear(); |
| + if (client()) |
| + client()->workerScriptLoadFailed(); |
| + delete this; |
|
sof
2014/08/12 05:02:12
Shouldn't this return early?
horo
2014/08/12 05:41:45
Ah, yes.
I'll revert this patch.
|
| } |
| if (m_workerThread) |
| m_workerThread->stop(); |
| @@ -346,17 +349,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; |