Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core(responsiveness): add better INP fallback for old Chrome versions #13985

Merged
merged 1 commit into from
May 11, 2022

Conversation

brendankenny
Copy link
Member

part of #13916

This change makes INP not error in Chrome < 103.0.5052.0, since it needs just the latency duration, not the rest of the new timing information. It's fine to assume that this audit will land in a DevTools after that version, but puppeteer user flows could easily run on older versions than that.

The work-during-interaction audit will still error, however, since it requires the new timing information.

@brendankenny brendankenny requested a review from a team as a code owner May 10, 2022 18:33
@brendankenny brendankenny requested review from adamraine and removed request for a team May 10, 2022 18:33
*/
static findInteractionEvent(responsivenessEvent, {traceEvents}) {
const candidates = traceEvents.filter(/** @return {evt is EventTimingEvent} */ evt => {
// Examine only beginning/instant EventTiming events.
return evt.name === 'EventTiming' && evt.ph !== 'e';
});

if (candidates.length && !candidates[0].args.data.frame) {
if (candidates.length && !candidates.some(candidate => candidate.args.data?.frame)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should handle the seemingly impossible situation @paulirish was in, a newer Chrome but throwing at this point. AFAIK all EventTiming 'b' and 'n' events should have this format, but it's possible some somehow don't (empty string frame, maybe?).

Instead we just assert at least one candidate could (possibly) pass the frame equality check below.

"score": null,
"scoreDisplayMode": "error",
"errorMessage": "This version of Chrome is too old to support 'detailed EventTiming trace events'. Use a newer version to see full results."
"score": 1,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bonus: this works again without the trace update :)

@connorjclark connorjclark mentioned this pull request May 11, 2022
5 tasks
@connorjclark connorjclark changed the title core: add better INP fallback for old Chrome versions core(responsiveness): add better INP fallback for old Chrome versions May 11, 2022
@@ -215,6 +216,13 @@ class WorkDuringInteraction extends Audit {
if (interactionEvent === null) {
return {score: null, notApplicable: true};
}
// TODO: remove workaround once 103.0.5052.0 is sufficiently released.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make an issue and tag 10.0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make an issue and tag 10.0?

yes, but would it be more like 10.2 or something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants