Commit 61b89ba0 authored by sigbjornf@opera.com's avatar sigbjornf@opera.com

Only dispose proxy-less WebServiceWorkerRegistration objects.

If a service worker registration is passed along to a resolver that's
in a detached/stopping state, the WebServiceWorkerRegistration is
simply disposed of.

Have that dispose step only delete the object if the registration object
isn't attached to a proxy already. If it is, it is responsible for
releasing the resource.

R=haraken
BUG=426321

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

git-svn-id: svn://svn.chromium.org/blink/trunk@184288 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent c0edf74a
......@@ -207,12 +207,6 @@ static void deleteIfNoExistingOwner(WebServiceWorker* serviceWorker)
delete serviceWorker;
}
static void deleteIfNoExistingOwner(WebServiceWorkerRegistration* registration)
{
if (registration && !registration->proxy())
delete registration;
}
void ServiceWorkerContainer::setController(WebServiceWorker* serviceWorker)
{
if (!executionContext()) {
......@@ -225,7 +219,7 @@ void ServiceWorkerContainer::setController(WebServiceWorker* serviceWorker)
void ServiceWorkerContainer::setReadyRegistration(WebServiceWorkerRegistration* registration)
{
if (!executionContext()) {
deleteIfNoExistingOwner(registration);
ServiceWorkerRegistration::dispose(registration);
return;
}
......
......@@ -90,7 +90,8 @@ ServiceWorkerRegistration* ServiceWorkerRegistration::take(ScriptPromiseResolver
void ServiceWorkerRegistration::dispose(WebType* registration)
{
delete registration;
if (registration && !registration->proxy())
delete registration;
}
String ServiceWorkerRegistration::scope() const
......
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