What's New In DevTools (Chrome 70)

Welcome back! It's been about 12 weeks since our last update, which was for Chrome 68. We skipped Chrome 69 because we didn't have enough new features or UI changes to warrant a post.

New features and major changes coming to DevTools in Chrome 70 include:

Read on, or watch the video version of this doc:

Live Expressions in the Console

Pin a Live Expression to the top of your Console when you want to monitor its value in real-time.

  1. Click Create Live Expression Create Live Expression. The Live Expression UI opens.

    The Live Expression UI

    Figure 1. The Live Expression UI

  2. Type the expression that you want to monitor.

    Typing Date.now() into the Live Expression UI.

    Figure 2. Typing Date.now() into the Live Expression UI

  3. Click outside of the Live Expression UI to save your expression.

    A saved Live Expression.

    Figure 3. A saved Live Expression

Live Expression values update every 250 milliseconds.

Highlight DOM nodes during Eager Evaluation

Type an expression that evaluates to a DOM node in the Console and Eager Evaluation now highlights that node in the viewport.

After typing document.activeElement in the Console a node is highlighted in the viewport.

Figure 4. Since the current expression evaluates to a node, that node is highlighted in the viewport

Here are some expressions you may find useful:

  • document.activeElement for highlighting the node that currently has focus.
  • document.querySelector(s) for highlighting an arbitrary node, where s is a CSS selector. This is equivalent to hovering over a node in the DOM Tree.
  • $0 for highlighting whatever node is currently selected in the DOM Tree.
  • $0.parentElement to highlight the parent of the currently-selected node.

Performance panel optimizations

When profiling a large page, the Performance panel previously took tens of seconds to process and visualize the data. Clicking on a event to learn more about it in the Summary tab also sometimes took multiple seconds to load. Processing and visualizing is faster in Chrome 70.

Processing and loading Performance data.

Figure 5. Processing and loading Performance data

More reliable debugging

Chrome 70 fixes some bugs that were causing breakpoints to disappear or not get triggered.

It also fixes bugs related to source maps. Some TypeScript users would instruct DevTools to ignore a certain TypeScript file while stepping through code, and instead DevTools would ignore the entire bundled JavaScript file. These fixes also address an issue that was causing the Sources panel to generally run slowly.

Enable network throttling from the Command Menu

You can now set network throttling to fast 3G or slow 3G from the Command Menu.

Network throttling commands in the Command Menu.

Figure 6. Network throttling commands in the Command Menu

Autocomplete Conditional Breakpoints

Use the Autocomplete UI to type out your Conditional Breakpoint expressions faster.

The Autocomplete UI

Figure 7. The Autocomplete UI

Did you know? The Autocomplete UI is possible thanks to CodeMirror, which also powers the Console.

Break on AudioContext events

Use the Event Listener Breakpoints pane to pause on the first line of an AudioContext lifecycle event handler.

AudioContext is part of the Web Audio API, which you can use to process and synthesize audio.

AudioContext events in the Event Listener Breakpoints pane.

Figure 8. AudioContext events in the Event Listener Breakpoints pane

Debug Node.js apps with ndb

ndb is a new debugger for Node.js applications. On top of the usual debugging features that you get through DevTools, ndb also offers:

  • Detecting and attaching to child processes.
  • Placing breakpoints before modules are required.
  • Editing files within the DevTools UI.
  • Ignoring all scripts outside of the current working directory by default.

The ndb UI.

Figure 9. The ndb UI

Check out ndb's README to learn more.

Bonus tip: Measure real world user interactions with the User Timing API

Want to measure how long it takes real users to complete critical journeys on your pages? Consider instrumenting your code with the User Timing API.

For example, suppose you wanted to measure how long a user spends on your homepage before clicking your call-to-action (CTA) button. First, you would mark the beginning of the journey in an event handler associated to a page load event, such as DOMContentLoaded:

document.addEventListener('DOMContentLoaded', () => {
  window.performance.mark('start');
});

Then, you would mark the end of the journey and calculate its duration when the button is clicked:

document.querySelector('#CTA').addEventListener('click', () => {
  window.performance.mark('end');
  window.performance.measure('CTA', 'start', 'end');
});

You can also extract your measurements, making it easy to send them to your analytics service to collect anonymous, aggregated data:

const CTA = window.performance.getEntriesByName('CTA')[0].duration;

DevTools automatically marks up your User Timing measurements in the User Timing section of your Performance recordings.

The User Timing section.

Figure 10. The User Timing section

This also comes in handy when debugging or optimizing code. For example, if you want to optimize a certain phase of your lifecycle, call window.performance.mark() at the beginning and end of your lifecycle function. React does this in development mode.

Download the preview channels

Consider using the Chrome Canary, Dev, or Beta as your default development browser. These preview channels give you access to the latest DevTools features, let you test cutting-edge web platform APIs, and help you find issues on your site before your users do!

Get in touch with the Chrome DevTools team

Use the following options to discuss the new features, updates, or anything else related to DevTools.

What's new in DevTools

A list of everything that has been covered in the What's new in DevTools series.