Commit 37812f3c authored by horo@chromium.org's avatar horo@chromium.org

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

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

git-svn-id: svn://svn.chromium.org/blink/trunk@180239 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 41496060
......@@ -51,10 +51,6 @@ crbug.com/385384 fast/dom/navigator-detached-no-crash.html [ Leak ]
# 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/364411 fast/frames/location-observe-callback-crash.html [ Leak ]
crbug.com/364417 editing/selection/selection-in-iframe-removed-crash.html [ Leak ]
......
......@@ -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;
......
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