lighthouse 9.5.0-dev.20220607 → 9.6.2

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 (262) hide show
  1. package/dist/report/bundle.esm.js +467 -520
  2. package/dist/report/flow.js +22 -22
  3. package/dist/report/standalone.js +19 -19
  4. package/flow-report/src/summary/category.tsx +1 -1
  5. package/flow-report/src/topbar.tsx +2 -10
  6. package/flow-report/src/util.ts +1 -1
  7. package/flow-report/test/topbar-test.tsx +8 -7
  8. package/jest.config.js +1 -1
  9. package/lighthouse-cli/.eslintrc.cjs +4 -3
  10. package/lighthouse-cli/bin.js +1 -0
  11. package/lighthouse-cli/cli-flags.js +4 -3
  12. package/lighthouse-cli/commands/commands.js +1 -0
  13. package/lighthouse-cli/commands/list-audits.js +1 -0
  14. package/lighthouse-cli/commands/list-locales.js +1 -0
  15. package/lighthouse-cli/commands/list-trace-categories.js +1 -0
  16. package/lighthouse-cli/index.js +1 -0
  17. package/lighthouse-cli/printer.js +1 -0
  18. package/lighthouse-cli/run.js +24 -9
  19. package/lighthouse-cli/sentry-prompt.js +1 -0
  20. package/lighthouse-cli/test/smokehouse/core-tests.js +1 -0
  21. package/lighthouse-cli/test/smokehouse/frontends/back-compat-util.js +1 -0
  22. package/lighthouse-cli/test/smokehouse/frontends/lib.js +1 -0
  23. package/lighthouse-cli/test/smokehouse/frontends/node.js +1 -0
  24. package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +1 -0
  25. package/lighthouse-cli/test/smokehouse/lib/child-process-error.js +1 -0
  26. package/lighthouse-cli/test/smokehouse/lib/concurrent-mapper.js +1 -0
  27. package/lighthouse-cli/test/smokehouse/lib/local-console.js +1 -0
  28. package/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js +23 -109
  29. package/lighthouse-cli/test/smokehouse/lighthouse-runners/cli.js +3 -2
  30. package/lighthouse-cli/test/smokehouse/lighthouse-runners/devtools.js +19 -28
  31. package/lighthouse-cli/test/smokehouse/report-assert.js +4 -3
  32. package/lighthouse-cli/test/smokehouse/smokehouse.js +1 -1
  33. package/lighthouse-cli/test/smokehouse/version-check-test.js +3 -0
  34. package/lighthouse-cli/test/smokehouse/version-check.js +1 -0
  35. package/lighthouse-core/audits/accessibility/accesskeys.js +1 -1
  36. package/lighthouse-core/audits/accessibility/aria-allowed-attr.js +1 -1
  37. package/lighthouse-core/audits/accessibility/aria-command-name.js +1 -1
  38. package/lighthouse-core/audits/accessibility/aria-hidden-body.js +1 -1
  39. package/lighthouse-core/audits/accessibility/aria-hidden-focus.js +1 -1
  40. package/lighthouse-core/audits/accessibility/aria-input-field-name.js +1 -1
  41. package/lighthouse-core/audits/accessibility/aria-meter-name.js +1 -1
  42. package/lighthouse-core/audits/accessibility/aria-progressbar-name.js +1 -1
  43. package/lighthouse-core/audits/accessibility/aria-required-attr.js +1 -1
  44. package/lighthouse-core/audits/accessibility/aria-required-children.js +1 -1
  45. package/lighthouse-core/audits/accessibility/aria-required-parent.js +1 -1
  46. package/lighthouse-core/audits/accessibility/aria-roles.js +1 -1
  47. package/lighthouse-core/audits/accessibility/aria-toggle-field-name.js +1 -1
  48. package/lighthouse-core/audits/accessibility/aria-tooltip-name.js +1 -1
  49. package/lighthouse-core/audits/accessibility/aria-treeitem-name.js +1 -1
  50. package/lighthouse-core/audits/accessibility/aria-valid-attr-value.js +1 -1
  51. package/lighthouse-core/audits/accessibility/aria-valid-attr.js +1 -1
  52. package/lighthouse-core/audits/accessibility/button-name.js +1 -1
  53. package/lighthouse-core/audits/accessibility/bypass.js +1 -1
  54. package/lighthouse-core/audits/accessibility/color-contrast.js +1 -1
  55. package/lighthouse-core/audits/accessibility/definition-list.js +1 -1
  56. package/lighthouse-core/audits/accessibility/dlitem.js +1 -1
  57. package/lighthouse-core/audits/accessibility/document-title.js +1 -1
  58. package/lighthouse-core/audits/accessibility/duplicate-id-active.js +1 -1
  59. package/lighthouse-core/audits/accessibility/duplicate-id-aria.js +1 -1
  60. package/lighthouse-core/audits/accessibility/form-field-multiple-labels.js +1 -1
  61. package/lighthouse-core/audits/accessibility/frame-title.js +1 -1
  62. package/lighthouse-core/audits/accessibility/heading-order.js +1 -1
  63. package/lighthouse-core/audits/accessibility/html-has-lang.js +1 -1
  64. package/lighthouse-core/audits/accessibility/html-lang-valid.js +1 -1
  65. package/lighthouse-core/audits/accessibility/image-alt.js +1 -1
  66. package/lighthouse-core/audits/accessibility/input-image-alt.js +1 -1
  67. package/lighthouse-core/audits/accessibility/label.js +1 -1
  68. package/lighthouse-core/audits/accessibility/link-name.js +1 -1
  69. package/lighthouse-core/audits/accessibility/list.js +1 -1
  70. package/lighthouse-core/audits/accessibility/listitem.js +5 -5
  71. package/lighthouse-core/audits/accessibility/meta-refresh.js +1 -1
  72. package/lighthouse-core/audits/accessibility/meta-viewport.js +1 -1
  73. package/lighthouse-core/audits/accessibility/object-alt.js +1 -1
  74. package/lighthouse-core/audits/accessibility/tabindex.js +1 -1
  75. package/lighthouse-core/audits/accessibility/td-headers-attr.js +1 -1
  76. package/lighthouse-core/audits/accessibility/th-has-data-cells.js +1 -1
  77. package/lighthouse-core/audits/accessibility/valid-lang.js +1 -1
  78. package/lighthouse-core/audits/accessibility/video-caption.js +1 -1
  79. package/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +1 -2
  80. package/lighthouse-core/audits/byte-efficiency/duplicated-javascript.js +12 -11
  81. package/lighthouse-core/audits/byte-efficiency/efficient-animated-content.js +1 -1
  82. package/lighthouse-core/audits/byte-efficiency/legacy-javascript.js +24 -22
  83. package/lighthouse-core/audits/byte-efficiency/offscreen-images.js +2 -3
  84. package/lighthouse-core/audits/byte-efficiency/render-blocking-resources.js +3 -2
  85. package/lighthouse-core/audits/byte-efficiency/unminified-css.js +5 -3
  86. package/lighthouse-core/audits/byte-efficiency/unminified-javascript.js +11 -10
  87. package/lighthouse-core/audits/byte-efficiency/unused-css-rules.js +1 -0
  88. package/lighthouse-core/audits/byte-efficiency/unused-javascript.js +8 -11
  89. package/lighthouse-core/audits/byte-efficiency/uses-responsive-images.js +1 -1
  90. package/lighthouse-core/audits/byte-efficiency/uses-text-compression.js +1 -1
  91. package/lighthouse-core/audits/deprecations.js +598 -8
  92. package/lighthouse-core/audits/diagnostics.js +3 -4
  93. package/lighthouse-core/audits/dobetterweb/doctype.js +9 -20
  94. package/lighthouse-core/audits/dobetterweb/geolocation-on-start.js +1 -1
  95. package/lighthouse-core/audits/dobetterweb/no-document-write.js +1 -1
  96. package/lighthouse-core/audits/dobetterweb/notification-on-start.js +1 -1
  97. package/lighthouse-core/audits/dobetterweb/uses-http2.js +1 -2
  98. package/lighthouse-core/audits/dobetterweb/uses-passive-event-listeners.js +1 -1
  99. package/lighthouse-core/audits/errors-in-console.js +2 -2
  100. package/lighthouse-core/audits/long-tasks.js +2 -3
  101. package/lighthouse-core/audits/metrics/first-contentful-paint-3g.js +2 -2
  102. package/lighthouse-core/audits/metrics/first-contentful-paint.js +2 -3
  103. package/lighthouse-core/audits/metrics/first-meaningful-paint.js +2 -3
  104. package/lighthouse-core/audits/metrics/interactive.js +2 -3
  105. package/lighthouse-core/audits/metrics/largest-contentful-paint.js +2 -3
  106. package/lighthouse-core/audits/metrics/max-potential-fid.js +2 -3
  107. package/lighthouse-core/audits/metrics/speed-index.js +2 -3
  108. package/lighthouse-core/audits/metrics/total-blocking-time.js +2 -3
  109. package/lighthouse-core/audits/metrics.js +2 -3
  110. package/lighthouse-core/audits/no-unload-listeners.js +15 -7
  111. package/lighthouse-core/audits/predictive-perf.js +1 -2
  112. package/lighthouse-core/audits/preload-lcp-image.js +3 -3
  113. package/lighthouse-core/audits/redirects.js +1 -1
  114. package/lighthouse-core/audits/script-treemap-data.js +45 -45
  115. package/lighthouse-core/audits/seo/http-status-code.js +4 -2
  116. package/lighthouse-core/audits/seo/link-text.js +0 -2
  117. package/lighthouse-core/audits/server-response-time.js +17 -2
  118. package/lighthouse-core/audits/service-worker.js +2 -7
  119. package/lighthouse-core/audits/timing-budget.js +2 -3
  120. package/lighthouse-core/audits/uses-rel-preconnect.js +1 -1
  121. package/lighthouse-core/audits/uses-rel-preload.js +1 -1
  122. package/lighthouse-core/audits/valid-source-maps.js +14 -12
  123. package/lighthouse-core/audits/violation-audit.js +1 -1
  124. package/lighthouse-core/audits/work-during-interaction.js +2 -2
  125. package/lighthouse-core/computed/critical-request-chains.js +9 -5
  126. package/lighthouse-core/computed/js-bundles.js +11 -11
  127. package/lighthouse-core/computed/main-resource.js +2 -3
  128. package/lighthouse-core/computed/metrics/first-contentful-paint-all-frames.js +1 -1
  129. package/lighthouse-core/computed/metrics/first-contentful-paint.js +1 -1
  130. package/lighthouse-core/computed/metrics/first-meaningful-paint.js +1 -1
  131. package/lighthouse-core/computed/metrics/interactive.js +1 -1
  132. package/lighthouse-core/computed/metrics/lantern-first-contentful-paint.js +1 -1
  133. package/lighthouse-core/computed/metrics/lantern-first-meaningful-paint.js +1 -1
  134. package/lighthouse-core/computed/metrics/lantern-interactive.js +1 -1
  135. package/lighthouse-core/computed/metrics/lantern-largest-contentful-paint.js +1 -1
  136. package/lighthouse-core/computed/metrics/lantern-max-potential-fid.js +1 -1
  137. package/lighthouse-core/computed/metrics/lantern-metric.js +5 -3
  138. package/lighthouse-core/computed/metrics/lantern-speed-index.js +1 -1
  139. package/lighthouse-core/computed/metrics/lantern-total-blocking-time.js +1 -1
  140. package/lighthouse-core/computed/metrics/largest-contentful-paint-all-frames.js +1 -1
  141. package/lighthouse-core/computed/metrics/largest-contentful-paint.js +1 -1
  142. package/lighthouse-core/computed/metrics/max-potential-fid.js +1 -1
  143. package/lighthouse-core/computed/metrics/metric.js +0 -1
  144. package/lighthouse-core/computed/metrics/speed-index.js +1 -1
  145. package/lighthouse-core/computed/metrics/timing-summary.js +6 -13
  146. package/lighthouse-core/computed/metrics/total-blocking-time.js +1 -1
  147. package/lighthouse-core/computed/module-duplication.js +5 -6
  148. package/lighthouse-core/computed/page-dependency-graph.js +28 -55
  149. package/lighthouse-core/computed/resource-summary.js +5 -5
  150. package/lighthouse-core/computed/unused-css.js +7 -6
  151. package/lighthouse-core/computed/unused-javascript-summary.js +36 -16
  152. package/lighthouse-core/config/budget.js +2 -2
  153. package/lighthouse-core/config/default-config.js +1 -2
  154. package/lighthouse-core/fraggle-rock/api.js +1 -1
  155. package/lighthouse-core/fraggle-rock/config/default-config.js +0 -3
  156. package/lighthouse-core/fraggle-rock/gather/base-artifacts.js +3 -6
  157. package/lighthouse-core/fraggle-rock/gather/driver.js +2 -2
  158. package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +26 -51
  159. package/lighthouse-core/fraggle-rock/gather/runner-helpers.js +3 -0
  160. package/lighthouse-core/fraggle-rock/gather/session.js +22 -23
  161. package/lighthouse-core/fraggle-rock/gather/snapshot-runner.js +4 -5
  162. package/lighthouse-core/fraggle-rock/gather/timespan-runner.js +6 -6
  163. package/lighthouse-core/gather/connections/cri.js +1 -5
  164. package/lighthouse-core/gather/driver/execution-context.js +2 -5
  165. package/lighthouse-core/gather/driver/navigation.js +10 -13
  166. package/lighthouse-core/gather/driver/network-monitor.js +3 -16
  167. package/lighthouse-core/gather/driver.js +1 -6
  168. package/lighthouse-core/gather/fetcher.js +210 -34
  169. package/lighthouse-core/gather/gather-runner.js +17 -13
  170. package/lighthouse-core/gather/gatherers/accessibility.js +4 -16
  171. package/lighthouse-core/gather/gatherers/console-messages.js +2 -4
  172. package/lighthouse-core/gather/gatherers/dobetterweb/doctype.js +2 -4
  173. package/lighthouse-core/gather/gatherers/full-page-screenshot.js +2 -3
  174. package/lighthouse-core/gather/gatherers/iframe-elements.js +1 -4
  175. package/lighthouse-core/gather/gatherers/image-elements.js +0 -2
  176. package/lighthouse-core/gather/gatherers/js-usage.js +87 -12
  177. package/lighthouse-core/gather/gatherers/link-elements.js +14 -12
  178. package/lighthouse-core/gather/gatherers/main-document-content.js +8 -8
  179. package/lighthouse-core/gather/gatherers/script-elements.js +56 -7
  180. package/lighthouse-core/gather/gatherers/seo/robots-txt.js +30 -2
  181. package/lighthouse-core/gather/gatherers/source-maps.js +1 -8
  182. package/lighthouse-core/gather/gatherers/web-app-manifest.js +2 -2
  183. package/lighthouse-core/index.js +2 -26
  184. package/lighthouse-core/lib/cdt/generated/SourceMap.js +1 -1
  185. package/lighthouse-core/lib/dependency-graph/simulator/network-analyzer.js +29 -8
  186. package/lighthouse-core/lib/navigation-error.js +4 -13
  187. package/lighthouse-core/lib/page-functions.js +1 -3
  188. package/lighthouse-core/lib/script-helpers.js +6 -11
  189. package/lighthouse-core/lib/url-shim.js +2 -2
  190. package/lighthouse-core/runner.js +5 -0
  191. package/lighthouse-core/scripts/manual-chrome-launcher.js +1 -0
  192. package/lighthouse-core/util-commonjs.js +6 -8
  193. package/package.json +13 -13
  194. package/readme.md +1 -1
  195. package/report/.eslintrc.cjs +1 -3
  196. package/report/assets/styles.css +5 -10
  197. package/report/assets/templates.html +9 -10
  198. package/report/clients/bundle.js +1 -0
  199. package/report/clients/standalone.js +1 -0
  200. package/report/generator/report-generator.js +21 -46
  201. package/report/renderer/api.js +2 -0
  202. package/report/renderer/category-renderer.js +24 -20
  203. package/report/renderer/components.js +304 -303
  204. package/report/renderer/crc-details-renderer.js +24 -21
  205. package/report/renderer/details-renderer.js +12 -12
  206. package/report/renderer/dom.js +7 -6
  207. package/report/renderer/drop-down-menu.js +1 -0
  208. package/report/renderer/element-screenshot-renderer.js +5 -1
  209. package/report/renderer/features-util.js +1 -0
  210. package/report/renderer/i18n.js +62 -118
  211. package/report/renderer/logger.js +1 -0
  212. package/report/renderer/open-tab.js +3 -1
  213. package/report/renderer/performance-category-renderer.js +11 -10
  214. package/report/renderer/pwa-category-renderer.js +4 -3
  215. package/report/renderer/report-renderer.js +17 -17
  216. package/report/renderer/report-ui-features.js +1 -0
  217. package/report/renderer/snippet-renderer.js +3 -2
  218. package/report/renderer/swap-locale-feature.js +1 -0
  219. package/report/renderer/text-encoding.js +1 -0
  220. package/report/renderer/topbar-features.js +1 -0
  221. package/report/renderer/util.js +6 -7
  222. package/report/test/clients/bundle-test.js +5 -0
  223. package/report/test/generator/file-namer-test.js +1 -0
  224. package/report/test/generator/report-generator-test.js +20 -25
  225. package/report/test/renderer/category-renderer-test.js +4 -3
  226. package/report/test/renderer/components-test.js +3 -0
  227. package/report/test/renderer/crc-details-renderer-test.js +3 -0
  228. package/report/test/renderer/details-renderer-test.js +3 -49
  229. package/report/test/renderer/dom-test.js +3 -0
  230. package/report/test/renderer/element-screenshot-renderer-test.js +6 -3
  231. package/report/test/renderer/i18n-test.js +25 -70
  232. package/report/test/renderer/performance-category-renderer-test.js +5 -14
  233. package/report/test/renderer/pwa-category-renderer-test.js +4 -3
  234. package/report/test/renderer/report-renderer-axe-test.js +4 -3
  235. package/report/test/renderer/report-renderer-test.js +4 -3
  236. package/report/test/renderer/report-ui-features-test.js +4 -3
  237. package/report/test/renderer/snippet-renderer-test.js +3 -0
  238. package/report/test/renderer/text-encoding-test.js +3 -0
  239. package/report/test/renderer/util-test.js +5 -4
  240. package/report/test-assets/faux-psi.js +1 -2
  241. package/shared/localization/format.js +3 -7
  242. package/shared/localization/locales/en-US.json +238 -55
  243. package/shared/localization/locales/en-XL.json +238 -55
  244. package/shared/test/localization/format-test.js +2 -8
  245. package/shared/test/localization/locales-test.js +2 -0
  246. package/shared/test/localization/swap-locale-test.js +2 -0
  247. package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +2 -0
  248. package/third-party/chromium-synchronization/installability-errors-test.js +2 -0
  249. package/tsconfig.json +0 -1
  250. package/types/artifacts.d.ts +8 -47
  251. package/types/config.d.ts +0 -2
  252. package/types/externs.d.ts +2 -3
  253. package/types/gatherer.d.ts +2 -1
  254. package/types/global-lh.d.ts +0 -3
  255. package/types/lhr/lhr.d.ts +2 -2
  256. package/types/lhr/treemap.d.ts +1 -0
  257. package/changelog.md +0 -5902
  258. package/lighthouse-core/audits/script-elements-test-audit.js +0 -30
  259. package/lighthouse-core/gather/gatherers/scripts.js +0 -154
  260. package/lighthouse-core/scripts/package.json +0 -4
  261. package/report/test/.eslintrc.cjs +0 -11
  262. package/shared/test/localization/.eslintrc.cjs +0 -11
