New issue
Advanced search Search tips

Issue 771829 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: May 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug
Proj-Servicification

Blocking:
issue 715640



Sign in to add a comment

Remove WebServiceWorkerEventResult

Project Member Reported by falken@chromium.org, Oct 5 2017

Issue description

In S13nSW, several layout tests are crashing because BrowserSideControllerServiceWorker tries to pass an error like SERVICE_WORKER_ERROR_FAILED to the callback for DispatchFetchEvent, which complains since that callbacks really needs a "ServiceWorkerEventStatus" which only allows conversion from OK, WAITUNTIL_REJECTED, or ABORTED. 

This is pretty bizarre and I believe we just have this for legacy reasons. I think we can get rid of WAIT_UNTIL_REJECTED and ServiceWorkerEventStatus should either just be a SUCCESS/FAIL or else we could possibly use blink::mojom::ServiceWorkerErrorType. 

Investigating.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Oct 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4138590db8499ec8868cdfe81d657c78e5b1eff9

commit 4138590db8499ec8868cdfe81d657c78e5b1eff9
Author: Matt Falkenhagen <falken@chromium.org>
Date: Fri Oct 06 05:36:19 2017

service worker: Remove typemapping of blink::EventStatus <-> content::StatusCode

ServiceWorkerEventStatus is the Mojo type used for most functions in the
Mojo interface ServiceWorkerEventDispatcher. However it's been typemapped
to content::ServiceWorkerStatusCode.

This typemapping is not worth the magic and it's clearer for C++ implementations
to use the Mojo type natively, since the types are quite different: EventStatus has
only 3 possible types compared to the dozen or so in StatusCode.

This also fixes some crashes in S13nSW, where BrowserSideControllerServiceWorker
wasn't aware that the callback was really expecting an EventStatus instead of
a StatusCode (however they are still crashing in a different way, so no
expectations are changed yet).

Future work is to remove WebServiceWorkerEventResult, a Web copy of the Mojo
type. I also think SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED should be
removed, but that may take longer (a lot of client code that Starts + Dispatches
Event to a service worker wants to funnel everything to a single callback
that takes a ServiceWorkerStatusCode).

Bug:  771829 
Change-Id: I6cdad0d78242ab801c501f6e16dba2515a46d8d8
Reviewed-on: https://chromium-review.googlesource.com/702134
Commit-Queue: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Makoto Shimazu <shimazu@chromium.org>
Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
Reviewed-by: Peter Beverloo <peter@chromium.org>
Reviewed-by: Josh Karlin <jkarlin@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506987}
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/browser/background_fetch/background_fetch_embedded_worker_test_helper.cc
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/browser/background_sync/background_sync_manager.cc
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/browser/service_worker/browser_side_controller_service_worker.cc
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/browser/service_worker/browser_side_controller_service_worker.h
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/browser/service_worker/embedded_worker_test_helper.cc
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/browser/service_worker/embedded_worker_test_helper.h
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/browser/service_worker/service_worker_browsertest.cc
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/browser/service_worker/service_worker_context_unittest.cc
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/browser/service_worker/service_worker_fetch_dispatcher.cc
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/browser/service_worker/service_worker_fetch_dispatcher.h
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/browser/service_worker/service_worker_job_unittest.cc
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/browser/service_worker/service_worker_register_job.cc
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/browser/service_worker/service_worker_register_job.h
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/browser/service_worker/service_worker_type_converters.cc
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/browser/service_worker/service_worker_type_converters.h
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/browser/service_worker/service_worker_url_loader_job_unittest.cc
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/browser/service_worker/service_worker_url_request_job_unittest.cc
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/browser/service_worker/service_worker_version.cc
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/browser/service_worker/service_worker_version.h
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/browser/service_worker/service_worker_version_unittest.cc
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/child/service_worker/service_worker_subresource_loader.cc
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/child/service_worker/service_worker_subresource_loader.h
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/child/service_worker/service_worker_subresource_loader_unittest.cc
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/common/service_worker/service_worker_event_dispatcher.typemap
[delete] https://crrev.com/cae1c0463a0277e5a48bd23046346b1df1583216/content/common/service_worker/service_worker_status_code_traits.cc
[delete] https://crrev.com/cae1c0463a0277e5a48bd23046346b1df1583216/content/common/service_worker/service_worker_status_code_traits.h
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/renderer/service_worker/service_worker_context_client.cc
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/renderer/service_worker/service_worker_context_client.h
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/renderer/service_worker/service_worker_type_converters.cc
[modify] https://crrev.com/4138590db8499ec8868cdfe81d657c78e5b1eff9/content/renderer/service_worker/service_worker_type_converters.h

