New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 604338 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

Refine the logic of attaching DevTools to ServiceWorker.

Project Member Reported by horo@chromium.org, Apr 18 2016

Issue description

This issue is spawned from  issue 584296 .

Within a Service Worker registration, there may be three Service Workers (intalling, waiting and active).
Currently devtools::service_worker::ServiceWorkerHandler chooses the newest Service Worker from them.
If the page is controlled by an active Service Worker (SW-A), one second after the page load, Chrome starts another Service Worker (SW-B) to check the script update.
At this moment, ServiceWorkerHandler detaches SW-A and attaches SW-B.
So DevTools can show the network request for the SW-B's script.

If there is no difference in the scripts, SW-B stops soon. And ServiceWorkerHandler attaches SW-A to DevTools again.
This behavior is super confusing if the developer is debugging SW-A.

If the script of SW-B is different from SW-A, SW-B executes install event handlers.
And if "skipWaiting()" is executed in the SW-B, SW-B executes activate event handlers.
In the current behavior of Chrome, the developer can debug these event handlers of SW-B using a breakpoint as pfeldman@ mentioned https://crrev.com/1841863003/#msg4.
So debugOnStartCheckbox was removed in the cl.

But if skipWaiting() is not called, SW-A is still the active worker. So if the page fetches resource requests, the fetch events are fired in SW-A.
The developer can't debug those fetch events while DevTools is attached to SW-B.

pfeldman@ said
> - Each page is tied to at most one SW registration. But within this SW registration, there may be three SWs: the installing, waiting, and active SWs.
>
> And all of them are shown in the resources panel under service worker. But as far as the JavaScript debugging is concerned, only "active" one is of interest, so we keep active as a debug target beside the page.

But I think the developer should be able to debug all three SWs with the DevTools.
Because:
- DevTools should show the network request for the SW-B's script.
- SW-A should not be detached while it is active.
- The developer should be able to debug install/activate event handlers.

pfeldman@
What do you think about it?
 

Comment 1 by horo@chromium.org, Apr 19 2016

Cc: kenjibaheux@chromium.org
Status: Fixed (was: Assigned)

Sign in to add a comment