@@ -8,6 +8,8 @@
8
8
  const Audit = require('./audit.js');
9
9
  const i18n = require('../lib/i18n/i18n.js');
10
10
  const MainResource = require('../computed/main-resource.js');
11
+ const NetworkRecords = require('../computed/network-records.js');
12
+ const NetworkAnalyzer = require('../lib/dependency-graph/simulator/network-analyzer.js');
11
13
 
12
14
  const UIStrings = {
13
15
  /** Title of a diagnostic audit that provides detail on how long it took from starting a request to when the server started responding. This descriptive title is shown to users when the amount is acceptable and no user action is required. */
@@ -37,7 +39,7 @@ class ServerResponseTime extends Audit {
37
39
  title: str_(UIStrings.title),
38
40
  failureTitle: str_(UIStrings.failureTitle),
39
41
  description: str_(UIStrings.description),
40
- supportedModes: ['navigation'],
42
+ supportedModes: ['timespan', 'navigation'],
41
43
  requiredArtifacts: ['devtoolsLogs', 'URL', 'GatherContext'],
42
44
  };
43
45
  }
@@ -59,7 +61,20 @@ class ServerResponseTime extends Audit {
59
61
  const devtoolsLog = artifacts.devtoolsLogs[Audit.DEFAULT_PASS];
60
62
 
61
63
  /** @type {LH.Artifacts.NetworkRequest} */
62
- const mainResource = await MainResource.request({devtoolsLog, URL: artifacts.URL}, context);
64
+ let mainResource;
65
+ if (artifacts.GatherContext.gatherMode === 'timespan') {
66
+ const networkRecords = await NetworkRecords.request(devtoolsLog, context);
67
+ const optionalMainResource = NetworkAnalyzer.findOptionalMainDocument(
68
+ networkRecords,
69
+ artifacts.URL.finalUrl
70
+ );
71
+ if (!optionalMainResource) {
72
+ return {score: null, notApplicable: true};
73
+ }
74
+ mainResource = optionalMainResource;
75
+ } else {
76
+ mainResource = await MainResource.request({devtoolsLog, URL: artifacts.URL}, context);
77
+ }
63
78
 
64
79
  const responseTime = ServerResponseTime.calculateResponseTime(mainResource);
65
80
  const passed = responseTime < TOO_SLOW_THRESHOLD_MS;
@@ -51,7 +51,6 @@ class ServiceWorker extends Audit {
51
51
  title: str_(UIStrings.title),
52
52
  failureTitle: str_(UIStrings.failureTitle),
53
53
  description: str_(UIStrings.description),
54
- supportedModes: ['navigation'],
55
54
  requiredArtifacts: ['URL', 'ServiceWorker', 'WebAppManifest'],
56
55
  };
57
56
  }
