lighthouse 9.1.0 → 9.2.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 (104) hide show
  1. package/changelog.md +51 -4
  2. package/dist/report/bundle.esm.js +3 -3
  3. package/dist/report/flow.js +1 -1
  4. package/dist/report/standalone.js +1 -1
  5. package/flow-report/assets/styles.css +1 -1
  6. package/lighthouse-cli/test/smokehouse/core-tests.js +124 -0
  7. package/lighthouse-cli/test/smokehouse/frontends/lib.js +6 -4
  8. package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +2 -49
  9. package/lighthouse-cli/test/smokehouse/readme.md +1 -1
  10. package/lighthouse-cli/test/smokehouse/smokehouse.js +50 -0
  11. package/lighthouse-core/audits/apple-touch-icon.js +2 -2
  12. package/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +1 -14
  13. package/lighthouse-core/audits/byte-efficiency/legacy-javascript.js +0 -4
  14. package/lighthouse-core/audits/no-unload-listeners.js +1 -1
  15. package/lighthouse-core/computed/computed-artifact.js +14 -7
  16. package/lighthouse-core/computed/critical-request-chains.js +3 -3
  17. package/lighthouse-core/computed/image-records.js +1 -1
  18. package/lighthouse-core/computed/js-bundles.js +1 -1
  19. package/lighthouse-core/computed/load-simulator.js +2 -1
  20. package/lighthouse-core/computed/main-resource.js +1 -1
  21. package/lighthouse-core/computed/main-thread-tasks.js +1 -1
  22. package/lighthouse-core/computed/manifest-values.js +1 -1
  23. package/lighthouse-core/computed/metrics/cumulative-layout-shift.js +1 -1
  24. package/lighthouse-core/computed/metrics/first-contentful-paint-all-frames.js +4 -1
  25. package/lighthouse-core/computed/metrics/first-contentful-paint.js +4 -1
  26. package/lighthouse-core/computed/metrics/first-meaningful-paint.js +4 -1
  27. package/lighthouse-core/computed/metrics/interactive.js +4 -1
  28. package/lighthouse-core/computed/metrics/lantern-first-contentful-paint.js +7 -2
  29. package/lighthouse-core/computed/metrics/lantern-first-meaningful-paint.js +4 -1
  30. package/lighthouse-core/computed/metrics/lantern-interactive.js +4 -1
  31. package/lighthouse-core/computed/metrics/lantern-largest-contentful-paint.js +4 -1
  32. package/lighthouse-core/computed/metrics/lantern-max-potential-fid.js +4 -1
  33. package/lighthouse-core/computed/metrics/lantern-speed-index.js +4 -1
  34. package/lighthouse-core/computed/metrics/lantern-total-blocking-time.js +4 -1
  35. package/lighthouse-core/computed/metrics/largest-contentful-paint-all-frames.js +4 -1
  36. package/lighthouse-core/computed/metrics/largest-contentful-paint.js +4 -1
  37. package/lighthouse-core/computed/metrics/max-potential-fid.js +4 -1
  38. package/lighthouse-core/computed/metrics/speed-index.js +4 -1
  39. package/lighthouse-core/computed/metrics/timing-summary.js +4 -1
  40. package/lighthouse-core/computed/metrics/total-blocking-time.js +4 -1
  41. package/lighthouse-core/computed/module-duplication.js +2 -2
  42. package/lighthouse-core/computed/network-analysis.js +1 -1
  43. package/lighthouse-core/computed/network-records.js +1 -1
  44. package/lighthouse-core/computed/page-dependency-graph.js +26 -16
  45. package/lighthouse-core/computed/processed-navigation.js +1 -1
  46. package/lighthouse-core/computed/processed-trace.js +1 -1
  47. package/lighthouse-core/computed/resource-summary.js +1 -1
  48. package/lighthouse-core/computed/screenshots.js +1 -1
  49. package/lighthouse-core/computed/speedline.js +1 -1
  50. package/lighthouse-core/computed/trace-of-tab.js +1 -1
  51. package/lighthouse-core/computed/unused-css.js +4 -4
  52. package/lighthouse-core/computed/unused-javascript-summary.js +4 -1
  53. package/lighthouse-core/computed/user-timings.js +1 -1
  54. package/lighthouse-core/computed/viewport-meta.js +1 -1
  55. package/lighthouse-core/config/default-config.js +1 -1
  56. package/lighthouse-core/fraggle-rock/gather/base-gatherer.js +1 -1
  57. package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +19 -8
  58. package/lighthouse-core/fraggle-rock/user-flow.js +9 -5
  59. package/lighthouse-core/gather/driver/execution-context.js +2 -0
  60. package/lighthouse-core/gather/driver/wait-for-condition.js +1 -1
  61. package/lighthouse-core/gather/gatherers/accessibility.js +1 -1
  62. package/lighthouse-core/gather/gatherers/anchor-elements.js +1 -1
  63. package/lighthouse-core/gather/gatherers/cache-contents.js +1 -1
  64. package/lighthouse-core/gather/gatherers/console-messages.js +1 -1
  65. package/lighthouse-core/gather/gatherers/dobetterweb/doctype.js +1 -1
  66. package/lighthouse-core/gather/gatherers/dobetterweb/domstats.js +1 -1
  67. package/lighthouse-core/gather/gatherers/dobetterweb/optimized-images.js +1 -1
  68. package/lighthouse-core/gather/gatherers/dobetterweb/password-inputs-with-prevented-paste.js +1 -1
  69. package/lighthouse-core/gather/gatherers/dobetterweb/response-compression.js +1 -1
  70. package/lighthouse-core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js +2 -2
  71. package/lighthouse-core/gather/gatherers/form-elements.js +3 -3
  72. package/lighthouse-core/gather/gatherers/full-page-screenshot.js +1 -1
  73. package/lighthouse-core/gather/gatherers/global-listeners.js +1 -1
  74. package/lighthouse-core/gather/gatherers/iframe-elements.js +1 -1
  75. package/lighthouse-core/gather/gatherers/inspector-issues.js +1 -1
  76. package/lighthouse-core/gather/gatherers/js-usage.js +1 -1
  77. package/lighthouse-core/gather/gatherers/main-document-content.js +1 -1
  78. package/lighthouse-core/gather/gatherers/meta-elements.js +1 -1
  79. package/lighthouse-core/gather/gatherers/script-elements.js +1 -1
  80. package/lighthouse-core/gather/gatherers/seo/embedded-content.js +1 -1
  81. package/lighthouse-core/gather/gatherers/seo/font-size.js +8 -5
  82. package/lighthouse-core/gather/gatherers/seo/robots-txt.js +1 -1
  83. package/lighthouse-core/gather/gatherers/service-worker.js +1 -1
  84. package/lighthouse-core/gather/gatherers/source-maps.js +1 -1
  85. package/lighthouse-core/gather/gatherers/trace-elements.js +1 -1
  86. package/lighthouse-core/gather/gatherers/viewport-dimensions.js +1 -1
  87. package/lighthouse-core/lib/dependency-graph/base-node.js +8 -0
  88. package/lighthouse-core/lib/dependency-graph/simulator/network-analyzer.js +3 -2
  89. package/lighthouse-core/lib/dependency-graph/simulator/simulator.js +17 -0
  90. package/package.json +10 -9
  91. package/report/assets/styles.css +15 -12
  92. package/report/assets/templates.html +1 -1
  93. package/report/renderer/components.js +2 -2
  94. package/report/renderer/report-renderer.js +1 -1
  95. package/report/test/renderer/report-renderer-axe-test.js +48 -53
  96. package/report/test-assets/faux-psi-template.html +85 -26
  97. package/report/test-assets/faux-psi.js +44 -8
  98. package/shared/localization/locales/en-US.json +1 -1
  99. package/shared/localization/locales/en-XL.json +1 -1
  100. package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +1 -0
  101. package/types/config.d.ts +1 -0
  102. package/types/externs.d.ts +1 -0
  103. package/types/gatherer.d.ts +1 -0
  104. package/types/smokehouse.d.ts +2 -0