Project Member

Comment 2 by bugdroid1@chromium.org, Oct 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/125694f918e87ffcb1d7de29af9f148ccac43f4f

commit 125694f918e87ffcb1d7de29af9f148ccac43f4f
Author: Matt Falkenhagen <falken@chromium.org>
Date: Fri Oct 06 06:01:06 2017

service worker: Remove WebServiceWorkerEventResult.

It can be replaced with mojom::ServiceWorkerEventStatus.

Bug:  771829 
Change-Id: Ie6db6b3b61eadb371fedcbc2322b9ada4a84052a
TBR: dcheng
Reviewed-on: https://chromium-review.googlesource.com/702083
Commit-Queue: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506991}
[modify] https://crrev.com/125694f918e87ffcb1d7de29af9f148ccac43f4f/content/browser/DEPS
[modify] https://crrev.com/125694f918e87ffcb1d7de29af9f148ccac43f4f/content/browser/push_messaging/push_messaging_router.h
[modify] https://crrev.com/125694f918e87ffcb1d7de29af9f148ccac43f4f/content/common/DEPS
[modify] https://crrev.com/125694f918e87ffcb1d7de29af9f148ccac43f4f/content/common/service_worker/service_worker_messages.h
[modify] https://crrev.com/125694f918e87ffcb1d7de29af9f148ccac43f4f/content/renderer/service_worker/service_worker_context_client.cc
[modify] https://crrev.com/125694f918e87ffcb1d7de29af9f148ccac43f4f/content/renderer/service_worker/service_worker_context_client.h
[modify] https://crrev.com/125694f918e87ffcb1d7de29af9f148ccac43f4f/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScopeClient.cpp
[modify] https://crrev.com/125694f918e87ffcb1d7de29af9f148ccac43f4f/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScopeClient.h
[modify] https://crrev.com/125694f918e87ffcb1d7de29af9f148ccac43f4f/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScopeProxy.cpp
[modify] https://crrev.com/125694f918e87ffcb1d7de29af9f148ccac43f4f/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.cpp
[modify] https://crrev.com/125694f918e87ffcb1d7de29af9f148ccac43f4f/third_party/WebKit/public/BUILD.gn
[delete] https://crrev.com/e811ce55fa4652fe3f10489363f1d6192455d692/third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerEventResult.h
[modify] https://crrev.com/125694f918e87ffcb1d7de29af9f148ccac43f4f/third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerContextClient.h

Comment 3 by laforge@google.com, Nov 7 2017

Components: Internals>Network>Service

Comment 4 by laforge@google.com, Nov 7 2017

Components: -Internals>Network>Service Internals>Services>Network
Apologies, applied the wrong component in bulk.

Comment 5 by falken@chromium.org, May 14 2018

Status: Fixed (was: Started)
Summary: Remove WebServiceWorkerEventResult (was: Remove WebServiceWorkerEventResult and SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED)
I fixed the main issue about crashing and the typemapping.

There is probably more refactoring possible here. We still have REJECTED vs ABORTED in ServiceWorkerEventStatus and it's possible we only need one, and we have SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED still. But there is not much harm at the moment and there's no need for a bug for a vague refactoring idea.

Sign in to add a comment