Commit 0899b916 authored by horo@chromium.org's avatar horo@chromium.org

Revert of Fix leaks when the shared worker is requested to be terminated while...

Revert of Fix leaks when the shared worker is requested to be terminated while loading the main script. (https://codereview.chromium.org/451603002/)

Reason for revert:
UAF bug in WebSharedWorkerImpl::stopWorkerThread().

Original issue's description:
> Fix leaks when the shared worker is requested to be terminated while loading the main script.
> 
> BUG=398742
> 
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=180013

TBR=jochen@chromium.org,sigbjornf@opera.com
NOTREECHECKS=true
NOTRY=true
BUG=398742

Review URL: https://codereview.chromium.org/465863002

git-svn-id: svn://svn.chromium.org/blink/trunk@180031 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent f9411e85
...@@ -55,6 +55,10 @@ crbug.com/385384 fast/dom/navigator-detached-no-crash.html [ Leak ] ...@@ -55,6 +55,10 @@ crbug.com/385384 fast/dom/navigator-detached-no-crash.html [ Leak ]
# Untriaged but known leaks which may be false positives. # Untriaged but known leaks which may be false positives.
# ----------------------------------------------------------------- # -----------------------------------------------------------------
crbug.com/398742 fast/workers/shared-worker-event-listener.html [ Leak ]
crbug.com/398742 fast/workers/worker-crash-with-invalid-location.html [ Leak ]
crbug.com/398742 http/tests/security/contentSecurityPolicy/1.1/child-src/worker-shared-allowed.html [ Leak ]
crbug.com/364408 inspector/extensions/extensions-audits-content-script.html [ Leak ] crbug.com/364408 inspector/extensions/extensions-audits-content-script.html [ Leak ]
crbug.com/364408 inspector/extensions/extensions-eval-content-script.html [ Leak ] crbug.com/364408 inspector/extensions/extensions-eval-content-script.html [ Leak ]
crbug.com/364408 inspector/extensions/extensions-reload.html [ Leak ] crbug.com/364408 inspector/extensions/extensions-reload.html [ Leak ]
......
...@@ -182,9 +182,6 @@ void WebSharedWorkerImpl::stopWorkerThread() ...@@ -182,9 +182,6 @@ void WebSharedWorkerImpl::stopWorkerThread()
if (m_mainScriptLoader) { if (m_mainScriptLoader) {
m_mainScriptLoader->cancel(); m_mainScriptLoader->cancel();
m_mainScriptLoader.clear(); m_mainScriptLoader.clear();
if (client())
client()->workerScriptLoadFailed();
delete this;
} }
if (m_workerThread) if (m_workerThread)
m_workerThread->stop(); m_workerThread->stop();
...@@ -350,16 +347,17 @@ void WebSharedWorkerImpl::onScriptLoaderFinished() ...@@ -350,16 +347,17 @@ void WebSharedWorkerImpl::onScriptLoaderFinished()
{ {
ASSERT(m_loadingDocument); ASSERT(m_loadingDocument);
ASSERT(m_mainScriptLoader); ASSERT(m_mainScriptLoader);
if (m_askedToTerminate) if (m_mainScriptLoader->failed() || m_askedToTerminate) {
return;
if (m_mainScriptLoader->failed()) {
m_mainScriptLoader->cancel(); m_mainScriptLoader->cancel();
if (client()) if (client())
client()->workerScriptLoadFailed(); client()->workerScriptLoadFailed();
// The SharedWorker was unable to load the initial script, so // The SharedWorker was unable to load the initial script, so
// shut it down right here. // shut it down right here unless we're here handling a load
delete this; // cancellation failure triggered by an explicit shared worker
// termination call (via terminateWorkerContext().)
if (!m_askedToTerminate)
delete this;
return; return;
} }
WorkerThreadStartMode startMode = m_pauseWorkerContextOnStart ? PauseWorkerGlobalScopeOnStart : DontPauseWorkerGlobalScopeOnStart; WorkerThreadStartMode startMode = m_pauseWorkerContextOnStart ? PauseWorkerGlobalScopeOnStart : DontPauseWorkerGlobalScopeOnStart;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment