Skip to content

Commit 58b59bb

Browse files
authored
core: fix incorrect dpr used for responsive images advice (#16771)
1 parent 82e1196 commit 58b59bb

File tree

101 files changed

+14271
-18318
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+14271
-18318
lines changed

cli/test/smokehouse/test-definitions/byte-efficiency.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ const expectations = {
214214
// },
215215
// ],
216216
debugData: {
217-
wastedBytes: '160000 +/- 10000',
217+
wastedBytes: '132000 +/- 10000',
218218
},
219219
},
220220
},

cli/test/smokehouse/test-definitions/dobetterweb.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -351,42 +351,42 @@ const expectations = {
351351
score: '<0.5',
352352
metricSavings: {LCP: '>2000'},
353353
details: {
354-
debugData: {wastedBytes: '>1200000'},
354+
debugData: {wastedBytes: '>1100000'},
355355
items: [
356356
{
357357
url: 'http://localhost:10200/dobetterweb/lighthouse-rotating.gif',
358358
totalBytes: 934285,
359-
wastedBytes: 682028,
359+
wastedBytes: '682028 +/- 10000',
360360
subItems: {items: [{reason: /Using video formats instead of GIFs/}]},
361361
},
362362
{
363363
url: 'http://localhost:10200/dobetterweb/lighthouse-1024x680.jpg?iar1', // filename is a lie...
364364
totalBytes: 112710,
365-
wastedBytes: 112418,
365+
wastedBytes: '111815 +/- 10000',
366366
subItems: {items: [{reason: /This image file is larger than it needs to be \(1024x678\) for its displayed dimensions/}]},
367367
},
368368
{
369369
url: 'http://localhost:10200/dobetterweb/lighthouse-1024x680.jpg?isr2',
370370
totalBytes: 112710,
371-
wastedBytes: 111152,
371+
wastedBytes: '107937 +/- 10000',
372372
subItems: {items: [{reason: /This image file is larger than it needs to be \(1024x678\) for its displayed dimensions/}]},
373373
},
374374
{
375375
url: 'http://localhost:10200/dobetterweb/lighthouse-1024x680.jpg?iar2',
376376
totalBytes: 112710,
377-
wastedBytes: 111152,
377+
wastedBytes: '107937 +/- 10000',
378378
subItems: {items: [{reason: /This image file is larger than it needs to be \(1024x678\) for its displayed dimensions/}]},
379379
},
380380
{
381381
url: 'http://localhost:10200/dobetterweb/lighthouse-1024x680.jpg?isr3',
382382
totalBytes: 112710,
383-
wastedBytes: 98684,
383+
wastedBytes: '69754 +/- 30000',
384384
subItems: {items: [{reason: /This image file is larger than it needs to be \(1024x678\) for its displayed dimensions/}]},
385385
},
386386
{
387387
url: 'http://localhost:10200/dobetterweb/lighthouse-1024x680.jpg',
388388
totalBytes: 112710,
389-
wastedBytes: 98684,
389+
wastedBytes: '69754 +/- 30000',
390390
subItems: {items: [{reason: /This image file is larger than it needs to be \(1024x678\) for its displayed dimensions/}]},
391391
},
392392
],

core/audits/audit.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,9 @@ class Audit {
496496
const trace = artifacts.Trace;
497497
const devtoolsLog = artifacts.DevtoolsLog;
498498
const gatherContext = artifacts.GatherContext;
499-
const {URL, SourceMaps} = artifacts;
499+
const {URL, HostDPR, SourceMaps} = artifacts;
500500
// eslint-disable-next-line max-len
501-
return {trace, devtoolsLog, gatherContext, settings: context.settings, URL, SourceMaps, simulator: null};
501+
return {trace, devtoolsLog, gatherContext, settings: context.settings, URL, SourceMaps, HostDPR, simulator: null};
502502
}
503503
}
504504

core/audits/bootup-time.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class BootupTime extends Audit {
4949
description: str_(UIStrings.description),
5050
scoreDisplayMode: Audit.SCORING_MODES.METRIC_SAVINGS,
5151
guidanceLevel: 1,
52-
requiredArtifacts: ['Trace', 'DevtoolsLog', 'URL', 'GatherContext', 'SourceMaps'],
52+
requiredArtifacts: ['Trace', 'DevtoolsLog', 'URL', 'GatherContext', 'SourceMaps', 'HostDPR'],
5353
};
5454
}
5555

