Closed Bug 1279577 Opened 8 years ago Closed 4 years ago

Allow debugging on service worker scripts during install process

Categories

(DevTools :: about:debugging, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1603190

People

(Reporter: bkelly, Unassigned)

References

(Blocks 1 open bug)

Details

Right now its only possible to debug service worker scripts that show in about:debugging.  Generally this means that the service worker was already installed successfully.

Since one of the major pain points is figuring out why your service worker does not install, though, we should think of a way to debug that case.  Some setting that auto-launches a debugger and breaks when a new service worker is launched.  Ideally this would be controlled by scope or script URL somehow.
I think the best way to do this would be to automatically open the worker debugger window if the service worker script has a `debugger` statement.

Eddy, what do you think?
Flags: needinfo?(ejpbruel)
(In reply to Ben Kelly [:bkelly] from comment #1)
> I think the best way to do this would be to automatically open the worker
> debugger window if the service worker script has a `debugger` statement.
> 
> Eddy, what do you think?

I think that that's the way to go, but it won't work out of the box: debugger statements are ignored unless the debugger is actually observing the script in which it occurs. That means we must load a debugger server in the service worker *before* it starts running, otherwise we might end up missing the debugger statement.

Loading a debugger in a worker before the worker starts running is not completely trivial either. The worker will notify the debugger server on the main thread when it has been registered, but if we then try to start a debugger server in the worker, we end up racing against the worker starting to run.

To avoid this, we need bug 1241965. I already made good progress on a patch for that bug. Unfortunately, it never landed, because I ended up being distracted by other stuff.
Flags: needinfo?(ejpbruel)
Well, we don't want a lot of overhead on scripts without a debugger statement.  So I'm a bit Leary of creating a debugger for every service worker thread across the board.
Depends on: 1215379
Priority: -- → P3
Depends on: 1241965
Product: Firefox → DevTools

This will be handled by the Debugger when support for sw debugging and early breakpoints is implemented.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.