lighthouse 11.0.0-dev.20230905 → 11.0.0-dev.20230906
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/test/smokehouse/core-tests.js +3 -1
- package/core/audits/accessibility/accesskeys.js +1 -1
- package/core/audits/accessibility/aria-allowed-attr.js +1 -1
- package/core/audits/accessibility/aria-allowed-role.js +1 -1
- package/core/audits/accessibility/aria-command-name.js +1 -1
- package/core/audits/accessibility/aria-dialog-name.js +1 -1
- package/core/audits/accessibility/aria-hidden-body.js +1 -1
- package/core/audits/accessibility/aria-hidden-focus.js +1 -1
- package/core/audits/accessibility/aria-input-field-name.js +1 -1
- 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-required-attr.js +1 -1
- package/core/audits/accessibility/aria-required-children.js +1 -1
- package/core/audits/accessibility/aria-required-parent.js +1 -1
- package/core/audits/accessibility/aria-roles.js +1 -1
- package/core/audits/accessibility/aria-text.js +1 -1
- package/core/audits/accessibility/aria-toggle-field-name.js +1 -1
- 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 +1 -1
- package/core/audits/accessibility/aria-valid-attr.js +1 -1
- package/core/audits/accessibility/button-name.js +1 -1
- package/core/audits/accessibility/bypass.js +1 -1
- package/core/audits/accessibility/color-contrast.js +1 -1
- package/core/audits/accessibility/definition-list.js +1 -1
- package/core/audits/accessibility/dlitem.js +1 -1
- package/core/audits/accessibility/document-title.js +1 -1
- package/core/audits/accessibility/duplicate-id-active.js +1 -1
- package/core/audits/accessibility/duplicate-id-aria.js +2 -1
- package/core/audits/accessibility/empty-heading.js +1 -1
- package/core/audits/accessibility/form-field-multiple-labels.js +1 -1
- package/core/audits/accessibility/frame-title.js +1 -1
- package/core/audits/accessibility/heading-order.js +1 -1
- package/core/audits/accessibility/html-has-lang.js +1 -1
- package/core/audits/accessibility/html-lang-valid.js +1 -1
- package/core/audits/accessibility/html-xml-lang-mismatch.js +1 -1
- package/core/audits/accessibility/identical-links-same-purpose.js +1 -1
- package/core/audits/accessibility/image-alt.js +1 -1
- package/core/audits/accessibility/image-redundant-alt.js +1 -1
- package/core/audits/accessibility/input-button-name.js +1 -1
- package/core/audits/accessibility/input-image-alt.js +1 -1
- package/core/audits/accessibility/label-content-name-mismatch.js +1 -1
- package/core/audits/accessibility/label.js +1 -1
- package/core/audits/accessibility/landmark-one-main.js +1 -1
- package/core/audits/accessibility/link-in-text-block.js +1 -1
- package/core/audits/accessibility/link-name.js +1 -1
- package/core/audits/accessibility/list.js +1 -1
- package/core/audits/accessibility/listitem.js +1 -1
- package/core/audits/accessibility/meta-refresh.js +1 -1
- package/core/audits/accessibility/meta-viewport.js +1 -1
- package/core/audits/accessibility/object-alt.js +1 -1
- package/core/audits/accessibility/select-name.js +1 -1
- package/core/audits/accessibility/skip-link.js +1 -1
- package/core/audits/accessibility/tabindex.js +1 -1
- package/core/audits/accessibility/table-duplicate-name.js +1 -1
- package/core/audits/accessibility/table-fake-caption.js +1 -1
- package/core/audits/accessibility/target-size.js +1 -1
- package/core/audits/accessibility/td-has-header.js +1 -1
- package/core/audits/accessibility/td-headers-attr.js +1 -1
- package/core/audits/accessibility/th-has-data-cells.js +1 -1
- package/core/audits/accessibility/valid-lang.js +1 -1
- package/core/audits/accessibility/video-caption.js +1 -1
- package/core/audits/bootup-time.d.ts +6 -0
- package/core/audits/bootup-time.js +36 -1
- package/core/audits/image-aspect-ratio.js +10 -1
- package/core/computed/main-resource.d.ts +1 -1
- package/core/computed/main-resource.js +10 -4
- package/core/computed/page-dependency-graph.js +2 -1
- package/core/gather/gatherers/accessibility.js +5 -0
- package/core/lib/dependency-graph/simulator/network-analyzer.d.ts +7 -1
- package/core/lib/dependency-graph/simulator/network-analyzer.js +17 -1
- package/package.json +5 -5
- package/shared/localization/locales/en-US.json +61 -61
- package/shared/localization/locales/en-XL.json +61 -61
- package/types/artifacts.d.ts +1 -1
|
@@ -19,7 +19,7 @@ const UIStrings = {
|
|
|
19
19
|
failureTitle: 'Skip links are not focusable.',
|
|
20
20
|
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. The last sentence starting with 'Learn' becomes link text to additional documentation. */
|
|
21
21
|
description: 'Including a skip link can help users skip to the main content to save time. ' +
|
|
22
|
-
'[Learn more about skip links](https://dequeuniversity.com/rules/axe/4.
|
|
22
|
+
'[Learn more about skip links](https://dequeuniversity.com/rules/axe/4.8/skip-link).',
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
@@ -20,7 +20,7 @@ const UIStrings = {
|
|
|
20
20
|
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. The last sentence starting with 'Learn' becomes link text to additional documentation. */
|
|
21
21
|
description: 'A value greater than 0 implies an explicit navigation ordering. ' +
|
|
22
22
|
'Although technically valid, this often creates frustrating experiences ' +
|
|
23
|
-
'for users who rely on assistive technologies. [Learn more about the `tabindex` attribute](https://dequeuniversity.com/rules/axe/4.
|
|
23
|
+
'for users who rely on assistive technologies. [Learn more about the `tabindex` attribute](https://dequeuniversity.com/rules/axe/4.8/tabindex).',
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
@@ -20,7 +20,7 @@ const UIStrings = {
|
|
|
20
20
|
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. The last sentence starting with 'Learn' becomes link text to additional documentation. */
|
|
21
21
|
description: 'The summary attribute should describe the table structure, while `<caption>` ' +
|
|
22
22
|
'should have the onscreen title. Accurate table mark-up helps users of screen readers. ' +
|
|
23
|
-
'[Learn more about summary and caption](https://dequeuniversity.com/rules/axe/4.
|
|
23
|
+
'[Learn more about summary and caption](https://dequeuniversity.com/rules/axe/4.8/table-duplicate-name).',
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
@@ -23,7 +23,7 @@ const UIStrings = {
|
|
|
23
23
|
description: 'Screen readers have features to make navigating tables easier. Ensuring ' +
|
|
24
24
|
'that tables use the actual caption element instead of cells with the `[colspan]` ' +
|
|
25
25
|
'attribute may improve the experience for screen reader users. ' +
|
|
26
|
-
'[Learn more about captions](https://dequeuniversity.com/rules/axe/4.
|
|
26
|
+
'[Learn more about captions](https://dequeuniversity.com/rules/axe/4.8/table-fake-caption).',
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
@@ -20,7 +20,7 @@ const UIStrings = {
|
|
|
20
20
|
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. The last sentence starting with 'Learn' becomes link text to additional documentation. */
|
|
21
21
|
description: 'Touch targets with sufficient size and spacing help users who may have ' +
|
|
22
22
|
'difficulty targeting small controls to activate the targets. ' +
|
|
23
|
-
'[Learn more about touch targets](https://dequeuniversity.com/rules/axe/4.
|
|
23
|
+
'[Learn more about touch targets](https://dequeuniversity.com/rules/axe/4.8/target-size).',
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
@@ -21,7 +21,7 @@ const UIStrings = {
|
|
|
21
21
|
description: 'Screen readers have features to make navigating tables easier. Ensuring ' +
|
|
22
22
|
'that `<td>` elements in a large table (3 or more cells in width and height) have an ' +
|
|
23
23
|
'associated table header may improve the experience for screen reader users. ' +
|
|
24
|
-
'[Learn more about table headers](https://dequeuniversity.com/rules/axe/4.
|
|
24
|
+
'[Learn more about table headers](https://dequeuniversity.com/rules/axe/4.8/td-has-header).',
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
@@ -24,7 +24,7 @@ const UIStrings = {
|
|
|
24
24
|
description: 'Screen readers have features to make navigating tables easier. Ensuring ' +
|
|
25
25
|
'`<td>` cells using the `[headers]` attribute only refer to other cells in the same ' +
|
|
26
26
|
'table may improve the experience for screen reader users. ' +
|
|
27
|
-
'[Learn more about the `headers` attribute](https://dequeuniversity.com/rules/axe/4.
|
|
27
|
+
'[Learn more about the `headers` attribute](https://dequeuniversity.com/rules/axe/4.8/td-headers-attr).',
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
@@ -23,7 +23,7 @@ const UIStrings = {
|
|
|
23
23
|
description: 'Screen readers have features to make navigating tables easier. Ensuring ' +
|
|
24
24
|
'table headers always refer to some set of cells may improve the experience for screen ' +
|
|
25
25
|
'reader users. ' +
|
|
26
|
-
'[Learn more about table headers](https://dequeuniversity.com/rules/axe/4.
|
|
26
|
+
'[Learn more about table headers](https://dequeuniversity.com/rules/axe/4.8/th-has-data-cells).',
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
@@ -20,7 +20,7 @@ const UIStrings = {
|
|
|
20
20
|
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. The last sentence starting with 'Learn' becomes link text to additional documentation. */
|
|
21
21
|
description: 'Specifying a valid [BCP 47 language](https://www.w3.org/International/questions/qa-choosing-language-tags#question) ' +
|
|
22
22
|
'on elements helps ensure that text is pronounced correctly by a screen reader. ' +
|
|
23
|
-
'[Learn how to use the `lang` attribute](https://dequeuniversity.com/rules/axe/4.
|
|
23
|
+
'[Learn how to use the `lang` attribute](https://dequeuniversity.com/rules/axe/4.8/valid-lang).',
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
@@ -21,7 +21,7 @@ const UIStrings = {
|
|
|
21
21
|
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. The last sentence starting with 'Learn' becomes link text to additional documentation. */
|
|
22
22
|
description: 'When a video provides a caption it is easier for deaf and hearing impaired ' +
|
|
23
23
|
'users to access its information. ' +
|
|
24
|
-
'[Learn more about video captions](https://dequeuniversity.com/rules/axe/4.
|
|
24
|
+
'[Learn more about video captions](https://dequeuniversity.com/rules/axe/4.8/video-caption).',
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
@@ -6,6 +6,12 @@ declare class BootupTime extends Audit {
|
|
|
6
6
|
static get defaultOptions(): import("../../types/audit.js").default.ScoreOptions & {
|
|
7
7
|
thresholdInMs: number;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* @param {LH.Artifacts} artifacts
|
|
11
|
+
* @param {LH.Audit.Context} context
|
|
12
|
+
* @return {Promise<number>}
|
|
13
|
+
*/
|
|
14
|
+
static getTbtImpact(artifacts: LH.Artifacts, context: LH.Audit.Context): Promise<number>;
|
|
9
15
|
/**
|
|
10
16
|
* @param {LH.Artifacts} artifacts
|
|
11
17
|
* @param {LH.Audit.Context} context
|
|
@@ -4,12 +4,16 @@
|
|
|
4
4
|
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import log from 'lighthouse-logger';
|
|
8
|
+
|
|
7
9
|
import {Audit} from './audit.js';
|
|
8
10
|
import {taskGroups} from '../lib/tracehouse/task-groups.js';
|
|
9
11
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
10
12
|
import {NetworkRecords} from '../computed/network-records.js';
|
|
11
13
|
import {MainThreadTasks} from '../computed/main-thread-tasks.js';
|
|
12
14
|
import {getExecutionTimingsByURL} from '../lib/tracehouse/task-summary.js';
|
|
15
|
+
import {TBTImpactTasks} from '../computed/tbt-impact-tasks.js';
|
|
16
|
+
import {Sentry} from '../lib/sentry.js';
|
|
13
17
|
|
|
14
18
|
const UIStrings = {
|
|
15
19
|
/** Title of a diagnostic audit that provides detail on the time spent executing javascript files during the load. This descriptive title is shown to users when the amount is acceptable and no user action is required. */
|
|
@@ -45,7 +49,7 @@ class BootupTime extends Audit {
|
|
|
45
49
|
description: str_(UIStrings.description),
|
|
46
50
|
scoreDisplayMode: Audit.SCORING_MODES.NUMERIC,
|
|
47
51
|
guidanceLevel: 1,
|
|
48
|
-
requiredArtifacts: ['traces', 'devtoolsLogs'],
|
|
52
|
+
requiredArtifacts: ['traces', 'devtoolsLogs', 'URL', 'GatherContext'],
|
|
49
53
|
};
|
|
50
54
|
}
|
|
51
55
|
|
|
@@ -62,6 +66,33 @@ class BootupTime extends Audit {
|
|
|
62
66
|
};
|
|
63
67
|
}
|
|
64
68
|
|
|
69
|
+
/**
|
|
70
|
+
* @param {LH.Artifacts} artifacts
|
|
71
|
+
* @param {LH.Audit.Context} context
|
|
72
|
+
* @return {Promise<number>}
|
|
73
|
+
*/
|
|
74
|
+
static async getTbtImpact(artifacts, context) {
|
|
75
|
+
let tbtImpact = 0;
|
|
76
|
+
|
|
77
|
+
try {
|
|
78
|
+
const metricComputationData = Audit.makeMetricComputationDataInput(artifacts, context);
|
|
79
|
+
const tasks = await TBTImpactTasks.request(metricComputationData, context);
|
|
80
|
+
for (const task of tasks) {
|
|
81
|
+
const groupId = task.group.id;
|
|
82
|
+
if (groupId !== 'scriptEvaluation' && groupId !== 'scriptParseCompile') continue;
|
|
83
|
+
tbtImpact += task.selfTbtImpact;
|
|
84
|
+
}
|
|
85
|
+
} catch (err) {
|
|
86
|
+
Sentry.captureException(err, {
|
|
87
|
+
tags: {audit: this.meta.id},
|
|
88
|
+
level: 'error',
|
|
89
|
+
});
|
|
90
|
+
log.error(this.meta.id, err.message);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return tbtImpact;
|
|
94
|
+
}
|
|
95
|
+
|
|
65
96
|
/**
|
|
66
97
|
* @param {LH.Artifacts} artifacts
|
|
67
98
|
* @param {LH.Audit.Context} context
|
|
@@ -77,6 +108,7 @@ class BootupTime extends Audit {
|
|
|
77
108
|
settings.throttling.cpuSlowdownMultiplier : 1;
|
|
78
109
|
|
|
79
110
|
const executionTimings = getExecutionTimingsByURL(tasks, networkRecords);
|
|
111
|
+
const tbtImpact = await this.getTbtImpact(artifacts, context);
|
|
80
112
|
|
|
81
113
|
let hadExcessiveChromeExtension = false;
|
|
82
114
|
let totalBootupTime = 0;
|
|
@@ -143,6 +175,9 @@ class BootupTime extends Audit {
|
|
|
143
175
|
str_(i18n.UIStrings.seconds, {timeInMs: totalBootupTime}) : '',
|
|
144
176
|
details,
|
|
145
177
|
runWarnings,
|
|
178
|
+
metricSavings: {
|
|
179
|
+
TBT: tbtImpact,
|
|
180
|
+
},
|
|
146
181
|
};
|
|
147
182
|
}
|
|
148
183
|
}
|
|
@@ -59,7 +59,16 @@ class ImageAspectRatio extends Audit {
|
|
|
59
59
|
const displayedAspectRatio = image.displayedWidth / image.displayedHeight;
|
|
60
60
|
|
|
61
61
|
const targetDisplayHeight = image.displayedWidth / actualAspectRatio;
|
|
62
|
-
const
|
|
62
|
+
const targetDisplayWidth = image.displayedHeight * actualAspectRatio;
|
|
63
|
+
|
|
64
|
+
// Small rounding errors in aspect ratio can lead to large differences in target width/height
|
|
65
|
+
// if the aspect ratio is close to 0.
|
|
66
|
+
//
|
|
67
|
+
// In these cases, we should compare the smaller dimension because any rounding errors will
|
|
68
|
+
// affect that dimension less.
|
|
69
|
+
const doRatiosMatch = targetDisplayHeight < targetDisplayWidth
|
|
70
|
+
? Math.abs(targetDisplayHeight - image.displayedHeight) < THRESHOLD_PX
|
|
71
|
+
: Math.abs(targetDisplayWidth - image.displayedWidth) < THRESHOLD_PX;
|
|
63
72
|
|
|
64
73
|
return {
|
|
65
74
|
url,
|
|
@@ -9,7 +9,7 @@ declare const MainResourceComputed: typeof MainResource & {
|
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* @fileoverview This artifact identifies the main resource on the page. Current solution assumes
|
|
12
|
-
* that the main resource is the first non-
|
|
12
|
+
* that the main resource is the first non-redirected one.
|
|
13
13
|
*/
|
|
14
14
|
declare class MainResource {
|
|
15
15
|
/**
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {makeComputedArtifact} from './computed-artifact.js';
|
|
8
|
-
import {NetworkAnalyzer} from '../lib/dependency-graph/simulator/network-analyzer.js';
|
|
9
8
|
import {NetworkRecords} from './network-records.js';
|
|
9
|
+
import {NetworkAnalyzer} from '../lib/dependency-graph/simulator/network-analyzer.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @fileoverview This artifact identifies the main resource on the page. Current solution assumes
|
|
13
|
-
* that the main resource is the first non-
|
|
13
|
+
* that the main resource is the first non-redirected one.
|
|
14
14
|
*/
|
|
15
15
|
class MainResource {
|
|
16
16
|
/**
|
|
@@ -21,8 +21,14 @@ class MainResource {
|
|
|
21
21
|
static async compute_(data, context) {
|
|
22
22
|
const {mainDocumentUrl} = data.URL;
|
|
23
23
|
if (!mainDocumentUrl) throw new Error('mainDocumentUrl must exist to get the main resource');
|
|
24
|
-
const
|
|
25
|
-
|
|
24
|
+
const records = await NetworkRecords.request(data.devtoolsLog, context);
|
|
25
|
+
|
|
26
|
+
// We could have more than one record matching the main doucment url,
|
|
27
|
+
// if the page did `location.reload()`. Since `mainDocumentUrl` refers to the _last_
|
|
28
|
+
// document request, we should return the last candidate here. Besides, the browser
|
|
29
|
+
// would have evicted the first request by the time `MainDocumentRequest` (a consumer
|
|
30
|
+
// of this computed artifact) attempts to fetch the contents, resulting in a protocol error.
|
|
31
|
+
const mainResource = NetworkAnalyzer.findLastDocumentForUrl(records, mainDocumentUrl);
|
|
26
32
|
if (!mainResource) {
|
|
27
33
|
throw new Error('Unable to identify the main resource');
|
|
28
34
|
}
|
|
@@ -412,7 +412,8 @@ class PageDependencyGraph {
|
|
|
412
412
|
const rootNode = networkNodeOutput.idToNodeMap.get(rootRequest.requestId);
|
|
413
413
|
if (!rootNode) throw new Error('rootNode not found');
|
|
414
414
|
|
|
415
|
-
const mainDocumentRequest =
|
|
415
|
+
const mainDocumentRequest =
|
|
416
|
+
NetworkAnalyzer.findLastDocumentForUrl(networkRecords, mainDocumentUrl);
|
|
416
417
|
if (!mainDocumentRequest) throw new Error('mainDocumentRequest not found');
|
|
417
418
|
const mainDocumentNode = networkNodeOutput.idToNodeMap.get(mainDocumentRequest.requestId);
|
|
418
419
|
if (!mainDocumentNode) throw new Error('mainDocumentNode not found');
|
|
@@ -42,12 +42,17 @@ async function runA11yChecks() {
|
|
|
42
42
|
'accesskeys': {enabled: true},
|
|
43
43
|
'area-alt': {enabled: false},
|
|
44
44
|
'aria-allowed-role': {enabled: true},
|
|
45
|
+
'aria-braille-equivalent': {enabled: false},
|
|
46
|
+
'aria-conditional-attr': {enabled: false},
|
|
47
|
+
'aria-deprecated-role': {enabled: false},
|
|
45
48
|
'aria-dialog-name': {enabled: true},
|
|
49
|
+
'aria-prohibited-attr': {enabled: false},
|
|
46
50
|
'aria-roledescription': {enabled: false},
|
|
47
51
|
'aria-treeitem-name': {enabled: true},
|
|
48
52
|
'aria-text': {enabled: true},
|
|
49
53
|
'audio-caption': {enabled: false},
|
|
50
54
|
'blink': {enabled: false},
|
|
55
|
+
'duplicate-id-active': {enabled: true},
|
|
51
56
|
'duplicate-id': {enabled: false},
|
|
52
57
|
'empty-heading': {enabled: true},
|
|
53
58
|
'frame-focusable-content': {enabled: false},
|
|
@@ -174,9 +174,15 @@ export class NetworkAnalyzer {
|
|
|
174
174
|
* @return {LH.Artifacts.NetworkRequest|undefined}
|
|
175
175
|
*/
|
|
176
176
|
static findResourceForUrl(records: Array<LH.Artifacts.NetworkRequest>, resourceUrl: string): LH.Artifacts.NetworkRequest | undefined;
|
|
177
|
+
/**
|
|
178
|
+
* @param {Array<LH.Artifacts.NetworkRequest>} records
|
|
179
|
+
* @param {string} resourceUrl
|
|
180
|
+
* @return {LH.Artifacts.NetworkRequest|undefined}
|
|
181
|
+
*/
|
|
182
|
+
static findLastDocumentForUrl(records: Array<LH.Artifacts.NetworkRequest>, resourceUrl: string): LH.Artifacts.NetworkRequest | undefined;
|
|
177
183
|
/**
|
|
178
184
|
* Resolves redirect chain given a main document.
|
|
179
|
-
* See: {@link NetworkAnalyzer.
|
|
185
|
+
* See: {@link NetworkAnalyzer.findLastDocumentForUrl}) for how to retrieve main document.
|
|
180
186
|
*
|
|
181
187
|
* @param {LH.Artifacts.NetworkRequest} request
|
|
182
188
|
* @return {LH.Artifacts.NetworkRequest}
|
|
@@ -506,9 +506,25 @@ class NetworkAnalyzer {
|
|
|
506
506
|
);
|
|
507
507
|
}
|
|
508
508
|
|
|
509
|
+
/**
|
|
510
|
+
* @param {Array<LH.Artifacts.NetworkRequest>} records
|
|
511
|
+
* @param {string} resourceUrl
|
|
512
|
+
* @return {LH.Artifacts.NetworkRequest|undefined}
|
|
513
|
+
*/
|
|
514
|
+
static findLastDocumentForUrl(records, resourceUrl) {
|
|
515
|
+
// equalWithExcludedFragments is expensive, so check that the resourceUrl starts with the request url first
|
|
516
|
+
const matchingRequests = records.filter(request =>
|
|
517
|
+
request.resourceType === 'Document' &&
|
|
518
|
+
// Note: `request.url` should never have a fragment, else this optimization gives wrong results.
|
|
519
|
+
resourceUrl.startsWith(request.url) &&
|
|
520
|
+
UrlUtils.equalWithExcludedFragments(request.url, resourceUrl)
|
|
521
|
+
);
|
|
522
|
+
return matchingRequests[matchingRequests.length - 1];
|
|
523
|
+
}
|
|
524
|
+
|
|
509
525
|
/**
|
|
510
526
|
* Resolves redirect chain given a main document.
|
|
511
|
-
* See: {@link NetworkAnalyzer.
|
|
527
|
+
* See: {@link NetworkAnalyzer.findLastDocumentForUrl}) for how to retrieve main document.
|
|
512
528
|
*
|
|
513
529
|
* @param {LH.Artifacts.NetworkRequest} request
|
|
514
530
|
* @return {LH.Artifacts.NetworkRequest}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lighthouse",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "11.0.0-dev.
|
|
4
|
+
"version": "11.0.0-dev.20230906",
|
|
5
5
|
"description": "Automated auditing, performance metrics, and best practices for the web.",
|
|
6
6
|
"main": "./core/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
"pako": "^2.0.3",
|
|
167
167
|
"preact": "^10.7.2",
|
|
168
168
|
"pretty-json-stringify": "^0.0.2",
|
|
169
|
-
"puppeteer": "^21.
|
|
169
|
+
"puppeteer": "^21.1.1",
|
|
170
170
|
"resolve": "^1.22.1",
|
|
171
171
|
"rollup": "^2.52.7",
|
|
172
172
|
"rollup-plugin-polyfill-node": "^0.12.0",
|
|
@@ -181,7 +181,7 @@
|
|
|
181
181
|
},
|
|
182
182
|
"dependencies": {
|
|
183
183
|
"@sentry/node": "^6.17.4",
|
|
184
|
-
"axe-core": "4.
|
|
184
|
+
"axe-core": "^4.8.0",
|
|
185
185
|
"chrome-launcher": "^1.0.0",
|
|
186
186
|
"configstore": "^5.0.1",
|
|
187
187
|
"csp_evaluator": "1.1.1",
|
|
@@ -199,11 +199,11 @@
|
|
|
199
199
|
"open": "^8.4.0",
|
|
200
200
|
"parse-cache-control": "1.0.1",
|
|
201
201
|
"ps-list": "^8.0.0",
|
|
202
|
-
"puppeteer-core": "^21.
|
|
202
|
+
"puppeteer-core": "^21.1.1",
|
|
203
203
|
"robots-parser": "^3.0.1",
|
|
204
204
|
"semver": "^5.3.0",
|
|
205
205
|
"speedline-core": "^1.4.3",
|
|
206
|
-
"third-party-web": "^0.
|
|
206
|
+
"third-party-web": "^0.24.0",
|
|
207
207
|
"ws": "^7.0.0",
|
|
208
208
|
"yargs": "^17.3.1",
|
|
209
209
|
"yargs-parser": "^21.0.0"
|