Sub topic 3
Inspecting Storage, Cookies and Runtime Behavior
Assume basic HTML, CSS, JavaScript, browser loading, and HTTP requests. The panel names below follow Chromium-based browsers.
Inspecting storage and service workers
Open the Application panel to inspect data that survives page reloads:
- Local Storage stores key-value strings for a site.
- Session Storage lasts for one browser tab.
- Cookies can be sent with HTTP requests. Check their domain, path, expiration, Secure flag, and SameSite setting.
- IndexedDB stores larger structured data.
- Service Workers run separately from the page and can intercept requests, cache files, and support offline behavior.
Use Clear storage when testing first-visit behavior. You can also unregister a service worker and remove its caches. This helps distinguish a code problem from stale cached files.
Testing responsive layouts and slow connections
Use the device toolbar to change viewport width, device pixel ratio, and orientation. Test breakpoints where the layout changes, not only common phone sizes. In the Network panel, choose a throttled connection such as Fast 3G. Reload with the cache disabled to observe the first-load experience.
Recording and reading a performance profile
In the Performance panel, start a recording, interact with the page, and stop recording. Look for long tasks, usually JavaScript work lasting more than 50 milliseconds. Inspect scripting, layout, paint, and rendering tracks together. A large layout or paint event after a small interaction can indicate expensive DOM or CSS work.
performance.mark('work-start');
// Run the interaction or operation you want to measure here.
performance.mark('work-end');
performance.measure('measured-work', 'work-start', 'work-end');The measure appears in the recording's Timings track.
Finding memory leaks with heap snapshots
Take a heap snapshot before an action and another after repeating that action. Compare retained objects. If detached DOM nodes, event listeners, or application arrays keep growing, something remains reachable when it should have been released.
const retained = [];
document.addEventListener('click', () => {
retained.push(new Array(100_000).fill('item'));
});This intentionally retains data. Use it only in a test page.
Running and interpreting Lighthouse audits
Run Lighthouse for the target device and page state. Treat its results as evidence for investigation, not as a complete test. Check the failing audit, its measured URL or element, and its suggested fix. Re-run after changes, and record whether the user-visible behavior improved.
Exercise
Which panel should you open first when a page shows old content after a deployment?
Show answer
Open Application to inspect service workers and caches, then clear storage or unregister the worker and reload.