Now Debug Web Workers with Chrome Developer Tools

Google now let you debug Web Workers with Chrome Developer Tools, that provides full debugging support for scripts running in both dedicated and shared workers. "You can now use the powerful Scripts, Timeline, Profiles and Console panels to develop Web Workers," posted by Yury Semikhatsky, Software Engineer."When you need to debug a shared worker initialization, […]

Google now let you debug Web Workers with Chrome Developer Tools, that provides full debugging support for scripts running in both dedicated and shared workers. "You can now use the powerful Scripts, Timeline, Profiles and Console panels to develop Web Workers," posted by Yury Semikhatsky, Software Engineer.

"When you need to debug a shared worker initialization, it is enough to terminate the current instance of the worker leaving the Developer Tools window open and reload one of the worker clients. The worker will restart and Developer Tools window will automatically re-attach to the new instance," explained Semikhatsky.

"All dedicated workers running in the inspected page are listed in the Scripts panel, under the Workers section. Clicking on a worker URL will open a new Developer Tools window attached to the worker. If you need to debug a dedicated worker's initialization, there is also an option to pause workers on start. This will suspend the execution in all starting dedicated workers at the very first statement," Semikhatsky explained.

"Shared workers are more independent than dedicated ones as they can be used concurrently by several pages."

Debug Web Workers using Chrome Developers Tools

All running shared workers can be discovered through the chrome://inspect page. "Each shared worker listed there has inspect and terminate links next to its URL. These links allow you to launch a Developer Tools window attached to that worker or terminate the worker respectively," Semikhatsky adds.

To learn more on Developer Tools check out this documentation.