I’ve been wishing for this for a long time and the fine folks at Google delivered. Imagine being able to see the full stack trace when debugging, i.e. when tracing against an AJAX or a setTimeout()! You can do this in Chrome Canary already; read on for how to set it up:
As shown in the “vs.” screenshot above, debugging the following piece of code can be made much easier by being able to see the “full story” behind the async stack trace:
function origin() { alert('starting'); setTimeout(function() { alert('done; make sure dev tools are open for debugger to trigger'); debugger; }, 100); } origin(); |
To use this amazing tool:
- Get Chrome Canary: https://www.google.com/intl/en/chrome/browser/canary.html
- Go to chrome://flags (in Chrome Canary)
- Check ‘Enable Developer Tool Experiments’:
- Click “Relaunch Now” at the very bottom of the page:
- Open Dev Tools:
- Open Dev Tools Settings (gear icon):
- In Experiments view – check ‘Enable support for async stack traces’:
- Close Dev Tools Settings and go to Sources tab; check the ‘Async’ checkbox on the right by “Call Stack”
- Restart Canary
- Now you can try running my fiddle (with Dev Tools open) and it will pause on the “debugger” statement right after the second alert window; enjoy your full async stack trace!