What's New In DevTools (Chrome 59)
Welcome to another installment of the DevTools release notes. Here's what's new for Chrome 59.
Note: You can check which version of Chrome you're running at chrome://help
.
Highlights
- CSS and JS code coverage. Find unused CSS and JS with the new Coverage tab.
- Full-page screenshots. Take a screenshot of the entire page, from the top of the viewport to the bottom.
- Block requests. Manually disable individual requests in the Network panel.
- Step over async await. Step through async functions predictably.
- Unified Command Menu. Execute commands and open files from the newly-unified Command Menu.
- Workspaces 2.0. Check out the new UX for using DevTools as your code editor.
New features
CSS and JS code coverage
Find unused CSS and JS code with the new Coverage tab. When you load or run a page, the tab tells you how much code was used, versus how much was loaded. You can reduce the size of your pages by only shipping the code that you need.
To open the tab:
- Open the Command Menu.
- Start typing
Coverage
and select Show Coverage.
Full-page screenshots
Check out the video below to learn how to take a screenshot from the top of the page, all the way to the bottom.
Block requests
Want to see how your page behaves when a particular script, stylesheet, or other resource isn't available? Right-click on the request in the Network panel and select Block Request URL. A new Request blocking tab pops up in the Drawer, which lets you manage blocked requests.
Step over async await
Up until now, trying to step through code like the snippet below was a
headache. You'd be in the middle of test()
, stepping over a line, and then
you'd get interrupted by the setInterval()
code. Now, when you step through
async code like test()
, DevTools steps from the first to last line with
consistency.
function wait(ms) {
return new Promise(r => setTimeout(r, ms)).then(() => "Yay");
}
// do some work in background.
setInterval(() => 42, 200);
async function test() {
debugger;
const hello = "world";
const response = await fetch('index.html');
const tmp = await wait(1000);
console.log(tmp);
return hello;
}
async function runTest() {
let result = await test();
console.log(result);
}
P.S. want to level up your debugging skills? Check out these new-ish docs:
Workspaces 2.0
The new UX for using DevTools as your code editor, also known as Workspaces or Persistence, has been released from Experiments.
- Go to the Sources panel.
- Click the Filesystem tab.
- Click Add folder to workspace.
- Select the folder in your filesystem containing your source code.
- Click Allow to grant DevTools read and write access to the folder.
DevTools automagically maps the files in your filesystem to the files being served from the network. No more need to manually map one to the other.
Changes
Unified Command Menu
When you open the Command Menu now, notice that your command
is prepended with a greater-than character (>
). This is because the Command
Menu has been unified with the Open File menu, which is
Command+O (Mac), or Control+O
(Windows, Linux).