@@ -46,4 +46,7 @@ class LargestContentfulPaint extends NavigationMetric {
46
46
  }
47
47
  }
48
48
 
49
- module.exports = makeComputedArtifact(LargestContentfulPaint);
49
+ module.exports = makeComputedArtifact(
50
+ LargestContentfulPaint,
51
+ ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
52
+ );
@@ -39,4 +39,7 @@ class MaxPotentialFID extends NavigationMetric {
39
39
  }
40
40
  }
41
41
 
42
- module.exports = makeComputedArtifact(MaxPotentialFID);
42
+ module.exports = makeComputedArtifact(
43
+ MaxPotentialFID,
44
+ ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
45
+ );
@@ -34,4 +34,7 @@ class SpeedIndex extends NavigationMetric {
34
34
  }
35
35
  }
36
36
 
37
- module.exports = makeComputedArtifact(SpeedIndex);
37
+ module.exports = makeComputedArtifact(
38
+ SpeedIndex,
39
+ ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
40
+ );
@@ -144,4 +144,7 @@ class TimingSummary {
144
144
  }
145
145
  }
146
146
 
147
- module.exports = makeComputedArtifact(TimingSummary);
147
+ module.exports = makeComputedArtifact(
148
+ TimingSummary,
149
+ ['devtoolsLog', 'gatherContext', 'settings', 'trace']
150
+ );
@@ -68,4 +68,7 @@ class TotalBlockingTime extends ComputedMetric {
68
68
  }
