GoogleChrome / GoogleChrome/lighthouse

no extension warning for chrome-extension runtime cost

Open
#14,651 2 comments 0 reactions 1 assignee Claimed by @paulirish View on GitHub
bug internals P2 simulation / lantern
Dominant language
JavaScript
Stars
30.8k
Forks
9.8k
Avg merge
1d 14h
Merged PRs (30d)
20

Description

From: https://social.ayco.io/@ayo/109625339833530015

If you install the [React Developer Tools extension](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en), you can end up with multiple entries from the extension in the unused javascript table.

![Lighthouse unused JavaScript audit result showing 'chrome-extension' urls loaded in the page](https://user-images.githubusercontent.com/316891/210866920-f4a77489-a8c7-4a9e-be13-d0ddc366f49a.png)

These are legitimate network entries, the extension really is injecting script tags into the page to load resources from the extension's files

![Chrome script debugger showing script tag injection into the host page](https://user-images.githubusercontent.com/316891/210867522-90086a72-5810-4454-ae9d-de1f358bee4f.png)

And they show up in the network panel as well, even on non-react pages:

![network waterfall for example.com showing a script loaded from ](https://user-images.githubusercontent.com/316891/210867648-e1f88cfc-f146-43ac-90d6-eae9d5f55179.png)

Two issues:
- The opportunity savings look like they're overestimated. There's real impact (that 427kB script took 36ms to presumably load from SSD and cross processes on my machine, and from the user's screenshot there could be many more files loaded in some situations), but these files are being treated as [loading from network](https://github.com/GoogleChrome/lighthouse/blob/437eb4d757c52cd19994ccf80e91e872cf2f62c7/core/lib/dependency-graph/simulator/simulator.js#L292-L314) instead of from disk due to [`chrome-extension` not being included in `NON_NETWORK_SCHEMES`](https://github.com/GoogleChrome/lighthouse/blob/437eb4d757c52cd19994ccf80e91e872cf2f62c7/core/lib/url-utils.js#L16-L25). Seems like not an issue to add it to the set (I assume it's just been an oversight), but would need to double check other callers of `isNonNetworkProtocol`.

- Because this is just network activity with minimal js tasks (at least on my machine), you don't get an extension warning at the top of the report since the "Chrome extensions negatively affected this page's load performance" is based [just on extension-caused task length](https://github.com/GoogleChrome/lighthouse/blob/437eb4d757c52cd19994ccf80e91e872cf2f62c7/core/audits/bootup-time.js#L99-L100). It's possible these files don't have an enormous negative effect on page load, but if they're big enough to show up in the audit after fixing the non-network url handling, there should probably be a warning explaining things (maybe time to consider implementing [that TODO](https://github.com/GoogleChrome/lighthouse/blob/437eb4d757c52cd19994ccf80e91e872cf2f62c7/core/audits/bootup-time.js#L114))

cc @bramus

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.