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

report: fix compat for older lighthouse reports #14617

Merged
merged 4 commits into from
Jan 23, 2023
Merged

Conversation

connorjclark
Copy link
Collaborator

Fixes #14549

Also added some tests to ensure things are working as far back as v3. The viewer had the best setup for this (it using puppeteer), so I wrote the tests there.

@connorjclark connorjclark requested a review from a team as a code owner December 15, 2022 22:49
@connorjclark connorjclark requested review from adamraine and removed request for a team December 15, 2022 22:49
@@ -154,6 +154,10 @@ class Util {
}
}
}

// TODO: convert printf-style displayValue.
Copy link
Member

Choose a reason for hiding this comment

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

Is this TODO for this PR or later?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's an optional, p100 thing :P just something I noticed and wanted to document in the relevant place.

viewer/test/viewer-test-pptr.js Outdated Show resolved Hide resolved
viewer/test/viewer-test-pptr.js Outdated Show resolved Hide resolved
Comment on lines +279 to +282
const waitForAck = viewerPage.evaluate(() =>
new Promise(resolve =>
document.addEventListener('lh-file-upload-test-ack', resolve, {once: true})));
await fileInput.uploadFile(`${LH_ROOT}/report/test-assets/${testFilename}`);
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this promise structure guarantees that the event listener is installed by the time we call fileInput.uploadFile.

Copy link
Collaborator Author

@connorjclark connorjclark Jan 12, 2023

Choose a reason for hiding this comment

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

Protocol commands are executed in sequence, so why wouldn't this be alright? the callback inside the promise is a microtask, but I think even then it runs on the main thread and so would any commands called by fileInput.upload so should be all good

Copy link
Member

Choose a reason for hiding this comment

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

Protocol commands are executed in sequence

Interesting, did not know this. This is probably fine then.

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

Successfully merging this pull request may close these issues.

Old v3 LHR fails to render in viewer
3 participants