lighthouse 9.3.1-dev.20220213 → 9.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/report/bundle.esm.js +22 -18
  2. package/dist/report/flow.js +4 -4
  3. package/dist/report/standalone.js +5 -5
  4. package/flow-report/src/topbar.tsx +1 -1
  5. package/flow-report/src/wrappers/report.tsx +2 -1
  6. package/flow-report/test/topbar-test.tsx +1 -1
  7. package/lighthouse-cli/bin.js +1 -4
  8. package/lighthouse-cli/test/smokehouse/core-tests.js +2 -3
  9. package/lighthouse-core/audits/autocomplete.js +34 -37
  10. package/lighthouse-core/audits/byte-efficiency/uses-long-cache-ttl.js +1 -0
  11. package/lighthouse-core/config/default-config.js +2 -2
  12. package/lighthouse-core/fraggle-rock/config/default-config.js +3 -3
  13. package/lighthouse-core/gather/driver/wait-for-condition.js +11 -4
  14. package/lighthouse-core/gather/gatherers/full-page-screenshot.js +35 -9
  15. package/lighthouse-core/gather/gatherers/inputs.js +113 -0
  16. package/lighthouse-core/lib/sentry.js +39 -24
  17. package/lighthouse-core/runner.js +1 -1
  18. package/package.json +2 -3
  19. package/report/renderer/dom.js +1 -3
  20. package/report/renderer/report-ui-features.js +16 -14
  21. package/report/renderer/topbar-features.js +5 -1
  22. package/report/test-assets/faux-psi.js +2 -1
  23. package/report/types/report-renderer.d.ts +14 -2
  24. package/shared/localization/locales/en-US.json +1 -1
  25. package/shared/localization/locales/en-XL.json +1 -1
  26. package/types/artifacts.d.ts +14 -14
  27. package/types/parse-cache-control/index.d.ts +1 -0
  28. package/changelog.md +0 -5803
  29. package/lighthouse-core/gather/gatherers/form-elements.js +0 -113
  30. package/lighthouse-core/scripts/package.json +0 -4
@@ -1776,10 +1776,8 @@ class DOM {
1776
1776
  * @param {string} filename
1777
1777
  */
1778
1778
  saveFile(blob, filename) {
1779
- const ext = blob.type.match('json') ? '.json' : '.html';
1780
-
1781
1779
  const a = this.createElement('a');
1782
- a.download = `${filename}${ext}`;
1780
+ a.download = filename;
1783
1781
  this.safelySetBlobHref(a, blob);
1784
1782
  this._document.body.appendChild(a); // Firefox requires anchor to be in the DOM.
1785
1783
  a.click();
@@ -5501,7 +5499,11 @@ class TopbarFeatures {
5501
5499
  }
5502
5500
 
5503
5501
  _print() {
5504
- self.print();
5502
+ if (this._reportUIFeatures._opts.onPrintOverride) {
5503
+ this._reportUIFeatures._opts.onPrintOverride(this._dom.rootEl);
5504
+ } else {
5505
+ self.print();
5506
+ }
5505
5507
  }
5506
5508
 
5507
5509
  /**
@@ -5729,12 +5731,13 @@ class ReportUIFeatures {
5729
5731
  this._setupThirdPartyFilter();
5730
5732
  this._setupElementScreenshotOverlay(this._dom.rootEl);
5731
5733
 
5732
- let turnOffTheLights = false;
5733
5734
  // Do not query the system preferences for DevTools - DevTools should only apply dark theme
5734
5735
  // if dark is selected in the settings panel.
5735
- const disableDarkMode = this._dom.isDevTools() || this._opts.disableAutoDarkModeAndFireworks;
5736
+ // TODO: set `disableDarkMode` in devtools and delete this special case.
5737
+ const disableDarkMode = this._dom.isDevTools() ||
5738
+ this._opts.disableDarkMode || this._opts.disableAutoDarkModeAndFireworks;
5736
5739
  if (!disableDarkMode && window.matchMedia('(prefers-color-scheme: dark)').matches) {
5737
- turnOffTheLights = true;
5740
+ toggleDarkTheme(this._dom, true);
5738
5741
  }
5739
5742
 
5740
5743
  // Fireworks!
@@ -5744,13 +5747,12 @@ class ReportUIFeatures {
5744
5747
  const cat = lhr.categories[id];
5745
5748
  return cat && cat.score === 1;
5746
5749
  });
5747
- if (scoresAll100 && !this._opts.disableAutoDarkModeAndFireworks) {
5748
- turnOffTheLights = true;
5750
+ const disableFireworks =
5751
+ this._opts.disableFireworks || this._opts.disableAutoDarkModeAndFireworks;
5752
+ if (scoresAll100 && !disableFireworks) {
5749
5753
  this._enableFireworks();
5750
- }
5751
-
5752
- if (turnOffTheLights) {
5753
- toggleDarkTheme(this._dom, true);
5754
+ // If dark mode is allowed, force it on because it looks so much better.
5755
+ if (!disableDarkMode) toggleDarkTheme(this._dom, true);
5754
5756
  }
5755
5757
 
5756
5758
  // Show the metric descriptions by default when there is an error.
@@ -6004,14 +6006,16 @@ class ReportUIFeatures {
6004
6006
  }
6005
6007
 
6006
6008
  /**
6007
- * DevTools uses its own file manager to download files, so it redefines this function.
6008
- * Wrapper is necessary so DevTools can still override this function.
6009
- *
6010
6009
  * @param {Blob|File} blob
6011
6010
  */
6012
6011
  _saveFile(blob) {
6013
- const filename = fileNamer.getLhrFilenamePrefix(this.json);
6014
- this._dom.saveFile(blob, filename);
6012
+ const ext = blob.type.match('json') ? '.json' : '.html';
6013
+ const filename = fileNamer.getLhrFilenamePrefix(this.json) + ext;
6014
+ if (this._opts.onSaveFileOverride) {
6015
+ this._opts.onSaveFileOverride(blob, filename);
6016
+ } else {
6017
+ this._dom.saveFile(blob, filename);
6018
+ }
6015
6019
  }
6016
6020
  }
6017
6021