69
69
  }
70
70
 
71
- module.exports = makeComputedArtifact(TotalBlockingTime);
71
+ module.exports = makeComputedArtifact(
72
+ TotalBlockingTime,
73
+ ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace']
74
+ );
@@ -74,7 +74,7 @@ class ModuleDuplication {
74
74
  }
75
75
 
76
76
  /**
77
- * @param {LH.Artifacts} 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) {
@@ -133,4 +133,4 @@ class ModuleDuplication {
133
133
  }
134
134
  }
135
135
 
136
- module.exports = makeComputedArtifact(ModuleDuplication);
136
+ module.exports = makeComputedArtifact(ModuleDuplication, ['ScriptElements', 'SourceMaps']);
@@ -61,4 +61,4 @@ class NetworkAnalysis {
61
61
  }
62
62
  }
63
63
 
64
- module.exports = makeComputedArtifact(NetworkAnalysis);
64
+ module.exports = makeComputedArtifact(NetworkAnalysis, null);
@@ -18,4 +18,4 @@ class NetworkRecords {
18
18
  }
19
19
  }
20
20
 
21
- module.exports = makeComputedArtifact(NetworkRecords);
21
+ module.exports = makeComputedArtifact(NetworkRecords, null);
@@ -147,6 +147,9 @@ class PageDependencyGraph {
147
147
  const directInitiatorRequest = node.record.initiatorRequest || rootNode.record;
148
148
  const directInitiatorNode =
149
149
  networkNodeOutput.idToNodeMap.get(directInitiatorRequest.requestId) || rootNode;
150
+ const canDependOnInitiator =
151
+ !directInitiatorNode.isDependentOn(node) &&
152
+ node.canDependOn(directInitiatorNode);
150
153
  const initiators = PageDependencyGraph.getNetworkInitiators(node.record);
151
154
  if (initiators.length) {
152
155
  initiators.forEach(initiator => {
@@ -156,16 +159,18 @@ class PageDependencyGraph {
156
159
  parentCandidates[0].startTime <= node.startTime &&
157
160
  !parentCandidates[0].isDependentOn(node)) {
158
161
  node.addDependency(parentCandidates[0]);
159
- } else if (!directInitiatorNode.isDependentOn(node)) {
162
+ } else if (canDependOnInitiator) {
160
163
  directInitiatorNode.addDependent(node);
161
164
  }
162
165
  });
163
- } else if (!directInitiatorNode.isDependentOn(node)) {
166
+ } else if (canDependOnInitiator) {
164
167
  directInitiatorNode.addDependent(node);
165
168
  }
166
169
 
167
170
  // Make sure the nodes are attached to the graph if the initiator information was invalid.
168
- if (node !== rootNode && node.getDependencies().length === 0) node.addDependency(rootNode);
171
+ if (node !== rootNode && node.getDependencies().length === 0 && node.canDependOn(rootNode)) {
172
+ node.addDependency(rootNode);
173
+ }
169
174
 
170
175
  if (!node.record.redirects) return;
171
176
 
@@ -321,7 +326,8 @@ class PageDependencyGraph {
321
326
  }
322
327
  }
323
328
 
324
- if (node.getNumberOfDependencies() === 0) {
329
+ // Nodes starting before the root node cannot depend on it.
330
+ if (node.getNumberOfDependencies() === 0 && node.canDependOn(rootNode)) {
325
331
  node.addDependency(rootNode);
326
332
  }
327
333
  }
@@ -388,23 +394,27 @@ class PageDependencyGraph {
388
394
  const networkNodeOutput = PageDependencyGraph.getNetworkNodeOutput(networkRecords);
389
395
  const cpuNodes = PageDependencyGraph.getCPUNodes(processedTrace);
390
396
 
391
- // The root request is the earliest network request, using position in networkRecords array to break ties.
392
- const rootRequest = networkRecords.reduce((min, r) => (r.startTime < min.startTime ? r : min));
393
- const rootNode = networkNodeOutput.idToNodeMap.get(rootRequest.requestId);
394
397
  // The main document request is the earliest network request *of type document*.
395
398
  // This will be different from the root request when there are server redirects.
396
399
  const mainDocumentRequest = NetworkAnalyzer.findMainDocument(networkRecords);
397
400
  const mainDocumentNode = networkNodeOutput.idToNodeMap.get(mainDocumentRequest.requestId);
398
-
399
- if (!rootNode || !mainDocumentNode) {
400
- // Should always be found.
401
- throw new Error(`${rootNode ? 'mainDocument' : 'root'}Node not found.`);
401
+ if (!mainDocumentNode) {
402
+ // mainDocumentNode should always be found.
403
+ throw new Error('mainDocumentNode not found.');
402
404
  }
403
405
 
404
- if (mainDocumentNode !== rootNode &&
405
- (!mainDocumentNode.record.redirects ||
406
- !mainDocumentNode.record.redirects.includes(rootNode.record))) {
407
- throw new Error('Root node was not in redirect chain of mainDocument');
406
+ // The root request is the earliest request in the main document redirect chain.
407
+ // Will be undefined if there were no redirects.
408
+ const rootRequest = mainDocumentNode.record.redirects && mainDocumentNode.record.redirects[0];
409
+
410
+ let rootNode;
411
+ if (rootRequest) {
412
+ // rootNode should always be found.
413
+ rootNode = rootRequest && networkNodeOutput.idToNodeMap.get(rootRequest.requestId);
414
+ if (!rootNode) throw new Error('rootNode not found');
415
+ } else {
416
+ // Use main document as root if there were no redirects.
417
+ rootNode = mainDocumentNode;
408
418
  }
409
419
 
410
420
  PageDependencyGraph.linkNetworkNodes(rootNode, networkNodeOutput);
@@ -467,7 +477,7 @@ class PageDependencyGraph {
467
477
  }
468
478
  }
469
479
 
470
- module.exports = makeComputedArtifact(PageDependencyGraph);
480
+ module.exports = makeComputedArtifact(PageDependencyGraph, ['devtoolsLog', 'trace']);
471
481
 
472
482
  /**
473
483
  * @typedef {Object} NetworkNodeOutput
@@ -18,4 +18,4 @@ class ProcessedNavigation {
18
18
  }
19
19
  }
20
20
 
21
- module.exports = makeComputedArtifact(ProcessedNavigation);
21
+ module.exports = makeComputedArtifact(ProcessedNavigation, null);
@@ -18,4 +18,4 @@ class ProcessedTrace {
18
18
  }
19
19
  }
20
20
 
21
- module.exports = makeComputedArtifact(ProcessedTrace);
21
+ module.exports = makeComputedArtifact(ProcessedTrace, null);
@@ -111,4 +111,4 @@ class ResourceSummary {
111
111
  }
112
112
  }
113
113
 
114
- module.exports = makeComputedArtifact(ResourceSummary);
114
+ module.exports = makeComputedArtifact(ResourceSummary, ['URL', 'devtoolsLog', 'budgets']);
@@ -26,4 +26,4 @@ class Screenshots {
26
26
  }
27
27
  }
28
28
 
29
- module.exports = makeComputedArtifact(Screenshots);
29
+ module.exports = makeComputedArtifact(Screenshots, null);
@@ -51,4 +51,4 @@ class Speedline {
51
51
  }
52
52
  }
53
53
 
54
- module.exports = makeComputedArtifact(Speedline);
54
+ module.exports = makeComputedArtifact(Speedline, null);
@@ -26,5 +26,5 @@ class TraceOfTab {
26
26
  }
27
27
 
28
28
  log.warn(`trace-of-tab`, `trace-of-tab is deprecated, use processed-trace / processed-navigation instead`); // eslint-disable-line max-len
29
- module.exports = makeComputedArtifact(TraceOfTab);
29
+ module.exports = makeComputedArtifact(TraceOfTab, null);
30
30
 
@@ -98,9 +98,9 @@ class UnusedCSS {
98
98
  const firstRuleStart = preview.indexOf('{');
99
99
  const firstRuleEnd = preview.indexOf('}');
100
100
 
101
- if (firstRuleStart === -1 || firstRuleEnd === -1
102
- || firstRuleStart > firstRuleEnd
103
- || firstRuleStart > PREVIEW_LENGTH) {
101
+ if (firstRuleStart === -1 || firstRuleEnd === -1 ||
102
+ firstRuleStart > firstRuleEnd ||
103
+ firstRuleStart > PREVIEW_LENGTH) {
104
104
  // We couldn't determine the first rule-set or it's not within the preview
105
105
  preview = preview.slice(0, PREVIEW_LENGTH) + '...';
106
106
  } else if (firstRuleEnd < PREVIEW_LENGTH) {
@@ -151,4 +151,4 @@ class UnusedCSS {
151
151
  }
152
152
  }
153
153
 
154
- module.exports = makeComputedArtifact(UnusedCSS);
154
+ module.exports = makeComputedArtifact(UnusedCSS, ['CSSUsage', 'URL', 'devtoolsLog']);
@@ -169,4 +169,7 @@ class UnusedJavascriptSummary {
169
169
  }
170
170
  }
171
171
 
172
- module.exports = makeComputedArtifact(UnusedJavascriptSummary);
172
+ module.exports = makeComputedArtifact(
173
+ UnusedJavascriptSummary,
174
+ ['bundle', 'scriptCoverages', 'url']
175
+ );
@@ -80,4 +80,4 @@ class UserTimings {
80
80
  }
81
81
  }
82
82
 
83
- module.exports = makeComputedArtifact(UserTimings);
83
+ module.exports = makeComputedArtifact(UserTimings, null);
@@ -46,7 +46,7 @@ class ViewportMeta {
46
46
  }
47
47
  }
48
48
 
49
- module.exports = makeComputedArtifact(ViewportMeta);
49
+ module.exports = makeComputedArtifact(ViewportMeta, null);
50
50
 
51
51
  /**
52
52
  * @typedef {object} ViewportMetaResult
@@ -463,6 +463,7 @@ const defaultConfig = {
463
463
  {id: 'non-composited-animations', weight: 0},
464
464
  {id: 'unsized-images', weight: 0},
465
465
  {id: 'viewport', weight: 0},
466
+ {id: 'no-unload-listeners', weight: 0},
466
467
 
467
468
  // Budget audits.
468
469
  {id: 'performance-budget', weight: 0, group: 'budgets'},
@@ -566,7 +567,6 @@ const defaultConfig = {
566
567
  {id: 'doctype', weight: 1, group: 'best-practices-browser-compat'},
567
568
  {id: 'charset', weight: 1, group: 'best-practices-browser-compat'},
568
569
  // General Group
569
- {id: 'no-unload-listeners', weight: 1, group: 'best-practices-general'},
570
570
  {id: 'js-libraries', weight: 0, group: 'best-practices-general'},
571
571
  {id: 'deprecations', weight: 1, group: 'best-practices-general'},
572
572
  {id: 'errors-in-console', weight: 1, group: 'best-practices-general'},
@@ -17,7 +17,7 @@
17
17
  */