@@ -129,12 +128,8 @@ class ServiceWorker extends Audit {
129
128
  * @return {LH.Audit.Product}
130
129
  */
131
130
  static audit(artifacts) {
132
- // Match against `artifacts.URL.mainDocumentUrl` so audit accounts for any redirects.
133
- // Service workers won't control network requests if the page uses `history.pushState` to "enter" the SW scope.
134
- // For this reason it is better to evaluate the SW in relation to the main document url rather than the final frame url.
135
- const {mainDocumentUrl} = artifacts.URL;
136
- if (!mainDocumentUrl) throw new Error('mainDocumentUrl must exist in navigation mode');
137
- const pageUrl = new URL(mainDocumentUrl);
131
+ // Match against artifacts.URL.finalUrl so audit accounts for any redirects.
132
+ const pageUrl = new URL(artifacts.URL.finalUrl);
138
133
  const {versions, registrations} = artifacts.ServiceWorker;
139
134
 
140
135
  const versionsForOrigin = ServiceWorker.getVersionsForOrigin(versions, pageUrl);
@@ -140,9 +140,8 @@ class TimingBudget extends Audit {
140
140
  const gatherContext = artifacts.GatherContext;
141
141
  const devtoolsLog = artifacts.devtoolsLogs[Audit.DEFAULT_PASS];
142
142
  const trace = artifacts.traces[Audit.DEFAULT_PASS];
143
- const URL = artifacts.URL;
144
- const mainResource = await MainResource.request({URL, devtoolsLog}, context);
145
- const data = {trace, devtoolsLog, gatherContext, settings: context.settings, URL};
143
+ const mainResource = await MainResource.request({URL: artifacts.URL, devtoolsLog}, context);
144
+ const data = {trace, devtoolsLog, gatherContext, settings: context.settings};
146
145
  const summary = (await TimingSummary.request(data, context)).metrics;
147
146
  const budget = Budget.getMatchingBudget(context.settings.budgets, mainResource.url);
148
147
 
@@ -123,7 +123,7 @@ class UsesRelPreconnectAudit extends Audit {
123
123
  MainResource.request({devtoolsLog, URL: artifacts.URL}, context),
124
124
  LoadSimulator.request({devtoolsLog, settings}, context),
125
125
  ProcessedNavigation.request(processedTrace, context),
126
- PageDependencyGraph.request({trace, devtoolsLog, URL: artifacts.URL}, context),
126
+ PageDependencyGraph.request({trace, devtoolsLog}, context),
127
127
  ]);
128
128
 
129
129
  const {rtt, additionalRttByOrigin} = loadSimulator.getOptions();
@@ -217,7 +217,7 @@ class UsesRelPreloadAudit extends Audit {
217
217
 
218
218
  const [mainResource, graph, simulator] = await Promise.all([
219
219
  MainResource.request({devtoolsLog, URL}, context),
220
- PageDependencyGraph.request({trace, devtoolsLog, URL}, context),
220
+ PageDependencyGraph.request({trace, devtoolsLog}, context),
221
221
  LoadSimulator.request(simulatorOptions, context),
222
222
  ]);
223
223
 
@@ -44,22 +44,22 @@ class ValidSourceMaps extends Audit {
44
44
  title: str_(UIStrings.title),
45
45
  failureTitle: str_(UIStrings.failureTitle),
46
46
  description: str_(UIStrings.description),
47
- requiredArtifacts: ['Scripts', 'SourceMaps', 'URL'],
47
+ requiredArtifacts: ['ScriptElements', 'SourceMaps', 'URL'],
48
48
  };
49
49
  }
50
50
 
51
51
  /**
52
52
  * Returns true if the size of the script exceeds a static threshold.
53
- * @param {LH.Artifacts.Script} script
53
+ * @param {LH.Artifacts.ScriptElement} scriptElement
54
54
  * @param {string} finalURL
55
55
  * @return {boolean}
56
56
  */
57
- static isLargeFirstPartyJS(script, finalURL) {
58
- if (!script.length) return false;
57
+ static isLargeFirstPartyJS(scriptElement, finalURL) {
58
+ if (scriptElement.content === null) return false;
59
59
 
60
- const isLargeJS = script.length >= LARGE_JS_BYTE_THRESHOLD;
61
- const isFirstPartyJS = script.url ?
62
- thirdPartyWeb.isFirstParty(script.url, thirdPartyWeb.getEntity(finalURL)) : false;
60
+ const isLargeJS = scriptElement.content.length >= LARGE_JS_BYTE_THRESHOLD;
61
+ const isFirstPartyJS = scriptElement.src ?
62
+ thirdPartyWeb.isFirstParty(scriptElement.src, thirdPartyWeb.getEntity(finalURL)) : false;
63
63
 
64
64
  return isLargeJS && isFirstPartyJS;
65
65
  }
@@ -75,14 +75,16 @@ class ValidSourceMaps extends Audit {
75
75
 
76
76
  let missingMapsForLargeFirstPartyFile = false;
77
77
  const results = [];
78
- for (const script of artifacts.Scripts) {
79
- const sourceMap = SourceMaps.find(m => m.scriptId === script.scriptId);
78
+ for (const scriptElement of artifacts.ScriptElements) {
79
+ if (!scriptElement.src) continue; // TODO: inline scripts, how do they work?
80
+
81
+ const sourceMap = SourceMaps.find(m => m.scriptUrl === scriptElement.src);
80
82
  const errors = [];
81
- const isLargeFirstParty = this.isLargeFirstPartyJS(script, artifacts.URL.finalUrl);
83
+ const isLargeFirstParty = this.isLargeFirstPartyJS(scriptElement, artifacts.URL.finalUrl);
82
84
 
83
85
  if (isLargeFirstParty && (!sourceMap || !sourceMap.map)) {
84
86
  missingMapsForLargeFirstPartyFile = true;
85
- isMissingMapForLargeFirstPartyScriptUrl.add(script.url);
87
+ isMissingMapForLargeFirstPartyScriptUrl.add(scriptElement.src);
86
88
  errors.push({error: str_(UIStrings.missingSourceMapErrorMessage)});
87
89
  }
88
90
 
@@ -105,7 +107,7 @@ class ValidSourceMaps extends Audit {
105
107
 
106
108
  if (sourceMap || errors.length) {
107
109
  results.push({
108
- scriptUrl: script.url,
110
+ scriptUrl: scriptElement.src,
109
111
  sourceMapUrl: sourceMap?.sourceMapUrl,
110
112
  subItems: {
111
113
  type: /** @type {const} */ ('subitems'),
@@ -31,7 +31,7 @@ class ViolationAudit extends Audit {
31
31
  return artifacts.ConsoleMessages
32
32
  .filter(entry => entry.url && entry.source === 'violation' && pattern.test(entry.text))
33
33
  .map(entry => {
34
- const bundle = bundles.find(bundle => bundle.script.scriptId === entry.scriptId);
34
+ const bundle = bundles.find(bundle => bundle.script.src === entry.url);
35
35
  return Audit.makeSourceLocationFromConsoleMessage(entry, bundle);
36
36
  })
37
37
  .filter(filterUndefined)
@@ -32,7 +32,7 @@ const UIStrings = {
32
32
  /** Label for a column in a data table; entries will be information on the time that the browser is delayed before responding to user input. Ideally fits within a ~40 character limit. */
33
33
  inputDelay: 'Input delay',
34
34
  /** Label for a column in a data table; entries will be information on the time taken by code processing user input that delays a response to the user. Ideally fits within a ~40 character limit. */
35
- processingTime: 'Processing time',
35
+ processingDelay: 'Processing delay',
36
36
  /** Label for a column in a data table; entries will be information on the time that the browser is delayed before presenting a response to user input on screen. Ideally fits within a ~40 character limit. */
37
37
  presentationDelay: 'Presentation delay',
38
38
  /**
@@ -116,7 +116,7 @@ class WorkDuringInteraction extends Audit {
116
116
  const endTs = startTs + interactionData.duration * 1000;
117
117
  return {
118
118
  inputDelay: {startTs, endTs: processingStartTs},
119
- processingTime: {startTs: processingStartTs, endTs: processingEndTs},
119
+ processingDelay: {startTs: processingStartTs, endTs: processingEndTs},
120
120
  presentationDelay: {startTs: processingEndTs, endTs},
121
121
  };
122
122
  }
@@ -117,9 +117,6 @@ class CriticalRequestChains {
117
117
  // Ignore if some ancestor is not a critical request.
118
118
  if (networkPath.some(r => !CriticalRequestChains.isCritical(r, mainResource))) return;
119
119
 
120
- // Ignore non-network things (like data urls).
121
- if (NetworkRequest.isNonNetworkRequest(node.record)) return;
122
-
123
120
  addChain(networkPath);
124
121
  }, getNextNodes);
125
122
 
@@ -132,8 +129,15 @@ class CriticalRequestChains {
132
129
  * @return {Promise<LH.Artifacts.CriticalRequestNode>}
133
130
  */
134
131
  static async compute_(data, context) {
135
- const mainResource = await MainResource.request(data, context);
136
- const graph = await PageDependencyGraph.request(data, context);
132
+ const mainResource = await MainResource.request({
133
+ URL: data.URL,
134
+ devtoolsLog: data.devtoolsLog,
135
+ }, context);
136
+
137
+ const graph = await PageDependencyGraph.request({
138
+ trace: data.trace,
139
+ devtoolsLog: data.devtoolsLog,
140
+ }, context);
137
141
 
138
142
  return CriticalRequestChains.extractChainsFromGraph(mainResource, graph);
139
143
  }
@@ -12,15 +12,14 @@ const SDK = require('../lib/cdt/SDK.js');
12
12
  /**
13
13
  * Calculate the number of bytes contributed by each source file
14
14
  * @param {LH.Artifacts.Bundle['map']} map
15
- * @param {number} contentLength
16
15
  * @param {string} content
17
16
  * @return {LH.Artifacts.Bundle['sizes']}
18
17
  */
19
- function computeGeneratedFileSizes(map, contentLength, content) {
18
+ function computeGeneratedFileSizes(map, content) {
20
19
  const lines = content.split('\n');
21
20
  /** @type {Record<string, number>} */
22
21
  const files = {};
23
- const totalBytes = contentLength;
22
+ const totalBytes = content.length;
24
23
  let unmappedBytes = totalBytes;
25
24
 
26
25
  // @ts-expect-error: This function is added in SDK.js. This will eventually be added to CDT.
@@ -79,10 +78,10 @@ function computeGeneratedFileSizes(map, contentLength, content) {
79
78
 
80
79
  class JSBundles {
81
80
  /**
82
- * @param {Pick<LH.Artifacts, 'SourceMaps'|'Scripts'>} artifacts
81
+ * @param {Pick<LH.Artifacts, 'SourceMaps'|'ScriptElements'>} artifacts
83
82
  */
84
83
  static async compute_(artifacts) {
85
- const {SourceMaps, Scripts} = artifacts;
84
+ const {SourceMaps, ScriptElements} = artifacts;
86
85
 
87
86
  /** @type {LH.Artifacts.Bundle[]} */
88
87
  const bundles = [];
@@ -90,22 +89,23 @@ class JSBundles {
90
89
  // Collate map and script, compute file sizes.
91
90
  for (const SourceMap of SourceMaps) {
92
91
  if (!SourceMap.map) continue;
93
- const {scriptId, map: rawMap} = SourceMap;
92
+ const {scriptUrl, map: rawMap} = SourceMap;
94
93
 
95
94
  if (!rawMap.mappings) continue;
96
95
 
97
- const script = Scripts.find(s => s.scriptId === scriptId);
98
- if (!script) continue;
96
+ const scriptElement = ScriptElements.find(s => s.src === scriptUrl);
97
+ if (!scriptElement) continue;
99
98
 
100
99
  const compiledUrl = SourceMap.scriptUrl || 'compiled.js';
101
100
  const mapUrl = SourceMap.sourceMapUrl || 'compiled.js.map';
102
101
  const map = new SDK.TextSourceMap(compiledUrl, mapUrl, rawMap);
103
102
 
104
- const sizes = computeGeneratedFileSizes(map, script.length || 0, script.content || '');
103
+ const content = scriptElement?.content ? scriptElement.content : '';
104
+ const sizes = computeGeneratedFileSizes(map, content);
105
105
 
106
106
  const bundle = {
107
107
  rawMap,
108
- script,
108
+ script: scriptElement,
109
109
  map,
110
110
  sizes,
111
111
  };
@@ -116,4 +116,4 @@ class JSBundles {
116
116
  }
117
117
  }
118
118
 
119
- module.exports = makeComputedArtifact(JSBundles, ['Scripts', 'SourceMaps']);
119
+ module.exports = makeComputedArtifact(JSBundles, ['ScriptElements', 'SourceMaps']);
@@ -20,10 +20,9 @@ class MainResource {
20
20
  * @return {Promise<LH.Artifacts.NetworkRequest>}
21
21
  */
22
22
  static async compute_(data, context) {
23
- const {mainDocumentUrl} = data.URL;
24
- if (!mainDocumentUrl) throw new Error('mainDocumentUrl must exist to get the main resource');
23
+ const finalUrl = data.URL.finalUrl;
25
24
  const requests = await NetworkRecords.request(data.devtoolsLog, context);
26
- const mainResource = NetworkAnalyzer.findResourceForUrl(requests, mainDocumentUrl);
25
+ const mainResource = NetworkAnalyzer.findMainDocument(requests, finalUrl);
27
26
  if (!mainResource) {
28
27
  throw new Error('Unable to identify the main resource');
29
28
  }
@@ -33,5 +33,5 @@ class FirstContentfulPaintAllFrames extends NavigationMetric {
33
33
 
34
34
  module.exports = makeComputedArtifact(
35
35
  FirstContentfulPaintAllFrames,
36
- ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
36
+ ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
37
37
  );
@@ -36,5 +36,5 @@ class FirstContentfulPaint extends NavigationMetric {
36
36
 
37
37
  module.exports = makeComputedArtifact(
38
38
  FirstContentfulPaint,
39
- ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
39
+ ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
40
40
  );
@@ -40,5 +40,5 @@ class FirstMeaningfulPaint extends NavigationMetric {
40
40
 
41
41
  module.exports = makeComputedArtifact(
42
42
  FirstMeaningfulPaint,
43
- ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
43
+ ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
44
44
  );
@@ -183,7 +183,7 @@ class Interactive extends NavigationMetric {
183
183
 
184
184
  module.exports = makeComputedArtifact(
185
185
  Interactive,
186
- ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
186
+ ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
187
187
  );
188
188
 
189
189
  /**
@@ -200,5 +200,5 @@ class LanternFirstContentfulPaint extends LanternMetric {
200
200
 
201
201
  module.exports = makeComputedArtifact(
202
202
  LanternFirstContentfulPaint,
203
- ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
203
+ ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
204
204
  );
@@ -79,5 +79,5 @@ class LanternFirstMeaningfulPaint extends LanternMetric {
79
79
 
80
80
  module.exports = makeComputedArtifact(
81
81
  LanternFirstMeaningfulPaint,
82
- ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
82
+ ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
83
83
  );
@@ -109,5 +109,5 @@ class LanternInteractive extends LanternMetric {
109
109
 
110
110
  module.exports = makeComputedArtifact(
111
111
  LanternInteractive,
112
- ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
112
+ ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
113
113
  );
@@ -107,5 +107,5 @@ class LanternLargestContentfulPaint extends LanternMetric {
107
107
 
108
108
  module.exports = makeComputedArtifact(
109
109
  LanternLargestContentfulPaint,
110
- ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
110
+ ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
111
111
  );
@@ -89,5 +89,5 @@ class LanternMaxPotentialFID extends LanternMetricArtifact {
89
89
 
90
90
  module.exports = makeComputedArtifact(
91
91
  LanternMaxPotentialFID,
92
- ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
92
+ ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
93
93
  );
@@ -101,15 +101,17 @@ class LanternMetricArtifact {
101
101
  static async computeMetricWithGraphs(data, context, extras) {
102
102
  // TODO: remove this fallback when lighthouse-pub-ads plugin can update.
103
103
  const gatherContext = data.gatherContext || {gatherMode: 'navigation'};
104
+ const {trace, devtoolsLog, settings} = data;
104
105
  if (gatherContext.gatherMode !== 'navigation') {
105
106
  throw new Error(`Lantern metrics can only be computed on navigations`);
106
107
  }
107
108
 
108
109
  const metricName = this.name.replace('Lantern', '');
109
- const graph = await PageDependencyGraph.request(data, context);
110
- const processedTrace = await ProcessedTrace.request(data.trace, context);
110
+ const graph = await PageDependencyGraph.request({trace, devtoolsLog}, context);
111
+ const processedTrace = await ProcessedTrace.request(trace, context);
111
112
  const processedNavigation = await ProcessedNavigation.request(processedTrace, context);
112
- const simulator = data.simulator || (await LoadSimulator.request(data, context));
113
+ const simulator = data.simulator ||
114
+ (await LoadSimulator.request({devtoolsLog, settings}, context));
113
115
 
114
116
  const optimisticGraph = this.getOptimisticGraph(graph, processedNavigation);
115
117
  const pessimisticGraph = this.getPessimisticGraph(graph, processedNavigation);
@@ -146,5 +146,5 @@ class LanternSpeedIndex extends LanternMetric {
146
146
 
147
147
  module.exports = makeComputedArtifact(
148
148
  LanternSpeedIndex,
149
- ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
149
+ ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
150
150
  );
@@ -122,5 +122,5 @@ class LanternTotalBlockingTime extends LanternMetric {
122
122
 
123
123
  module.exports = makeComputedArtifact(
124
124
  LanternTotalBlockingTime,
125
- ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
125
+ ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
126
126
  );
@@ -41,5 +41,5 @@ class LargestContentfulPaintAllFrames extends NavigationMetric {
41
41
 
42
42
  module.exports = makeComputedArtifact(
43
43
  LargestContentfulPaintAllFrames,
44
- ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
44
+ ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
45
45
  );
@@ -48,5 +48,5 @@ class LargestContentfulPaint extends NavigationMetric {
48
48
 
49
49
  module.exports = makeComputedArtifact(
50
50
  LargestContentfulPaint,
51
- ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
51
+ ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
52
52
  );
@@ -41,5 +41,5 @@ class MaxPotentialFID extends NavigationMetric {
41
41
 
42
42
  module.exports = makeComputedArtifact(
43
43
  MaxPotentialFID,
44
- ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
44
+ ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
45
45
  );
@@ -34,7 +34,6 @@ class Metric {
34
34
  devtoolsLog: data.devtoolsLog,
35
35
  gatherContext: data.gatherContext,
36
36
  settings: data.settings,
37
- URL: data.URL,
38
37
  };
39
38
  }
40
39
 
@@ -36,5 +36,5 @@ class SpeedIndex extends NavigationMetric {
36
36
 
37
37
  module.exports = makeComputedArtifact(
38
38
  SpeedIndex,
39
- ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
39
+ ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
40
40
  );
@@ -26,12 +26,11 @@ class TimingSummary {
26
26
  * @param {LH.DevtoolsLog} devtoolsLog
27
27
  * @param {LH.Artifacts['GatherContext']} gatherContext
28
28
  * @param {ImmutableObject<LH.Config.Settings>} settings
29
- * @param {LH.Artifacts['URL']} URL
30
29
  * @param {LH.Artifacts.ComputedContext} context
31
30
  * @return {Promise<{metrics: LH.Artifacts.TimingSummary, debugInfo: Record<string,boolean>}>}
32
31
  */
33
- static async summarize(trace, devtoolsLog, gatherContext, settings, URL, context) {
34
- const metricComputationData = {trace, devtoolsLog, gatherContext, settings, URL};
32
+ static async summarize(trace, devtoolsLog, gatherContext, settings, context) {
33
+ const metricComputationData = {trace, devtoolsLog, gatherContext, settings};
35
34
  /**
36
35
  * @template TArtifacts
37
36
  * @template TReturn
@@ -135,23 +134,17 @@ class TimingSummary {
135
134
  return {metrics, debugInfo};
136
135
  }
137
136
  /**
138
- * @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, gatherContext: LH.Artifacts['GatherContext']; settings: ImmutableObject<LH.Config.Settings>, URL: LH.Artifacts['URL']}} data
137
+ * @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, gatherContext: LH.Artifacts['GatherContext']; settings: ImmutableObject<LH.Config.Settings>}} data
139
138
  * @param {LH.Artifacts.ComputedContext} context
140
139
  * @return {Promise<{metrics: LH.Artifacts.TimingSummary, debugInfo: Record<string,boolean>}>}
141
140
  */
142
141
  static async compute_(data, context) {
143
- return TimingSummary.summarize(
144
- data.trace,
145
- data.devtoolsLog,
146
- data.gatherContext,
147
- data.settings,
148
- data.URL,
149
- context
150
- );
142
+ return TimingSummary.summarize(data.trace, data.devtoolsLog, data.gatherContext, data.settings,
143
+ context);
151
144
  }
152
145
  }
153
146
 
154
147
  module.exports = makeComputedArtifact(
155
148
  TimingSummary,
156
- ['devtoolsLog', 'gatherContext', 'settings', 'trace', 'URL']
149
+ ['devtoolsLog', 'gatherContext', 'settings', 'trace']
157
150
  );
@@ -70,5 +70,5 @@ class TotalBlockingTime extends ComputedMetric {
70
70
 
71
71
  module.exports = makeComputedArtifact(
72
72
  TotalBlockingTime,
73
- ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
73
+ ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
74
74
  );
@@ -43,7 +43,7 @@ class ModuleDuplication {
43
43
  }
44
44
 
45
45
  /**
46
- * @param {Map<string, Array<{scriptId: string, resourceSize: number}>>} moduleNameToSourceData
46
+ * @param {Map<string, Array<{scriptUrl: string, resourceSize: number}>>} moduleNameToSourceData
47
47
  */
48
48
  static _normalizeAggregatedData(moduleNameToSourceData) {
49
49
  for (const [key, originalSourceData] of moduleNameToSourceData.entries()) {
@@ -74,7 +74,7 @@ class ModuleDuplication {
74
74
  }
75
75
 
76
76
  /**
77
- * @param {Pick<LH.Artifacts, 'Scripts'|'SourceMaps'>} artifacts
77
+ * @param {Pick<LH.Artifacts, 'ScriptElements'|'SourceMaps'>} artifacts
78
78
  * @param {LH.Artifacts.ComputedContext} context
79
79
  */
80
80
  static async compute_(artifacts, context) {
@@ -109,7 +109,7 @@ class ModuleDuplication {
109
109
  }
110
110
  }
111
111
 
112
- /** @type {Map<string, Array<{scriptId: string, scriptUrl: string, resourceSize: number}>>} */
112
+ /** @type {Map<string, Array<{scriptUrl: string, resourceSize: number}>>} */
113
113
  const moduleNameToSourceData = new Map();
114
114
  for (const {rawMap, script} of bundles) {
115
115
  const sourceDataArray = sourceDatasMap.get(rawMap);
@@ -122,8 +122,7 @@ class ModuleDuplication {
122
122
  moduleNameToSourceData.set(sourceData.source, data);
123
123
  }
124
124
  data.push({
125
- scriptId: script.scriptId,
126
- scriptUrl: script.url,
125
+ scriptUrl: script.src || '',
127
126
  resourceSize: sourceData.resourceSize,
128
127
  });
129
128
  }
@@ -134,4 +133,4 @@ class ModuleDuplication {
134
133
  }
135
134
  }
136
135
 
137
- module.exports = makeComputedArtifact(ModuleDuplication, ['Scripts', 'SourceMaps']);
136
+ module.exports = makeComputedArtifact(ModuleDuplication, ['ScriptElements', 'SourceMaps']);