Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source Map is downloaded during performance audit #12064

Closed
developit opened this issue Feb 8, 2021 · 8 comments · Fixed by #12199
Closed

Source Map is downloaded during performance audit #12064

developit opened this issue Feb 8, 2021 · 8 comments · Fixed by #12199

Comments

@developit
Copy link

Provide the steps to reproduce

  1. Run LH on https://preactjs.com

What is the current behavior?

During the lighthouse Performance audit, Source Map files are downloaded:

lighthouse-sourcemap-download.mov

What is the expected behavior?

No downloads are triggered during Lighthouse execution.

Environment Information

  • Affected Channels: Extension (did not test others)
  • Lighthouse version: 7.0.0
  • Chrome version: 89.0.4389.40 (Official Build) beta (x86_64)
  • Node.js version: 12.9
  • Operating System: MacOS

Related issues

https://support.google.com/webmasters/thread/86647663?hl=en

@paulirish
Copy link
Member

Since we're a diagnostic tool, I think it's totally fair for Lighthouse to attempt these downloads. We do it to provide better detail and actionability in the opportunities.

Similarly, chrome devtools makes the same network requests if JS sourcemaps are enabled (the default).

I see the webmasters support thread.... but it's unclear how this is a problem for site owners... perhaps it's unexpected to see them in request logs?

@patrickhulce
Copy link
Collaborator

I think think the issue in the video that's valid is that it prompts Chrome's download UI. DevTools doesn't trigger Chrome's download UI. Probably to do with our weird iframe fetcher?

@brendankenny
Copy link
Member

brendankenny commented Feb 9, 2021

ah, yeah, I didn't spot that in the video either :) In theory the request should be cancelled and never download:

// Fail the request (from the page's perspective) so that the iframe never loads.
await this.driver.sendCommand('Fetch.failRequest', {requestId, errorReason: 'Aborted'});

Can't repro in CLI but I can in DevTools (Chrome 90, Lighthouse 7.0.1).

@brendankenny
Copy link
Member

Since we last discussed protocol support for fetching resources, the protocol method has landed (Network.loadNetworkResource), though I believe it still blocks the CORS case. Its options object does optimistically mention it "may be extended later to better support CORS, CORB and streaming", though.

@paulirish
Copy link
Member

Since we last discussed protocol support for fetching resources, the protocol method has landed (Network.loadNetworkResource), though I believe it still blocks the CORS case. Its options object does optimistically mention it "may be extended later to better support CORS, CORB and streaming", though.

i looked into this stuff a bit and filed a new issue: Improve generalized/sourcemap fetcher #12070

@paulirish
Copy link
Member

I was looking as to why one would use octet-stream as the mimetype for sourcemaps... Looks like some bozo confirmed it was fine 8 years ago. 😳

But yes unfortunately that mimetype + how lighthouse fetches == a download. We can change this in Lighthouse but, @developit, in the meantime.. serving sourcemaps as application/json would be the workaround.

@adamraine
Copy link
Member

Should we close this in favor of #12070? The current fetcher is also incompatible with some CSPs.

Considering there are two issues breaking the current fetcher, we should probably seek a different implementation that uses Network.loadNetworkResource.

@paulirish
Copy link
Member

Should we close this in favor of #12070?

good call. sg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants