Commit 1148918e authored by dominicc@chromium.org's avatar dominicc@chromium.org

Don't leak a WebServiceWorker when 'current' races with context destruction.

WebServiceWorkerProviderClient::setCurrentServiceWorker passes the
ownership of a WebServiceWorker to the container. If the execution
context is gone, delete the WebServiceWorker instead of dropping it on
the floor.

BUG=363967

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

git-svn-id: svn://svn.chromium.org/blink/trunk@175023 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 34866d11
......@@ -142,8 +142,10 @@ ScriptPromise ServiceWorkerContainer::unregisterServiceWorker(ExecutionContext*
void ServiceWorkerContainer::setCurrentServiceWorker(blink::WebServiceWorker* serviceWorker)
{
if (!executionContext())
if (!executionContext()) {
delete serviceWorker;
return;
}
m_current = ServiceWorker::create(executionContext(), adoptPtr(serviceWorker));
}
......
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