18
18
  class FRGatherer {
19
19
  /** @type {LH.Gatherer.GathererMeta} */
20
- meta = {supportedModes: []}
20
+ meta = {supportedModes: []};
21
21
 
22
22
  /**
23
23
  * Method to start observing a page for an arbitrary period of time.
@@ -27,6 +27,8 @@ const Trace = require('../../gather/gatherers/trace.js');
27
27
  const DevtoolsLog = require('../../gather/gatherers/devtools-log.js');
28
28
  const NetworkRecords = require('../../computed/network-records.js');
29
29
 
30
+ /** @typedef {{skipAboutBlank?: boolean}} InternalOptions */
31
+
30
32
  /**
31
33
  * @typedef NavigationContext
32
34
  * @property {Driver} driver
@@ -35,17 +37,20 @@ const NetworkRecords = require('../../computed/network-records.js');
35
37
  * @property {string} requestedUrl
36
38
  * @property {LH.FRBaseArtifacts} baseArtifacts
37
39
  * @property {Map<string, LH.ArbitraryEqualityMap>} computedCache
40
+ * @property {InternalOptions} [options]
38
41
  */
39
42
 
40
43
  /** @typedef {Omit<Parameters<typeof collectPhaseArtifacts>[0], 'phase'>} PhaseState */
41
44
 
42
45
  /**
43
- * @param {{driver: Driver, config: LH.Config.FRConfig, requestedUrl: string}} args
46
+ * @param {{driver: Driver, config: LH.Config.FRConfig, requestedUrl: string, options?: InternalOptions}} args
44
47
  * @return {Promise<{baseArtifacts: LH.FRBaseArtifacts}>}
45
48
  */
46
- async function _setup({driver, config, requestedUrl}) {
49
+ async function _setup({driver, config, requestedUrl, options}) {
47
50
  await driver.connect();
48
- await gotoURL(driver, defaultNavigationConfig.blankPage, {waitUntil: ['navigated']});
51
+ if (!options?.skipAboutBlank) {
52
+ await gotoURL(driver, defaultNavigationConfig.blankPage, {waitUntil: ['navigated']});
53
+ }
49
54
 
50
55
  const baseArtifacts = await getBaseArtifacts(config, driver, {gatherMode: 'navigation'});
51
56
  baseArtifacts.URL.requestedUrl = requestedUrl;
@@ -59,8 +64,10 @@ async function _setup({driver, config, requestedUrl}) {
59
64
  * @param {NavigationContext} navigationContext
60
65
  * @return {Promise<{warnings: Array<LH.IcuMessage>}>}
61
66
  */
62
- async function _setupNavigation({requestedUrl, driver, navigation, config}) {
63
- await gotoURL(driver, navigation.blankPage, {...navigation, waitUntil: ['navigated']});
67
+ async function _setupNavigation({requestedUrl, driver, navigation, config, options}) {
68
+ if (!options?.skipAboutBlank) {
69
+ await gotoURL(driver, navigation.blankPage, {...navigation, waitUntil: ['navigated']});
70
+ }
64
71
  const {warnings} = await prepare.prepareTargetForIndividualNavigation(
65
72
  driver.defaultSession,
66
73
  config.settings,
@@ -216,10 +223,10 @@ async function _navigation(navigationContext) {
216
223
  }
217
224
 
218
225
  /**
219
- * @param {{driver: Driver, config: LH.Config.FRConfig, requestedUrl: string; baseArtifacts: LH.FRBaseArtifacts, computedCache: NavigationContext['computedCache']}} args
226
+ * @param {{driver: Driver, config: LH.Config.FRConfig, requestedUrl: string; baseArtifacts: LH.FRBaseArtifacts, computedCache: NavigationContext['computedCache'], options?: InternalOptions}} args
220
227
  * @return {Promise<{artifacts: Partial<LH.FRArtifacts & LH.FRBaseArtifacts>}>}
221
228
  */
222
- async function _navigations({driver, config, requestedUrl, baseArtifacts, computedCache}) {
229
+ async function _navigations({driver, config, requestedUrl, baseArtifacts, computedCache, options}) {
223
230
  if (!config.navigations) throw new Error('No navigations configured');
224
231
 
225
232
  /** @type {Partial<LH.FRArtifacts & LH.FRBaseArtifacts>} */
@@ -235,6 +242,7 @@ async function _navigations({driver, config, requestedUrl, baseArtifacts, comput
235
242
  config,
236
243
  baseArtifacts,
237
244
  computedCache,
245
+ options,
238
246
  };
239
247
 
240
248
  let shouldHaltNavigations = false;
@@ -274,11 +282,14 @@ async function navigation(options) {
274
282
  const {url: requestedUrl, page, configContext = {}} = options;
275
283
  const {config} = initializeConfig(options.config, {...configContext, gatherMode: 'navigation'});
276
284
  const computedCache = new Map();
285
+ const internalOptions = {
286
+ skipAboutBlank: configContext.skipAboutBlank,
287
+ };
277
288
 
278
289
  return Runner.run(
279
290
  async () => {
280
291
  const driver = new Driver(page);
281
- const context = {driver, config, requestedUrl};
292
+ const context = {driver, config, requestedUrl, options: internalOptions};
282
293
  const {baseArtifacts} = await _setup(context);
283
294
  const {artifacts} = await _navigations({...context, baseArtifacts, computedCache});
284
295
  await _cleanup(context);
@@ -59,20 +59,24 @@ class UserFlow {
59
59
  */
60
60
  _getNextNavigationOptions(url, stepOptions) {
61
61
  const options = {url, ...this.options, ...stepOptions};
62
+ const configContext = {...options.configContext};
63
+ const settingsOverrides = {...configContext.settingsOverrides};
64
+
65
+ if (configContext.skipAboutBlank === undefined) {
66
+ configContext.skipAboutBlank = true;
67
+ }
62
68
 
63
69
  // On repeat navigations, we want to disable storage reset by default (i.e. it's not a cold load).
64
70
  const isSubsequentNavigation = this.steps.some(step => step.lhr.gatherMode === 'navigation');
65
71
  if (isSubsequentNavigation) {
66
- const configContext = {...options.configContext};
67
- const settingsOverrides = {...configContext.settingsOverrides};
68
72
  if (settingsOverrides.disableStorageReset === undefined) {
69
73
  settingsOverrides.disableStorageReset = true;
70
74
  }
71
-
72
- configContext.settingsOverrides = settingsOverrides;
73
- options.configContext = configContext;
74
75
  }
75
76
 
77
+ configContext.settingsOverrides = settingsOverrides;
78
+ options.configContext = configContext;
79
+
76
80
  return options;
77
81
  }
78
82
 
@@ -211,6 +211,7 @@ class ExecutionContext {
211
211
  window.__nativePromise = window.Promise;
212
212
  window.__nativeURL = window.URL;
213
213
  window.__nativePerformance = window.performance;
214
+ window.__nativeFetch = window.fetch;
214
215
  window.__ElementMatches = window.Element.prototype.matches;
215
216
  // Ensure the native `performance.now` is not overwritable.
216
217
  const performance = window.performance;
@@ -232,6 +233,7 @@ class ExecutionContext {
232
233
  'const Promise = globalThis.__nativePromise || globalThis.Promise',
233
234
  'const URL = globalThis.__nativeURL || globalThis.URL',
234
235
  'const performance = globalThis.__nativePerformance || globalThis.performance',
236
+ 'const fetch = globalThis.__nativeFetch || globalThis.fetch',
235
237
  ].join(';\n');
236
238
 
237
239
  /**
@@ -5,7 +5,7 @@
5
5
  */
6
6
  'use strict';
7
7
 
8
- /* global window, performance */
8
+ /* global window */
9
9
 
10
10
  const log = require('lighthouse-logger');
11
11
  const LHError = require('../../lib/lh-error.js');
@@ -148,7 +148,7 @@ class Accessibility extends FRGatherer {
148
148
  /** @type {LH.Gatherer.GathererMeta} */
149
149
  meta = {
150
150
  supportedModes: ['snapshot', 'navigation'],
151
- }
151
+ };
152
152
 
153
153
  /**
154
154
  * @param {LH.Gatherer.FRTransitionalContext} passContext
@@ -94,7 +94,7 @@ class AnchorElements extends FRGatherer {
94
94
  /** @type {LH.Gatherer.GathererMeta} */
95
95
  meta = {
96
96
  supportedModes: ['snapshot', 'navigation'],
97
- }
97
+ };
98
98
 
99
99
  /**
100
100
  * @param {LH.Gatherer.FRTransitionalContext} passContext
@@ -41,7 +41,7 @@ class CacheContents extends FRGatherer {
41
41
  /** @type {LH.Gatherer.GathererMeta} */
42
42
  meta = {
43
43
  supportedModes: ['snapshot', 'navigation'],
44
- }
44
+ };
45
45
 
46
46
  /**
47
47
  * Creates an array of cached URLs.
@@ -34,7 +34,7 @@ class ConsoleMessages extends FRGatherer {
34
34
  /** @type {LH.Gatherer.GathererMeta} */
35
35
  meta = {
36
36
  supportedModes: ['timespan', 'navigation'],
37
- }
37
+ };
38
38
 
39
39
  constructor() {
40
40
  super();
@@ -28,7 +28,7 @@ class Doctype extends FRGatherer {
28
28
  /** @type {LH.Gatherer.GathererMeta} */
29
29
  meta = {
30
30
  supportedModes: ['snapshot', 'navigation'],
31
- }
31
+ };
32
32
 
33
33
  /**
34
34
  * @param {LH.Gatherer.FRTransitionalContext} passContext
@@ -80,7 +80,7 @@ class DOMStats extends FRGatherer {
80
80
  /** @type {LH.Gatherer.GathererMeta} */
81
81
  meta = {
82
82
  supportedModes: ['snapshot', 'navigation'],
83
- }
83
+ };
84
84
 
85
85
  /**
86
86
  * @param {LH.Gatherer.FRTransitionalContext} passContext
@@ -38,7 +38,7 @@ class OptimizedImages extends FRGatherer {
38
38
  meta = {
39
39
  supportedModes: ['timespan', 'navigation'],
40
40
  dependencies: {DevtoolsLog: DevtoolsLog.symbol},
41
- }
41
+ };
42
42
 
43
43
  constructor() {
44
44
  super();
@@ -32,7 +32,7 @@ class PasswordInputsWithPreventedPaste extends FRGatherer {
32
32
  /** @type {LH.Gatherer.GathererMeta} */
33
33
  meta = {
34
34
  supportedModes: ['snapshot', 'navigation'],
35
- }
35
+ };
36
36
 
37
37
  /**
38
38
  * @param {LH.Gatherer.FRTransitionalContext} passContext
@@ -43,7 +43,7 @@ class ResponseCompression extends FRGatherer {
43
43
  meta = {
44
44
  supportedModes: ['timespan', 'navigation'],
45
45
  dependencies: {DevtoolsLog: DevtoolsLog.symbol},
46
- }
46
+ };
47
47
 
48
48
  /**
49
49
  * @param {LH.Artifacts.NetworkRequest[]} networkRecords
@@ -22,7 +22,7 @@ const NetworkRecords = require('../../../computed/network-records.js');
22
22
  const DevtoolsLog = require('../devtools-log.js');
23
23
  const FRGatherer = require('../../../fraggle-rock/gather/base-gatherer.js');
24
24
 
25
- /* global document, window, performance, HTMLLinkElement, SVGScriptElement */
25
+ /* global document, window, HTMLLinkElement, SVGScriptElement */
26
26
 
27
27
  /** @typedef {{href: string, media: string, msSinceHTMLEnd: number, matches: boolean}} MediaChange */
28
28
  /** @typedef {{tagName: 'LINK', url: string, href: string, rel: string, media: string, disabled: boolean, mediaChanges: Array<MediaChange>}} LinkTag */
@@ -119,7 +119,7 @@ class TagsBlockingFirstPaint extends FRGatherer {
119
119
  meta = {
120
120
  supportedModes: ['navigation'],
121
121
  dependencies: {DevtoolsLog: DevtoolsLog.symbol},
122
- }
122
+ };
123
123
 
124
124
  /**
125
125
  * @param {Array<LH.Artifacts.NetworkRequest>} networkRecords
@@ -49,8 +49,8 @@ function collectFormElements() {
49
49
  forms.set(parentFormElement, newFormObj);
50
50
  }
51
51
  const formObj = forms.get(parentFormElement) || formlessObj;
52
- if (child instanceof HTMLInputElement || child instanceof HTMLTextAreaElement
53
- || child instanceof HTMLSelectElement) {
52
+ if (child instanceof HTMLInputElement || child instanceof HTMLTextAreaElement ||
53
+ child instanceof HTMLSelectElement) {
54
54
  formObj.inputs.push({
55
55
  id: child.id,
56
56
  name: child.name,
@@ -89,7 +89,7 @@ class FormElements extends FRGatherer {
89
89
  /** @type {LH.Gatherer.GathererMeta} */
90
90
  meta = {
91
91
  supportedModes: ['snapshot', 'navigation'],
92
- }
92
+ };
93
93
 
94
94
  /**
95
95
  * @param {LH.Gatherer.FRTransitionalContext} passContext
@@ -46,7 +46,7 @@ class FullPageScreenshot extends FRGatherer {
46
46
  /** @type {LH.Gatherer.GathererMeta} */
47
47
  meta = {
48
48
  supportedModes: ['snapshot', 'timespan', 'navigation'],
49
- }
49
+ };
50
50
 
51
51
  /**
52
52
  * @param {LH.Gatherer.FRTransitionalContext} context
@@ -18,7 +18,7 @@ class GlobalListeners extends FRGatherer {
18
18
  /** @type {LH.Gatherer.GathererMeta} */
19
19
  meta = {
20
20
  supportedModes: ['snapshot', 'timespan', 'navigation'],
21
- }
21
+ };
22
22
 
23
23
  /**
24
24
  * @param {LH.Crdp.DOMDebugger.EventListener} listener
@@ -39,7 +39,7 @@ class IFrameElements extends FRGatherer {
39
39
  /** @type {LH.Gatherer.GathererMeta} */
40
40
  meta = {
41
41
  supportedModes: ['snapshot', 'navigation'],
42
- }
42
+ };
43
43
 
44
44
  /**
45
45
  * @param {LH.Gatherer.FRTransitionalContext} passContext
@@ -19,7 +19,7 @@ class InspectorIssues extends FRGatherer {
19
19
  meta = {
20
20
  supportedModes: ['timespan', 'navigation'],
21
21
  dependencies: {DevtoolsLog: DevtoolsLog.symbol},
22
- }
22
+ };
23
23
 
24
24
  constructor() {
25
25
  super();
@@ -14,7 +14,7 @@ class JsUsage extends FRGatherer {
14
14
  /** @type {LH.Gatherer.GathererMeta} */
15
15
  meta = {
16
16
  supportedModes: ['snapshot', 'timespan', 'navigation'],
17
- }
17
+ };
18
18
 
19
19
  constructor() {
20
20
  super();
@@ -19,7 +19,7 @@ class MainDocumentContent extends FRGatherer {
19
19
  meta = {
20
20
  supportedModes: ['navigation'],
21
21
  dependencies: {DevtoolsLog: DevtoolsLog.symbol},
22
- }
22
+ };
23
23
 
24
24
  /**
25
25
  *
@@ -43,7 +43,7 @@ class MetaElements extends FRGatherer {
43
43
  /** @type {LH.Gatherer.GathererMeta} */
44
44
  meta = {
45
45
  supportedModes: ['snapshot', 'navigation'],
46
- }
46
+ };
47
47
 
48
48
  /**
49
49
  * @param {LH.Gatherer.FRTransitionalContext} passContext
@@ -70,7 +70,7 @@ class ScriptElements extends FRGatherer {
70
70
  meta = {
71
71
  supportedModes: ['timespan', 'navigation'],
72
72
  dependencies: {DevtoolsLog: DevtoolsLog.symbol},
73
- }
73
+ };
74
74
 
75
75
  /**
76
76
  * @param {LH.Gatherer.FRTransitionalContext} context