lighthouse 12.8.2 → 13.0.0-dev.20251009
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.
- package/cli/cli-flags.js +1 -1
- package/cli/test/smokehouse/config/exclusions.js +0 -2
- package/cli/test/smokehouse/version-check.d.ts +1 -1
- package/core/audits/accessibility/accesskeys.js +3 -3
- package/core/audits/accessibility/aria-allowed-attr.js +3 -3
- package/core/audits/accessibility/aria-allowed-role.js +2 -1
- package/core/audits/accessibility/aria-command-name.js +1 -1
- package/core/audits/accessibility/aria-conditional-attr.js +1 -1
- package/core/audits/accessibility/aria-deprecated-role.js +1 -1
- package/core/audits/accessibility/aria-dialog-name.js +1 -1
- package/core/audits/accessibility/aria-hidden-body.js +3 -3
- package/core/audits/accessibility/aria-hidden-focus.js +3 -3
- package/core/audits/accessibility/aria-input-field-name.js +3 -3
- package/core/audits/accessibility/aria-meter-name.js +1 -1
- package/core/audits/accessibility/aria-progressbar-name.js +1 -1
- package/core/audits/accessibility/aria-prohibited-attr.js +1 -1
- package/core/audits/accessibility/aria-required-attr.js +3 -3
- package/core/audits/accessibility/aria-required-children.js +3 -3
- package/core/audits/accessibility/aria-required-parent.js +3 -3
- package/core/audits/accessibility/aria-roles.js +3 -3
- package/core/audits/accessibility/aria-text.js +3 -3
- package/core/audits/accessibility/aria-toggle-field-name.js +3 -3
- package/core/audits/accessibility/aria-tooltip-name.js +1 -1
- package/core/audits/accessibility/aria-treeitem-name.js +1 -1
- package/core/audits/accessibility/aria-valid-attr-value.js +3 -3
- package/core/audits/accessibility/aria-valid-attr.js +3 -3
- package/core/audits/accessibility/button-name.js +3 -3
- package/core/audits/accessibility/bypass.js +3 -3
- package/core/audits/accessibility/color-contrast.js +3 -3
- package/core/audits/accessibility/definition-list.js +3 -3
- package/core/audits/accessibility/dlitem.js +3 -3
- package/core/audits/accessibility/document-title.js +3 -3
- package/core/audits/accessibility/duplicate-id-aria.js +3 -3
- package/core/audits/accessibility/empty-heading.js +3 -3
- package/core/audits/accessibility/form-field-multiple-labels.js +3 -3
- package/core/audits/accessibility/frame-title.js +3 -3
- package/core/audits/accessibility/heading-order.js +3 -3
- package/core/audits/accessibility/html-has-lang.js +3 -3
- package/core/audits/accessibility/html-lang-valid.js +3 -3
- package/core/audits/accessibility/html-xml-lang-mismatch.js +3 -3
- package/core/audits/accessibility/identical-links-same-purpose.js +3 -3
- package/core/audits/accessibility/image-alt.js +3 -3
- package/core/audits/accessibility/image-redundant-alt.js +4 -3
- package/core/audits/accessibility/input-button-name.js +3 -3
- package/core/audits/accessibility/input-image-alt.js +3 -3
- package/core/audits/accessibility/label-content-name-mismatch.js +3 -3
- package/core/audits/accessibility/label.js +3 -3
- package/core/audits/accessibility/landmark-one-main.js +3 -4
- package/core/audits/accessibility/link-in-text-block.js +3 -3
- package/core/audits/accessibility/link-name.js +3 -3
- package/core/audits/accessibility/list.js +3 -3
- package/core/audits/accessibility/listitem.js +3 -3
- package/core/audits/accessibility/meta-refresh.js +3 -3
- package/core/audits/accessibility/meta-viewport.js +3 -3
- package/core/audits/accessibility/object-alt.js +3 -3
- package/core/audits/accessibility/select-name.js +3 -3
- package/core/audits/accessibility/skip-link.js +3 -3
- package/core/audits/accessibility/tabindex.js +3 -3
- package/core/audits/accessibility/table-duplicate-name.js +4 -3
- package/core/audits/accessibility/table-fake-caption.js +3 -3
- package/core/audits/accessibility/target-size.js +3 -3
- package/core/audits/accessibility/td-has-header.js +3 -3
- package/core/audits/accessibility/td-headers-attr.js +3 -3
- package/core/audits/accessibility/th-has-data-cells.js +3 -3
- package/core/audits/accessibility/valid-lang.js +3 -3
- package/core/audits/accessibility/video-caption.js +3 -3
- package/core/audits/audit.d.ts +0 -4
- package/core/audits/audit.js +2 -13
- package/core/audits/insights/cls-culprits-insight.js +1 -1
- package/core/audits/insights/dom-size-insight.js +11 -7
- package/core/audits/insights/font-display-insight.js +3 -1
- package/core/audits/insights/image-delivery-insight.js +4 -1
- package/core/audits/insights/insight-audit.d.ts +6 -4
- package/core/audits/insights/insight-audit.js +27 -8
- package/core/audits/insights/third-parties-insight.js +1 -1
- package/core/audits/layout-shifts.js +1 -1
- package/core/audits/predictive-perf.js +2 -2
- package/core/audits/seo/crawlable-anchors.js +2 -3
- package/core/audits/seo/manual/structured-data.js +1 -1
- package/core/audits/server-response-time.d.ts +0 -5
- package/core/audits/server-response-time.js +12 -26
- package/core/computed/metrics/cumulative-layout-shift.js +2 -2
- package/core/computed/metrics/lantern-metric.js +3 -3
- package/core/computed/metrics/lcp-breakdown.d.ts +10 -5
- package/core/computed/metrics/lcp-breakdown.js +50 -22
- package/core/computed/metrics/time-to-first-byte.js +33 -10
- package/core/computed/metrics/timing-summary.js +3 -2
- package/core/computed/page-dependency-graph.js +1 -1
- package/core/computed/trace-engine-result.js +2 -2
- package/core/config/default-config.js +110 -152
- package/core/config/experimental-config.js +1 -32
- package/core/config/filters.js +6 -9
- package/core/config/lr-desktop-config.js +0 -1
- package/core/config/lr-mobile-config.js +0 -1
- package/core/gather/driver/target-manager.d.ts +1 -1
- package/core/gather/driver.d.ts +1 -1
- package/core/gather/gatherers/anchor-elements.js +8 -24
- package/core/gather/gatherers/image-elements.js +32 -6
- package/core/gather/gatherers/inspector-issues.js +1 -28
- package/core/gather/gatherers/trace-elements.d.ts +2 -11
- package/core/gather/gatherers/trace-elements.js +9 -39
- package/core/gather/navigation-runner.js +0 -3
- package/core/gather/session.d.ts +1 -1
- package/core/lib/asset-saver.d.ts +2 -2
- package/core/lib/asset-saver.js +33 -43
- package/core/lib/bf-cache-strings.js +10 -9
- package/core/lib/deprecations-strings.js +5 -5
- package/core/lib/emulation.d.ts +10 -0
- package/core/lib/emulation.js +21 -6
- package/core/lib/legacy-javascript/legacy-javascript.js +4 -11
- package/core/lib/network-request.d.ts +0 -7
- package/core/lib/network-request.js +0 -16
- package/core/lib/proto-preprocessor.js +10 -25
- package/core/runner.js +1 -8
- package/core/scoring.js +1 -1
- package/dist/report/bundle.esm.js +10 -49
- package/dist/report/flow.js +12 -51
- package/dist/report/standalone.js +11 -50
- package/flow-report/src/i18n/i18n.d.ts +4 -6
- package/package.json +16 -19
- package/readme.md +2 -2
- package/report/assets/styles.css +0 -39
- package/report/renderer/api.js +0 -1
- package/report/renderer/category-renderer.js +6 -0
- package/report/renderer/components.js +1 -1
- package/report/renderer/details-renderer.d.ts +1 -2
- package/report/renderer/details-renderer.js +0 -1
- package/report/renderer/dom.d.ts +0 -13
- package/report/renderer/dom.js +0 -38
- package/report/renderer/performance-category-renderer.d.ts +0 -26
- package/report/renderer/performance-category-renderer.js +10 -142
- package/report/renderer/report-ui-features.d.ts +0 -1
- package/report/renderer/report-ui-features.js +2 -13
- package/report/renderer/report-utils.d.ts +2 -3
- package/report/renderer/report-utils.js +4 -6
- package/report/types/report-renderer.d.ts +0 -6
- package/shared/localization/locales/ar-XB.json +107 -455
- package/shared/localization/locales/ar.json +107 -455
- package/shared/localization/locales/bg.json +96 -444
- package/shared/localization/locales/ca.json +96 -444
- package/shared/localization/locales/cs.json +96 -444
- package/shared/localization/locales/da.json +96 -444
- package/shared/localization/locales/de.json +96 -444
- package/shared/localization/locales/el.json +96 -444
- package/shared/localization/locales/en-GB.json +96 -444
- package/shared/localization/locales/en-US.json +116 -467
- package/shared/localization/locales/en-XA.json +93 -441
- package/shared/localization/locales/en-XL.json +116 -467
- package/shared/localization/locales/es-419.json +96 -444
- package/shared/localization/locales/es.json +96 -444
- package/shared/localization/locales/fi.json +96 -444
- package/shared/localization/locales/fil.json +96 -444
- package/shared/localization/locales/fr.json +96 -444
- package/shared/localization/locales/he.json +118 -466
- package/shared/localization/locales/hi.json +96 -444
- package/shared/localization/locales/hr.json +100 -448
- package/shared/localization/locales/hu.json +96 -444
- package/shared/localization/locales/id.json +96 -444
- package/shared/localization/locales/it.json +96 -444
- package/shared/localization/locales/ja.json +96 -444
- package/shared/localization/locales/ko.json +97 -445
- package/shared/localization/locales/lt.json +96 -444
- package/shared/localization/locales/lv.json +97 -445
- package/shared/localization/locales/nl.json +96 -444
- package/shared/localization/locales/no.json +96 -444
- package/shared/localization/locales/pl.json +96 -444
- package/shared/localization/locales/pt-PT.json +96 -444
- package/shared/localization/locales/pt.json +97 -445
- package/shared/localization/locales/ro.json +97 -445
- package/shared/localization/locales/ru.json +96 -444
- package/shared/localization/locales/sk.json +96 -444
- package/shared/localization/locales/sl.json +96 -444
- package/shared/localization/locales/sr-Latn.json +96 -444
- package/shared/localization/locales/sr.json +96 -444
- package/shared/localization/locales/sv.json +96 -444
- package/shared/localization/locales/ta.json +96 -444
- package/shared/localization/locales/te.json +97 -445
- package/shared/localization/locales/th.json +96 -444
- package/shared/localization/locales/tr.json +96 -444
- package/shared/localization/locales/uk.json +96 -444
- package/shared/localization/locales/vi.json +96 -444
- package/shared/localization/locales/zh-HK.json +96 -444
- package/shared/localization/locales/zh-TW.json +97 -445
- package/shared/localization/locales/zh.json +96 -444
- package/shared/localization/locales.d.ts +2 -0
- package/shared/localization/locales.js +130 -139
- package/shared/tsconfig.json +2 -0
- package/tsconfig-base.json +2 -2
- package/tsconfig.json +1 -4
- package/types/artifacts.d.ts +6 -81
- package/types/audit.d.ts +1 -1
- package/types/lhr/settings.d.ts +1 -1
- package/core/audits/byte-efficiency/duplicated-javascript.d.ts +0 -45
- package/core/audits/byte-efficiency/duplicated-javascript.js +0 -223
- package/core/audits/byte-efficiency/efficient-animated-content.d.ts +0 -22
- package/core/audits/byte-efficiency/efficient-animated-content.js +0 -93
- package/core/audits/byte-efficiency/legacy-javascript.d.ts +0 -28
- package/core/audits/byte-efficiency/legacy-javascript.js +0 -144
- package/core/audits/byte-efficiency/modern-image-formats.d.ts +0 -38
- package/core/audits/byte-efficiency/modern-image-formats.js +0 -187
- package/core/audits/byte-efficiency/offscreen-images.d.ts +0 -63
- package/core/audits/byte-efficiency/offscreen-images.js +0 -240
- package/core/audits/byte-efficiency/render-blocking-resources.d.ts +0 -53
- package/core/audits/byte-efficiency/render-blocking-resources.js +0 -312
- package/core/audits/byte-efficiency/uses-long-cache-ttl.d.ts +0 -59
- package/core/audits/byte-efficiency/uses-long-cache-ttl.js +0 -293
- package/core/audits/byte-efficiency/uses-optimized-images.d.ts +0 -33
- package/core/audits/byte-efficiency/uses-optimized-images.js +0 -146
- package/core/audits/byte-efficiency/uses-responsive-images-snapshot.d.ts +0 -16
- package/core/audits/byte-efficiency/uses-responsive-images-snapshot.js +0 -106
- package/core/audits/byte-efficiency/uses-responsive-images.d.ts +0 -44
- package/core/audits/byte-efficiency/uses-responsive-images.js +0 -202
- package/core/audits/byte-efficiency/uses-text-compression.d.ts +0 -14
- package/core/audits/byte-efficiency/uses-text-compression.js +0 -108
- package/core/audits/critical-request-chains.d.ts +0 -44
- package/core/audits/critical-request-chains.js +0 -221
- package/core/audits/dobetterweb/dom-size.d.ts +0 -32
- package/core/audits/dobetterweb/dom-size.js +0 -182
- package/core/audits/dobetterweb/no-document-write.d.ts +0 -16
- package/core/audits/dobetterweb/no-document-write.js +0 -86
- package/core/audits/dobetterweb/uses-http2.d.ts +0 -72
- package/core/audits/dobetterweb/uses-http2.js +0 -276
- package/core/audits/dobetterweb/uses-passive-event-listeners.d.ts +0 -16
- package/core/audits/dobetterweb/uses-passive-event-listeners.js +0 -69
- package/core/audits/font-display.d.ts +0 -32
- package/core/audits/font-display.js +0 -195
- package/core/audits/largest-contentful-paint-element.d.ts +0 -34
- package/core/audits/largest-contentful-paint-element.js +0 -181
- package/core/audits/lcp-lazy-loaded.d.ts +0 -22
- package/core/audits/lcp-lazy-loaded.js +0 -115
- package/core/audits/metrics/first-meaningful-paint.d.ts +0 -12
- package/core/audits/metrics/first-meaningful-paint.js +0 -47
- package/core/audits/preload-fonts.d.ts +0 -25
- package/core/audits/preload-fonts.js +0 -97
- package/core/audits/prioritize-lcp-image.d.ts +0 -74
- package/core/audits/prioritize-lcp-image.js +0 -297
- package/core/audits/seo/font-size.d.ts +0 -24
- package/core/audits/seo/font-size.js +0 -344
- package/core/audits/third-party-facades.d.ts +0 -41
- package/core/audits/third-party-facades.js +0 -234
- package/core/audits/third-party-summary.d.ts +0 -78
- package/core/audits/third-party-summary.js +0 -236
- package/core/audits/uses-rel-preconnect.d.ts +0 -37
- package/core/audits/uses-rel-preconnect.js +0 -286
- package/core/audits/uses-rel-preload.d.ts +0 -57
- package/core/audits/uses-rel-preload.js +0 -263
- package/core/audits/viewport.d.ts +0 -17
- package/core/audits/viewport.js +0 -87
- package/core/audits/work-during-interaction.d.ts +0 -81
- package/core/audits/work-during-interaction.js +0 -287
- package/core/computed/critical-request-chains.d.ts +0 -42
- package/core/computed/critical-request-chains.js +0 -143
- package/core/computed/viewport-meta.d.ts +0 -37
- package/core/computed/viewport-meta.js +0 -71
- package/core/gather/gatherers/cache-contents.d.ts +0 -11
- package/core/gather/gatherers/cache-contents.js +0 -56
- package/core/gather/gatherers/devtools-log-compat.d.ts +0 -13
- package/core/gather/gatherers/devtools-log-compat.js +0 -35
- package/core/gather/gatherers/dobetterweb/domstats.d.ts +0 -10
- package/core/gather/gatherers/dobetterweb/domstats.js +0 -102
- package/core/gather/gatherers/dobetterweb/optimized-images.d.ts +0 -48
- package/core/gather/gatherers/dobetterweb/optimized-images.js +0 -169
- package/core/gather/gatherers/dobetterweb/response-compression.d.ts +0 -23
- package/core/gather/gatherers/dobetterweb/response-compression.js +0 -136
- package/core/gather/gatherers/seo/font-size.d.ts +0 -131
- package/core/gather/gatherers/seo/font-size.js +0 -347
- package/core/gather/gatherers/trace-compat.d.ts +0 -13
- package/core/gather/gatherers/trace-compat.js +0 -35
- package/types/internal/metaviewport-parser.d.ts +0 -13
- package/types/internal/parse-cache-control.d.ts +0 -20
|
@@ -14,44 +14,13 @@ const config = {
|
|
|
14
14
|
extends: 'lighthouse:default',
|
|
15
15
|
audits: [
|
|
16
16
|
'autocomplete',
|
|
17
|
-
// Preload advice is on hold until https://github.com/GoogleChrome/lighthouse/issues/11960
|
|
18
|
-
'preload-fonts',
|
|
19
|
-
'uses-rel-preload',
|
|
20
17
|
],
|
|
21
18
|
categories: {
|
|
22
|
-
// @ts-
|
|
23
|
-
// config is awkward - easier to omit the property here. Will defer to default config.
|
|
24
|
-
'performance': {
|
|
25
|
-
auditRefs: [
|
|
26
|
-
{id: 'uses-rel-preload', weight: 0, group: 'diagnostics'},
|
|
27
|
-
|
|
28
|
-
// TODO: Remove this when insights aren't hidden by default
|
|
29
|
-
// Insight audits.
|
|
30
|
-
{id: 'cache-insight', weight: 0, group: 'insights'},
|
|
31
|
-
{id: 'cls-culprits-insight', weight: 0, group: 'insights'},
|
|
32
|
-
{id: 'document-latency-insight', weight: 0, group: 'insights'},
|
|
33
|
-
{id: 'dom-size-insight', weight: 0, group: 'insights'},
|
|
34
|
-
{id: 'duplicated-javascript-insight', weight: 0, group: 'insights'},
|
|
35
|
-
{id: 'font-display-insight', weight: 0, group: 'insights'},
|
|
36
|
-
{id: 'forced-reflow-insight', weight: 0, group: 'insights'},
|
|
37
|
-
{id: 'image-delivery-insight', weight: 0, group: 'insights'},
|
|
38
|
-
{id: 'inp-breakdown-insight', weight: 0, group: 'insights'},
|
|
39
|
-
{id: 'lcp-breakdown-insight', weight: 0, group: 'insights'},
|
|
40
|
-
{id: 'lcp-discovery-insight', weight: 0, group: 'insights'},
|
|
41
|
-
{id: 'legacy-javascript-insight', weight: 0, group: 'insights'},
|
|
42
|
-
{id: 'modern-http-insight', weight: 0, group: 'insights'},
|
|
43
|
-
{id: 'network-dependency-tree-insight', weight: 0, group: 'insights'},
|
|
44
|
-
{id: 'render-blocking-insight', weight: 0, group: 'insights'},
|
|
45
|
-
{id: 'third-parties-insight', weight: 0, group: 'insights'},
|
|
46
|
-
{id: 'viewport-insight', weight: 0, group: 'insights'},
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
// @ts-ignore: `title` is required in CategoryJson. setting to the same value as the default
|
|
19
|
+
// @ts-expect-error: `title` is required in CategoryJson. setting to the same value as the default
|
|
50
20
|
// config is awkward - easier to omit the property here. Will defer to default config.
|
|
51
21
|
'best-practices': {
|
|
52
22
|
auditRefs: [
|
|
53
23
|
{id: 'autocomplete', weight: 0, group: 'best-practices-ux'},
|
|
54
|
-
{id: 'preload-fonts', weight: 0, group: 'best-practices-ux'},
|
|
55
24
|
],
|
|
56
25
|
},
|
|
57
26
|
},
|
package/core/config/filters.js
CHANGED
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import log from 'lighthouse-logger';
|
|
8
|
-
|
|
9
7
|
import {Audit} from '../audits/audit.js';
|
|
10
8
|
|
|
11
9
|
/** @type {Record<keyof LH.BaseArtifacts, string>} */
|
|
@@ -176,20 +174,19 @@ function filterCategoriesByExplicitFilters(categories, onlyCategories) {
|
|
|
176
174
|
}
|
|
177
175
|
|
|
178
176
|
/**
|
|
179
|
-
*
|
|
177
|
+
* Throw an error if any specified onlyCategory is not a known category that can
|
|
180
178
|
* be included.
|
|
181
179
|
*
|
|
182
180
|
* @param {LH.Config.ResolvedConfig['categories']} allCategories
|
|
183
181
|
* @param {string[] | null} onlyCategories
|
|
184
182
|
* @return {void}
|
|
185
183
|
*/
|
|
186
|
-
function
|
|
184
|
+
function errorOnUnknownOnlyCategories(allCategories, onlyCategories) {
|
|
187
185
|
if (!onlyCategories) return;
|
|
188
186
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
187
|
+
const unknown = onlyCategories.filter(c => !allCategories?.[c]);
|
|
188
|
+
if (unknown.length) {
|
|
189
|
+
throw new Error(`unrecognized category in 'onlyCategories': ${unknown.join(', ')}`);
|
|
193
190
|
}
|
|
194
191
|
}
|
|
195
192
|
|
|
@@ -271,7 +268,7 @@ function filterConfigByExplicitFilters(resolvedConfig, filters) {
|
|
|
271
268
|
throw new Error(`onlyCategories cannot be an empty array.`);
|
|
272
269
|
}
|
|
273
270
|
|
|
274
|
-
|
|
271
|
+
errorOnUnknownOnlyCategories(resolvedConfig.categories, onlyCategories);
|
|
275
272
|
|
|
276
273
|
let baseAuditIds = getAuditIdsInCategories(resolvedConfig.categories, undefined);
|
|
277
274
|
if (onlyCategories) {
|
|
@@ -18,7 +18,6 @@ const config = {
|
|
|
18
18
|
emulatedUserAgent: constants.userAgents.desktop,
|
|
19
19
|
skipAudits: [
|
|
20
20
|
// Skip the h2 audit so it doesn't lie to us. See https://github.com/GoogleChrome/lighthouse/issues/6539
|
|
21
|
-
'uses-http2',
|
|
22
21
|
'modern-http-insight',
|
|
23
22
|
// There are always bf-cache failures when testing in headless. Reenable when headless can give us realistic bf-cache insights.
|
|
24
23
|
'bf-cache',
|
|
@@ -17,7 +17,6 @@ const config = {
|
|
|
17
17
|
},
|
|
18
18
|
skipAudits: [
|
|
19
19
|
// Skip the h2 audit so it doesn't lie to us. See https://github.com/GoogleChrome/lighthouse/issues/6539
|
|
20
|
-
'uses-http2',
|
|
21
20
|
'modern-http-insight',
|
|
22
21
|
// There are always bf-cache failures when testing in headless. Reenable when headless can give us realistic bf-cache insights.
|
|
23
22
|
'bf-cache',
|
|
@@ -17,7 +17,7 @@ export class TargetManager extends TargetManager_base {
|
|
|
17
17
|
/** @param {LH.Puppeteer.CDPSession} cdpSession */
|
|
18
18
|
constructor(cdpSession: LH.Puppeteer.CDPSession);
|
|
19
19
|
_enabled: boolean;
|
|
20
|
-
_rootCdpSession: import("
|
|
20
|
+
_rootCdpSession: import("puppeteer-core").CDPSession;
|
|
21
21
|
_mainFrameId: string;
|
|
22
22
|
/**
|
|
23
23
|
* A map of target id to target/session information. Used to ensure unique
|
package/core/gather/driver.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export class Driver implements LH.Gatherer.Driver {
|
|
|
4
4
|
* @param {LH.Puppeteer.Page} page
|
|
5
5
|
*/
|
|
6
6
|
constructor(page: LH.Puppeteer.Page);
|
|
7
|
-
_page: import("
|
|
7
|
+
_page: import("puppeteer-core").Page;
|
|
8
8
|
/** @type {TargetManager|undefined} */
|
|
9
9
|
_targetManager: TargetManager | undefined;
|
|
10
10
|
/** @type {NetworkMonitor|undefined} */
|
|
@@ -157,33 +157,17 @@ class AnchorElements extends BaseGatherer {
|
|
|
157
157
|
|
|
158
158
|
// DOM.getDocument is necessary for pushNodesByBackendIdsToFrontend to properly retrieve nodeIds if the `DOM` domain was enabled before this gatherer, invoke it to be safe.
|
|
159
159
|
await session.sendCommand('DOM.getDocument', {depth: -1, pierce: true});
|
|
160
|
-
const anchorsWithEventListeners = anchors.map(async anchor => {
|
|
161
|
-
const listeners = await getEventListeners(session, anchor.node.devtoolsNodePath);
|
|
162
|
-
|
|
163
|
-
/** @type {Set<{type: string}>} */
|
|
164
|
-
const ancestorListeners = new Set();
|
|
165
|
-
const splitPath = anchor.node.devtoolsNodePath.split(',');
|
|
166
|
-
const ancestorListenerPromises = [];
|
|
167
|
-
while (splitPath.length >= 2) {
|
|
168
|
-
splitPath.length -= 2;
|
|
169
|
-
const path = splitPath.join(',');
|
|
170
|
-
const promise = getEventListeners(session, path).then(listeners => {
|
|
171
|
-
for (const listener of listeners) {
|
|
172
|
-
ancestorListeners.add(listener);
|
|
173
|
-
}
|
|
174
|
-
}).catch(() => {});
|
|
175
|
-
ancestorListenerPromises.push(promise);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
await Promise.all(ancestorListenerPromises);
|
|
179
160
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
161
|
+
const anchorsWithEventListeners = anchors.map( anchor => {
|
|
162
|
+
return getEventListeners(session, anchor.node.devtoolsNodePath).then(listeners => {
|
|
163
|
+
return {
|
|
164
|
+
...anchor,
|
|
165
|
+
listeners,
|
|
166
|
+
};
|
|
167
|
+
});
|
|
185
168
|
});
|
|
186
169
|
|
|
170
|
+
|
|
187
171
|
const result = await Promise.all(anchorsWithEventListeners);
|
|
188
172
|
await session.sendCommand('DOM.disable');
|
|
189
173
|
return result;
|
|
@@ -3,17 +3,16 @@
|
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
/**
|
|
7
|
-
* @fileoverview Gathers all images used on the page with their src, size,
|
|
8
|
-
* and attribute information. Executes script in the context of the page.
|
|
9
|
-
*/
|
|
10
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Gathers all images used on the page with their src, size,
|
|
9
|
+
* and attribute information. Executes script in the context of the page.
|
|
10
|
+
*/
|
|
11
11
|
|
|
12
12
|
import log from 'lighthouse-logger';
|
|
13
13
|
|
|
14
14
|
import BaseGatherer from '../base-gatherer.js';
|
|
15
15
|
import {pageFunctions} from '../../lib/page-functions.js';
|
|
16
|
-
import * as FontSize from './seo/font-size.js';
|
|
17
16
|
|
|
18
17
|
/* global getElementsInDocument, getNodeDetails */
|
|
19
18
|
|
|
@@ -186,6 +185,33 @@ function findSizeDeclaration(rule, property) {
|
|
|
186
185
|
return definedProp.value;
|
|
187
186
|
}
|
|
188
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Finds the most specific directly matched CSS font-size rule from the list.
|
|
190
|
+
*
|
|
191
|
+
* @param {Array<LH.Crdp.CSS.RuleMatch>} matchedCSSRules
|
|
192
|
+
* @param {function(LH.Crdp.CSS.CSSStyle):boolean|string|undefined} isDeclarationOfInterest
|
|
193
|
+
*/
|
|
194
|
+
function findMostSpecificMatchedCSSRule(matchedCSSRules = [], isDeclarationOfInterest) {
|
|
195
|
+
let mostSpecificRule;
|
|
196
|
+
for (let i = matchedCSSRules.length - 1; i >= 0; i--) {
|
|
197
|
+
if (isDeclarationOfInterest(matchedCSSRules[i].rule.style)) {
|
|
198
|
+
mostSpecificRule = matchedCSSRules[i].rule;
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (mostSpecificRule) {
|
|
204
|
+
return {
|
|
205
|
+
type: 'Regular',
|
|
206
|
+
...mostSpecificRule.style,
|
|
207
|
+
parentRule: {
|
|
208
|
+
origin: mostSpecificRule.origin,
|
|
209
|
+
selectors: mostSpecificRule.selectorList.selectors,
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
189
215
|
/**
|
|
190
216
|
* Finds the most specific directly matched CSS font-size rule from the list.
|
|
191
217
|
*
|
|
@@ -196,7 +222,7 @@ function findSizeDeclaration(rule, property) {
|
|
|
196
222
|
function findMostSpecificCSSRule(matchedCSSRules, property) {
|
|
197
223
|
/** @param {LH.Crdp.CSS.CSSStyle} declaration */
|
|
198
224
|
const isDeclarationofInterest = (declaration) => findSizeDeclaration(declaration, property);
|
|
199
|
-
const rule =
|
|
225
|
+
const rule = findMostSpecificMatchedCSSRule(matchedCSSRules, isDeclarationofInterest);
|
|
200
226
|
if (!rule) return;
|
|
201
227
|
|
|
202
228
|
return findSizeDeclaration(rule, property);
|
|
@@ -61,34 +61,7 @@ class InspectorIssues extends BaseGatherer {
|
|
|
61
61
|
const networkRecords = await NetworkRecords.request(devtoolsLog, context);
|
|
62
62
|
|
|
63
63
|
/** @type {LH.Artifacts.InspectorIssues} */
|
|
64
|
-
const artifact = {
|
|
65
|
-
// TODO(v13): remove empty arrays.
|
|
66
|
-
attributionReportingIssue: [],
|
|
67
|
-
blockedByResponseIssue: [],
|
|
68
|
-
bounceTrackingIssue: [],
|
|
69
|
-
clientHintIssue: [],
|
|
70
|
-
contentSecurityPolicyIssue: [],
|
|
71
|
-
cookieDeprecationMetadataIssue: [],
|
|
72
|
-
corsIssue: [],
|
|
73
|
-
deprecationIssue: [],
|
|
74
|
-
federatedAuthRequestIssue: [],
|
|
75
|
-
genericIssue: [],
|
|
76
|
-
heavyAdIssue: [],
|
|
77
|
-
lowTextContrastIssue: [],
|
|
78
|
-
mixedContentIssue: [],
|
|
79
|
-
navigatorUserAgentIssue: [],
|
|
80
|
-
partitioningBlobURLIssue: [],
|
|
81
|
-
propertyRuleIssue: [],
|
|
82
|
-
quirksModeIssue: [],
|
|
83
|
-
cookieIssue: [],
|
|
84
|
-
elementAccessibilityIssue: [],
|
|
85
|
-
sharedArrayBufferIssue: [],
|
|
86
|
-
sharedDictionaryIssue: [],
|
|
87
|
-
stylesheetLoadingIssue: [],
|
|
88
|
-
sriMessageSignatureIssue: [],
|
|
89
|
-
federatedAuthUserInfoRequestIssue: [],
|
|
90
|
-
userReidentificationIssue: [],
|
|
91
|
-
};
|
|
64
|
+
const artifact = {};
|
|
92
65
|
|
|
93
66
|
for (const issue of this._issues) {
|
|
94
67
|
const detailsKey = /** @type {keyof LH.Crdp.Audits.InspectorIssueDetails} */(
|
|
@@ -32,11 +32,11 @@ declare class TraceElements extends BaseGatherer {
|
|
|
32
32
|
* that may have caused the shift.
|
|
33
33
|
*
|
|
34
34
|
* @param {LH.Trace} trace
|
|
35
|
-
* @param {LH.Artifacts.TraceEngineResult
|
|
35
|
+
* @param {LH.Artifacts.TraceEngineResult} traceEngineResult
|
|
36
36
|
* @param {LH.Gatherer.Context} context
|
|
37
37
|
* @return {Promise<Array<{nodeId: number}>>}
|
|
38
38
|
*/
|
|
39
|
-
static getTopLayoutShifts(trace: LH.Trace, traceEngineResult: LH.Artifacts.TraceEngineResult
|
|
39
|
+
static getTopLayoutShifts(trace: LH.Trace, traceEngineResult: LH.Artifacts.TraceEngineResult, context: LH.Gatherer.Context): Promise<Array<{
|
|
40
40
|
nodeId: number;
|
|
41
41
|
}>>;
|
|
42
42
|
/**
|
|
@@ -45,15 +45,6 @@ declare class TraceElements extends BaseGatherer {
|
|
|
45
45
|
* @return {Promise<TraceElementData|undefined>}
|
|
46
46
|
*/
|
|
47
47
|
static getResponsivenessElement(trace: LH.Trace, context: LH.Gatherer.Context): Promise<TraceElementData | undefined>;
|
|
48
|
-
/**
|
|
49
|
-
* @param {LH.Trace} trace
|
|
50
|
-
* @param {LH.Gatherer.Context} context
|
|
51
|
-
* @return {Promise<{nodeId: number, type: string} | undefined>}
|
|
52
|
-
*/
|
|
53
|
-
static getLcpElement(trace: LH.Trace, context: LH.Gatherer.Context): Promise<{
|
|
54
|
-
nodeId: number;
|
|
55
|
-
type: string;
|
|
56
|
-
} | undefined>;
|
|
57
48
|
/** @type {LH.Gatherer.GathererMeta<'Trace'|'SourceMaps'>} */
|
|
58
49
|
meta: LH.Gatherer.GathererMeta<"Trace" | "SourceMaps">;
|
|
59
50
|
/** @type {Map<string, string>} */
|
|
@@ -18,8 +18,6 @@ import {pageFunctions} from '../../lib/page-functions.js';
|
|
|
18
18
|
import {Sentry} from '../../lib/sentry.js';
|
|
19
19
|
import Trace from './trace.js';
|
|
20
20
|
import {ProcessedTrace} from '../../computed/processed-trace.js';
|
|
21
|
-
import {ProcessedNavigation} from '../../computed/processed-navigation.js';
|
|
22
|
-
import {LighthouseError} from '../../lib/lh-error.js';
|
|
23
21
|
import {Responsiveness} from '../../computed/metrics/responsiveness.js';
|
|
24
22
|
import {CumulativeLayoutShift} from '../../computed/metrics/cumulative-layout-shift.js';
|
|
25
23
|
import {ExecutionContext} from '../driver/execution-context.js';
|
|
@@ -35,7 +33,12 @@ const MAX_LAYOUT_SHIFTS = 15;
|
|
|
35
33
|
*/
|
|
36
34
|
/* c8 ignore start */
|
|
37
35
|
function getNodeDetailsData() {
|
|
38
|
-
|
|
36
|
+
/** @type {Element|null} */
|
|
37
|
+
let elem = this.nodeType === document.ELEMENT_NODE ? this : this.parentElement;
|
|
38
|
+
if (!elem && this instanceof ShadowRoot) {
|
|
39
|
+
elem = this.host;
|
|
40
|
+
}
|
|
41
|
+
|
|
39
42
|
let traceElement;
|
|
40
43
|
if (elem) {
|
|
41
44
|
// @ts-expect-error - getNodeDetails put into scope via stringification
|
|
@@ -173,13 +176,13 @@ class TraceElements extends BaseGatherer {
|
|
|
173
176
|
* that may have caused the shift.
|
|
174
177
|
*
|
|
175
178
|
* @param {LH.Trace} trace
|
|
176
|
-
* @param {LH.Artifacts.TraceEngineResult
|
|
179
|
+
* @param {LH.Artifacts.TraceEngineResult} traceEngineResult
|
|
177
180
|
* @param {LH.Gatherer.Context} context
|
|
178
181
|
* @return {Promise<Array<{nodeId: number}>>}
|
|
179
182
|
*/
|
|
180
183
|
static async getTopLayoutShifts(trace, traceEngineResult, context) {
|
|
181
184
|
const {impactByNodeId} = await CumulativeLayoutShift.request(trace, context);
|
|
182
|
-
const clusters = traceEngineResult.LayoutShifts.clusters ?? [];
|
|
185
|
+
const clusters = traceEngineResult.data.LayoutShifts.clusters ?? [];
|
|
183
186
|
const layoutShiftEvents =
|
|
184
187
|
/** @type {import('../../lib/trace-engine.js').SaneSyntheticLayoutShift[]} */(
|
|
185
188
|
clusters.flatMap(c => c.events)
|
|
@@ -271,35 +274,6 @@ class TraceElements extends BaseGatherer {
|
|
|
271
274
|
return animatedElementData;
|
|
272
275
|
}
|
|
273
276
|
|
|
274
|
-
/**
|
|
275
|
-
* @param {LH.Trace} trace
|
|
276
|
-
* @param {LH.Gatherer.Context} context
|
|
277
|
-
* @return {Promise<{nodeId: number, type: string} | undefined>}
|
|
278
|
-
*/
|
|
279
|
-
static async getLcpElement(trace, context) {
|
|
280
|
-
let processedNavigation;
|
|
281
|
-
try {
|
|
282
|
-
processedNavigation = await ProcessedNavigation.request(trace, context);
|
|
283
|
-
} catch (err) {
|
|
284
|
-
// If we were running in timespan mode and there was no paint, treat LCP as missing.
|
|
285
|
-
if (context.gatherMode === 'timespan' && err.code === LighthouseError.errors.NO_FCP.code) {
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
throw err;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
// Use main-frame-only LCP to match the metric value.
|
|
293
|
-
const lcpData = processedNavigation.largestContentfulPaintEvt?.args?.data;
|
|
294
|
-
// These should exist, but trace types are loose.
|
|
295
|
-
if (lcpData?.nodeId === undefined || !lcpData.type) return;
|
|
296
|
-
|
|
297
|
-
return {
|
|
298
|
-
nodeId: lcpData.nodeId,
|
|
299
|
-
type: lcpData.type,
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
|
|
303
277
|
/**
|
|
304
278
|
* @param {LH.Gatherer.Context} context
|
|
305
279
|
*/
|
|
@@ -367,19 +341,15 @@ class TraceElements extends BaseGatherer {
|
|
|
367
341
|
|
|
368
342
|
const traceEngineData = await TraceElements.getTraceEngineElements(
|
|
369
343
|
traceEngineResult, navigationId);
|
|
370
|
-
const lcpNodeData = await TraceElements.getLcpElement(trace, context);
|
|
371
344
|
const shiftsData = await TraceElements.getTopLayoutShifts(
|
|
372
|
-
trace, traceEngineResult
|
|
345
|
+
trace, traceEngineResult, context);
|
|
373
346
|
const animatedElementData = await this.getAnimatedElements(mainThreadEvents);
|
|
374
|
-
const responsivenessElementData = await TraceElements.getResponsivenessElement(trace, context);
|
|
375
347
|
|
|
376
348
|
/** @type {Map<string, TraceElementData[]>} */
|
|
377
349
|
const backendNodeDataMap = new Map([
|
|
378
350
|
['trace-engine', traceEngineData],
|
|
379
|
-
['largest-contentful-paint', lcpNodeData ? [lcpNodeData] : []],
|
|
380
351
|
['layout-shift', shiftsData],
|
|
381
352
|
['animation', animatedElementData],
|
|
382
|
-
['responsiveness', responsivenessElementData ? [responsivenessElementData] : []],
|
|
383
353
|
]);
|
|
384
354
|
|
|
385
355
|
/** @type {Map<number, LH.Crdp.Runtime.CallFunctionOnResponse | null>} */
|
|
@@ -158,14 +158,11 @@ async function _computeNavigationResult(
|
|
|
158
158
|
|
|
159
159
|
/** @type {Partial<LH.GathererArtifacts>} */
|
|
160
160
|
const artifacts = {};
|
|
161
|
-
const pageLoadErrorId = 'pageLoadError-defaultPass';
|
|
162
161
|
if (debugData.devtoolsLog) {
|
|
163
162
|
artifacts.DevtoolsLogError = debugData.devtoolsLog;
|
|
164
|
-
artifacts.devtoolsLogs = {[pageLoadErrorId]: debugData.devtoolsLog};
|
|
165
163
|
}
|
|
166
164
|
if (debugData.trace) {
|
|
167
165
|
artifacts.TraceError = debugData.trace;
|
|
168
|
-
artifacts.traces = {[pageLoadErrorId]: debugData.trace};
|
|
169
166
|
}
|
|
170
167
|
|
|
171
168
|
navigationContext.baseArtifacts.LighthouseRunWarnings.push(pageLoadError.friendlyMessage);
|
package/core/gather/session.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export class ProtocolSession extends ProtocolSession_base implements LH.Gatherer
|
|
|
6
6
|
* @param {LH.Puppeteer.CDPSession} cdpSession
|
|
7
7
|
*/
|
|
8
8
|
constructor(cdpSession: LH.Puppeteer.CDPSession);
|
|
9
|
-
_cdpSession: import("
|
|
9
|
+
_cdpSession: import("puppeteer-core").CDPSession;
|
|
10
10
|
/** @type {LH.Crdp.Target.TargetInfo|undefined} */
|
|
11
11
|
_targetInfo: LH.Crdp.Target.TargetInfo | undefined;
|
|
12
12
|
/** @type {number|undefined} */
|
|
@@ -20,8 +20,8 @@ export function saveArtifacts(artifacts: LH.Artifacts, basePath: string, options
|
|
|
20
20
|
* step0/ -- Directory containing artifacts for the first step.
|
|
21
21
|
* options.json -- First step's options (e.g. step flags).
|
|
22
22
|
* artifacts.json -- First step's artifacts except the DevTools log and trace.
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* devtoolslog.json -- First step's DevTools log.
|
|
24
|
+
* trace.json -- First step's trace.
|
|
25
25
|
* step1/ -- Directory containing artifacts for the second step.
|
|
26
26
|
*
|
|
27
27
|
* @param {LH.UserFlow.FlowArtifacts} flowArtifacts
|
package/core/lib/asset-saver.js
CHANGED
|
@@ -22,10 +22,9 @@ import {LH_ROOT} from '../../shared/root.js';
|
|
|
22
22
|
|
|
23
23
|
const optionsFilename = 'options.json';
|
|
24
24
|
const artifactsFilename = 'artifacts.json';
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const errorPrefix = 'pageLoadError-defaultPass';
|
|
25
|
+
const traceFilename = 'trace.json';
|
|
26
|
+
const devtoolsFilename = 'devtoolslog.json';
|
|
27
|
+
const errorPrefix = 'pageLoadError.';
|
|
29
28
|
const stepDirectoryRegex = /^step(\d+)$/;
|
|
30
29
|
|
|
31
30
|
/**
|
|
@@ -94,29 +93,26 @@ function loadArtifacts(basePath) {
|
|
|
94
93
|
|
|
95
94
|
const filenames = fs.readdirSync(basePath);
|
|
96
95
|
|
|
97
|
-
filenames.filter(f => endsWithSuffix(f,
|
|
98
|
-
if (!artifacts.devtoolsLogs) artifacts.devtoolsLogs = {};
|
|
99
|
-
const prefix = filename.replace(devtoolsLogSuffix + '.gz', '').replace(devtoolsLogSuffix, '');
|
|
96
|
+
filenames.filter(f => endsWithSuffix(f, devtoolsFilename)).forEach(filename => {
|
|
100
97
|
const devtoolsLog = readJson(path.join(basePath, filename));
|
|
101
|
-
|
|
102
|
-
if (
|
|
98
|
+
|
|
99
|
+
if (filename.startsWith(devtoolsFilename)) {
|
|
103
100
|
artifacts.DevtoolsLog = devtoolsLog;
|
|
104
|
-
}
|
|
105
|
-
if (prefix === errorPrefix) {
|
|
101
|
+
} else if (filename.startsWith(errorPrefix)) {
|
|
106
102
|
artifacts.DevtoolsLogError = devtoolsLog;
|
|
107
103
|
}
|
|
108
104
|
});
|
|
109
105
|
|
|
110
|
-
filenames.filter(f => endsWithSuffix(f,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
artifacts.traces[prefix] = Array.isArray(trace) ? {traceEvents: trace} : trace;
|
|
115
|
-
if (prefix === defaultPrefix) {
|
|
116
|
-
artifacts.Trace = artifacts.traces[prefix];
|
|
106
|
+
filenames.filter(f => endsWithSuffix(f, traceFilename)).forEach(filename => {
|
|
107
|
+
let trace = readJson(path.join(basePath, filename));
|
|
108
|
+
if (Array.isArray(trace)) {
|
|
109
|
+
trace = {traceEvents: trace};
|
|
117
110
|
}
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
|
|
112
|
+
if (filename.startsWith(traceFilename)) {
|
|
113
|
+
artifacts.Trace = trace;
|
|
114
|
+
} else if (filename.startsWith(errorPrefix)) {
|
|
115
|
+
artifacts.TraceError = trace;
|
|
120
116
|
}
|
|
121
117
|
});
|
|
122
118
|
|
|
@@ -196,8 +192,8 @@ function stringifyReplacer(key, value) {
|
|
|
196
192
|
* step0/ -- Directory containing artifacts for the first step.
|
|
197
193
|
* options.json -- First step's options (e.g. step flags).
|
|
198
194
|
* artifacts.json -- First step's artifacts except the DevTools log and trace.
|
|
199
|
-
*
|
|
200
|
-
*
|
|
195
|
+
* devtoolslog.json -- First step's DevTools log.
|
|
196
|
+
* trace.json -- First step's trace.
|
|
201
197
|
* step1/ -- Directory containing artifacts for the second step.
|
|
202
198
|
*
|
|
203
199
|
* @param {LH.UserFlow.FlowArtifacts} flowArtifacts
|
|
@@ -254,21 +250,15 @@ async function saveArtifacts(artifacts, basePath, options = {}) {
|
|
|
254
250
|
const filenames = fs.readdirSync(basePath);
|
|
255
251
|
for (const filename of filenames) {
|
|
256
252
|
const isPreviousFile =
|
|
257
|
-
filename.endsWith(
|
|
258
|
-
filename.endsWith(
|
|
253
|
+
filename.endsWith(traceFilename) || filename.endsWith(devtoolsFilename) ||
|
|
254
|
+
filename.endsWith(traceFilename + '.gz') || filename.endsWith(devtoolsFilename + '.gz') ||
|
|
259
255
|
filename === artifactsFilename || filename === artifactsFilename + '.gz';
|
|
260
256
|
if (isPreviousFile) {
|
|
261
257
|
fs.unlinkSync(`${basePath}/${filename}`);
|
|
262
258
|
}
|
|
263
259
|
}
|
|
264
260
|
|
|
265
|
-
// `devtoolsLogs` and `traces` are duplicate compat artifacts.
|
|
266
|
-
// We don't need to save them twice, so extract them here. TODO(v13): remove
|
|
267
261
|
const {
|
|
268
|
-
// eslint-disable-next-line no-unused-vars
|
|
269
|
-
traces,
|
|
270
|
-
// eslint-disable-next-line no-unused-vars
|
|
271
|
-
devtoolsLogs,
|
|
272
262
|
DevtoolsLog,
|
|
273
263
|
Trace,
|
|
274
264
|
DevtoolsLogError,
|
|
@@ -277,21 +267,21 @@ async function saveArtifacts(artifacts, basePath, options = {}) {
|
|
|
277
267
|
} = artifacts;
|
|
278
268
|
|
|
279
269
|
if (Trace) {
|
|
280
|
-
await saveTrace(Trace, `${basePath}/${
|
|
270
|
+
await saveTrace(Trace, `${basePath}/${traceFilename}`, options);
|
|
281
271
|
}
|
|
282
272
|
|
|
283
273
|
if (TraceError) {
|
|
284
|
-
await saveTrace(TraceError, `${basePath}/${errorPrefix}${
|
|
274
|
+
await saveTrace(TraceError, `${basePath}/${errorPrefix}${traceFilename}`, options);
|
|
285
275
|
}
|
|
286
276
|
|
|
287
277
|
if (DevtoolsLog) {
|
|
288
278
|
await saveDevtoolsLog(
|
|
289
|
-
DevtoolsLog, `${basePath}/${
|
|
279
|
+
DevtoolsLog, `${basePath}/${devtoolsFilename}`, options);
|
|
290
280
|
}
|
|
291
281
|
|
|
292
282
|
if (DevtoolsLogError) {
|
|
293
283
|
await saveDevtoolsLog(
|
|
294
|
-
DevtoolsLogError, `${basePath}/${errorPrefix}${
|
|
284
|
+
DevtoolsLogError, `${basePath}/${errorPrefix}${devtoolsFilename}`, options);
|
|
295
285
|
}
|
|
296
286
|
|
|
297
287
|
// save everything else, using a replacer to serialize LighthouseErrors in the artifacts.
|
|
@@ -452,9 +442,9 @@ async function saveLanternDebugTraces(pathWithBasename) {
|
|
|
452
442
|
for (const [label, nodeTimings] of Lantern.Simulation.Simulator.allNodeTimings) {
|
|
453
443
|
if (lanternTraceSaver.simulationNamesToIgnore.includes(label)) continue;
|
|
454
444
|
|
|
455
|
-
const
|
|
456
|
-
await saveTrace(lanternTraceSaver.convertNodeTimingsToTrace(nodeTimings),
|
|
457
|
-
log.log('saveAssets', `${label} lantern trace file streamed to disk: ${
|
|
445
|
+
const filename = `${pathWithBasename}-${label}.${traceFilename}`;
|
|
446
|
+
await saveTrace(lanternTraceSaver.convertNodeTimingsToTrace(nodeTimings), filename);
|
|
447
|
+
log.log('saveAssets', `${label} lantern trace file streamed to disk: ${filename}`);
|
|
458
448
|
}
|
|
459
449
|
}
|
|
460
450
|
|
|
@@ -469,15 +459,15 @@ async function saveAssets(artifacts, audits, pathWithBasename) {
|
|
|
469
459
|
const allAssets = await prepareAssets(artifacts, audits);
|
|
470
460
|
const saveAll = allAssets.map(async (assets, index) => {
|
|
471
461
|
if (assets.devtoolsLog) {
|
|
472
|
-
const
|
|
473
|
-
await saveDevtoolsLog(assets.devtoolsLog,
|
|
474
|
-
log.log('saveAssets', 'devtools log saved to disk: ' +
|
|
462
|
+
const filename = `${pathWithBasename}-${index}.${devtoolsFilename}`;
|
|
463
|
+
await saveDevtoolsLog(assets.devtoolsLog, filename);
|
|
464
|
+
log.log('saveAssets', 'devtools log saved to disk: ' + filename);
|
|
475
465
|
}
|
|
476
466
|
|
|
477
467
|
if (assets.traceData) {
|
|
478
|
-
const
|
|
479
|
-
await saveTrace(assets.traceData,
|
|
480
|
-
log.log('saveAssets', 'trace file streamed to disk: ' +
|
|
468
|
+
const filename = `${pathWithBasename}-${index}.${traceFilename}`;
|
|
469
|
+
await saveTrace(assets.traceData, filename);
|
|
470
|
+
log.log('saveAssets', 'trace file streamed to disk: ' + filename);
|
|
481
471
|
}
|
|
482
472
|
});
|
|
483
473
|
|
|
@@ -534,17 +534,17 @@ const UIStrings = {
|
|
|
534
534
|
cookieDisabled:
|
|
535
535
|
'Back/forward cache is disabled because cookies are disabled on a page that uses `Cache-Control: no-store`.',
|
|
536
536
|
/**
|
|
537
|
-
* @description Description text for not restored reason
|
|
537
|
+
* @description Description text for not restored reason WebRTCUsedWithCCNS.
|
|
538
538
|
*/
|
|
539
|
-
|
|
539
|
+
webRTCUsedWithCCNS: 'Back/forward cache is disabled because WebRTC has been used.',
|
|
540
540
|
/**
|
|
541
|
-
* @description Description text for not restored reason
|
|
541
|
+
* @description Description text for not restored reason WebTransportUsedWithCCNS.
|
|
542
542
|
*/
|
|
543
|
-
|
|
543
|
+
webTransportUsedWithCCNS: 'Back/forward cache is disabled because WebTransport has been used.',
|
|
544
544
|
/**
|
|
545
|
-
* @description Description text for not restored reason
|
|
545
|
+
* @description Description text for not restored reason WebSocketUsedWithCCNS.
|
|
546
546
|
*/
|
|
547
|
-
|
|
547
|
+
webSocketUsedWithCCNS: 'Back/forward cache is disabled because WebSocket has been used.',
|
|
548
548
|
|
|
549
549
|
};
|
|
550
550
|
|
|
@@ -567,6 +567,7 @@ const NotRestoredReasonDescription = {
|
|
|
567
567
|
JavaScriptExecution: {name: str_(UIStrings.JavaScriptExecution)},
|
|
568
568
|
RendererProcessKilled: {name: str_(UIStrings.rendererProcessKilled)},
|
|
569
569
|
RendererProcessCrashed: {name: str_(UIStrings.rendererProcessCrashed)},
|
|
570
|
+
// kept for backwards compatibly
|
|
570
571
|
GrantedMediaStreamAccess: {name: str_(UIStrings.grantedMediaStreamAccess)},
|
|
571
572
|
CacheFlushed: {name: str_(UIStrings.cacheFlushed)},
|
|
572
573
|
ServiceWorkerVersionActivation: {name: str_(UIStrings.serviceWorkerVersionActivation)},
|
|
@@ -691,9 +692,9 @@ const NotRestoredReasonDescription = {
|
|
|
691
692
|
{name: str_(UIStrings.jsNetworkRequestReceivedCacheControlNoStoreResource)},
|
|
692
693
|
IndexedDBEvent: {name: str_(UIStrings.indexedDBEvent)},
|
|
693
694
|
CookieDisabled: {name: str_(UIStrings.cookieDisabled)},
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
695
|
+
WebRTCUsedWithCCNS: {name: str_(UIStrings.webRTCUsedWithCCNS)},
|
|
696
|
+
WebTransportUsedWithCCNS: {name: str_(UIStrings.webTransportUsedWithCCNS)},
|
|
697
|
+
WebSocketUsedWithCCNS: {name: str_(UIStrings.webSocketUsedWithCCNS)},
|
|
697
698
|
HTTPAuthRequired: {name: ('HTTPAuthRequired')},
|
|
698
699
|
CookieFlushed: {name: ('CookieFlushed')},
|
|
699
700
|
SmartCard: {name: ('SmartCard')},
|