Skip to content

Conversation

@connorjclark
Copy link
Collaborator

Fixes #13410

Currently we vary how this is implemented by overriding a function in ReportUIFeatures. See the following from DevTools:

https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/panels/lighthouse/LighthouseReportRenderer.ts;l=175;drc=93a4454b7c558d6ca748c718167bc4aa592eaf63

Ideally we'd be able to provide a default implementation that worked in all clients, but there are some issues:

  • document.documentElement.outerHTML only works for the standalone report. If the report is embedded into some arbitrary page, this is too much.
  • The implementation before this PR aimed to be the default implementation that works in all clients, but it actually misses all scripts.

DevTools (aside: we still need to migrate it to use the new report API) will continue to use Lighthouse.ReportGenerator (which is included as a separate bundle), but instead of overriding that function we will use this new option.

@brendankenny
Copy link
Contributor

  • viewer needs to be updated too or its Save as HTML disappears there (example from deploy)

  • Ideally we'd be able to provide a default implementation that worked in all clients, but there are some issues:

    • document.documentElement.outerHTML only works for the standalone report. If the report is embedded into some arbitrary page, this is too much.

    It would be ideal to have a default. Where is this an issue? report: introduce the new report api, add dom.rootEl #13277 introduced using rootEl.outerHTML instead of documentElement.outerHTML, but it's not entirely clear why it made the switch. PSI doesn't have the dropdown available, so it seems kind of a theoretical worry that motivated the switch to rootEl.

  • needs tests! If we're going to inject these, at the very least it makes testing easy :)

@connorjclark
Copy link
Collaborator Author

It would be ideal to have a default. Where is this an issue?

If the default were grabbing the outerHTML of some element (rootEl, documentElement, etc) then our issue would be targeting the correct element for reports embedded in other pages while also getting the scripts we need. Bu an embedding page might inject the scripts in arbitrary places, so how would we get the scripts without double-including them?

If the default were using ReportGenerator, now we have the standalone report including all that extra code unnecessarily.

@brendankenny
Copy link
Contributor

If the default were grabbing the outerHTML of some element (rootEl, documentElement, etc) then our issue would be targeting the correct element for reports embedded in other pages while also getting the scripts we need. Bu an embedding page might inject the scripts in arbitrary places, so how would we get the scripts without double-including them?

Yes, I was asking more literally where this is an issue :) PSI doesn't have this problem, so there's no report we support where this is an issue and we're mostly guessing what people need (tradeoff between the fiddliness of the default standalone report and supporting theoretical future users of the report API). New report test coverage is good regardless :)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dropdown menu does not work in "save as html" report from standalone report

4 participants