core/audits/byte-efficiency/unminified-css.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class UnminifiedCSS extends ByteEfficiencyAudit {
3838
scoreDisplayMode: ByteEfficiencyAudit.SCORING_MODES.METRIC_SAVINGS,
3939
guidanceLevel: 3,
4040
requiredArtifacts: ['Stylesheets', 'DevtoolsLog', 'Trace', 'URL', 'GatherContext',
41-
'SourceMaps'],
41+
'SourceMaps', 'HostDPR'],
4242
};
4343
}
4444

core/audits/byte-efficiency/unminified-javascript.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class UnminifiedJavaScript extends ByteEfficiencyAudit {
4545
scoreDisplayMode: ByteEfficiencyAudit.SCORING_MODES.METRIC_SAVINGS,
4646
guidanceLevel: 3,
4747
requiredArtifacts: ['Scripts', 'DevtoolsLog', 'Trace', 'GatherContext', 'URL',
48-
'SourceMaps'],
48+
'SourceMaps', 'HostDPR'],
4949
};
5050
}
5151

core/audits/byte-efficiency/unused-css-rules.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class UnusedCSSRules extends ByteEfficiencyAudit {
3434
description: str_(UIStrings.description),
3535
scoreDisplayMode: ByteEfficiencyAudit.SCORING_MODES.METRIC_SAVINGS,
3636
guidanceLevel: 1,
37-
requiredArtifacts:
38-
['Stylesheets', 'CSSUsage', 'URL', 'DevtoolsLog', 'Trace', 'GatherContext', 'SourceMaps'],
37+
// eslint-disable-next-line max-len
38+
requiredArtifacts: ['Stylesheets', 'CSSUsage', 'URL', 'DevtoolsLog', 'Trace', 'GatherContext', 'SourceMaps', 'HostDPR'],
3939
};
4040
}
4141

core/audits/byte-efficiency/unused-javascript.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class UnusedJavaScript extends ByteEfficiencyAudit {
6969
scoreDisplayMode: ByteEfficiencyAudit.SCORING_MODES.METRIC_SAVINGS,
7070
guidanceLevel: 1,
7171
requiredArtifacts: ['JsUsage', 'Scripts', 'SourceMaps', 'GatherContext',
72-
'DevtoolsLog', 'Trace', 'URL', 'SourceMaps'],
72+
'DevtoolsLog', 'Trace', 'URL', 'HostDPR'],
7373
};
7474
}
7575

core/audits/insights/cache-insight.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class CacheInsight extends Audit {
2424
failureTitle: str_(UIStrings.title),
2525
description: str_(UIStrings.description),
2626
guidanceLevel: 3,
27-
requiredArtifacts: ['Trace', 'SourceMaps'],
27+
requiredArtifacts: ['Trace', 'SourceMaps', 'HostDPR'],
2828
replacesAudits: ['uses-long-cache-ttl'],
2929
};
3030
}

core/audits/insights/cls-culprits-insight.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class CLSCulpritsInsight extends Audit {
3737
failureTitle: insightStr_(InsightUIStrings.title),
3838
description: insightStr_(InsightUIStrings.description),
3939
guidanceLevel: 3,
40-
requiredArtifacts: ['Trace', 'TraceElements', 'SourceMaps'],
40+
requiredArtifacts: ['Trace', 'TraceElements', 'SourceMaps', 'HostDPR'],
4141
replacesAudits: ['layout-shifts'],
4242
};
4343
}

0 commit comments

Comments
 (0)