Chrome: How to step into code not available in debugger?

It’s been a while, but I am back!

Came across a situation today where I wanted to step through some javascript code that had been installed by a third party (in this case, a puppeteer script) so there was no source code available in the Sources tab to set a breakpoint in.

I used the following trick to allow me to step through the code.  First I turned on break on exception, and ticked pause on caught exceptions, then entered the following into the console…

try { undefined.a; } catch(e) { somethingWantToStepInto(); }

The undefined.a triggers an exception, which is caught and can be stepped into, so I can step through the code in the catch.  There may be another way to achieve this I don’t know, but thought this was a neat trick.

 

 

About austinfrance

Technical Developer @ RedSky IT / Explorer Software
This entry was posted in Chrome, debugging, JavaScript, Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s