Commit 4cff0ce9 authored by Istiaque Ahmed's avatar Istiaque Ahmed Committed by Commit Bot

ServiceWorkerTaskQueue: Remove spurious unregistration error message.

When an extension is deactivated, SWTQ unregisters the extension's
worker. Subsequently, if the extension was re-activated quickly (which
is the typical e.g. from ExtensionApiTest::RunExtensionTest due to
kFlagEnableFileAccess), then it is expected that the unregistration
can fail (as the initial extension activation couldn't complete SW
registration). This CL doesn't log unregistration failure error
message in that case, removing confusion around the log.

Bug: None
Test: No behavior changes, spurious unregistration failed error shouldn't be seen from service_worker_apitest.
Change-Id: Ifccbc649b492f9cbe8527a5e6412cca2aea2d5ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2266016Reviewed-by: default avatarDavid Bertoni <dbertoni@chromium.org>
Commit-Queue: Istiaque Ahmed <lazyboy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#782747}
parent af071074
...@@ -427,7 +427,7 @@ void ServiceWorkerTaskQueue::DeactivateExtension(const Extension* extension) { ...@@ -427,7 +427,7 @@ void ServiceWorkerTaskQueue::DeactivateExtension(const Extension* extension) {
->UnregisterServiceWorker( ->UnregisterServiceWorker(
extension->url(), extension->url(),
base::BindOnce(&ServiceWorkerTaskQueue::DidUnregisterServiceWorker, base::BindOnce(&ServiceWorkerTaskQueue::DidUnregisterServiceWorker,
weak_factory_.GetWeakPtr(), extension_id)); weak_factory_.GetWeakPtr(), extension_id, *sequence));
} }
void ServiceWorkerTaskQueue::RunTasksAfterStartWorker( void ServiceWorkerTaskQueue::RunTasksAfterStartWorker(
...@@ -496,7 +496,12 @@ void ServiceWorkerTaskQueue::DidRegisterServiceWorker( ...@@ -496,7 +496,12 @@ void ServiceWorkerTaskQueue::DidRegisterServiceWorker(
void ServiceWorkerTaskQueue::DidUnregisterServiceWorker( void ServiceWorkerTaskQueue::DidUnregisterServiceWorker(
const ExtensionId& extension_id, const ExtensionId& extension_id,
ActivationSequence sequence,
bool success) { bool success) {
// Extension run with |sequence| was already deactivated.
if (!IsCurrentSequence(extension_id, sequence))
return;
// TODO(lazyboy): Handle success = false case. // TODO(lazyboy): Handle success = false case.
if (!success) if (!success)
LOG(ERROR) << "Failed to unregister service worker!"; LOG(ERROR) << "Failed to unregister service worker!";
......
...@@ -167,6 +167,7 @@ class ServiceWorkerTaskQueue : public KeyedService, ...@@ -167,6 +167,7 @@ class ServiceWorkerTaskQueue : public KeyedService,
void DidRegisterServiceWorker(const SequencedContextId& context_id, void DidRegisterServiceWorker(const SequencedContextId& context_id,
bool success); bool success);
void DidUnregisterServiceWorker(const ExtensionId& extension_id, void DidUnregisterServiceWorker(const ExtensionId& extension_id,
ActivationSequence sequence,
bool success); bool success);
void DidStartWorkerForScope(const SequencedContextId& context_id, void DidStartWorkerForScope(const SequencedContextId& context_id,
......
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