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

clients(devtools): split up runLighthouseInWorker and expose to worker #10005

Merged
merged 3 commits into from
Nov 23, 2019

Conversation

chruxin
Copy link
Contributor

@chruxin chruxin commented Nov 21, 2019

To support LH localization in DevTools, this PR splits runLighthouseInWorker into two functions and expose them to the audits worker. The first function is setUpWorkerConnection which sets up and returns the connection that allows the worker to make an xhr request to the LH locale file. The second function is runLighthouse, which processes the configs to run lighthouse and returns the report.

* @return {Promise<LH.RunnerResult|void>}
*/
function runLighthouseInWorker(port, url, flags, categoryIDs) {
function runLighthouse(url, flags, categoryIDs, connection) {
Copy link
Member

Choose a reason for hiding this comment

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

at this point, it's hard to pretend this function is encapsulating anything from AuditsService.js :) so how about we just get rid of it?

It would be very helpful for e.g. testing in #9924 if runLighthouse was just the normal lighthouse entry point. I didn't want to make any changes to the interface in #9943 (comment) since it would require changes on the DevTools side, but if we're making changes there anyways...

The only thing left after the changes here is if a config was passed in instead of categoryIDs, and that could just be another helper function like setUpWorkerConnection (just put getDefaultConfigForCategories on self).

Copy link
Member

@paulirish paulirish Nov 21, 2019

Choose a reason for hiding this comment

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

so you're suggesting we just

self.runLighthouse = lighthouse;
self.getDefaultConfigForCategories;

ya?

ill prep a PR into this PR

Copy link
Member

Choose a reason for hiding this comment

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

ya?

ya!

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Merged your commit

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@chruxin
Copy link
Contributor Author

chruxin commented Nov 22, 2019

@googlebot I fixed it.

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@chruxin chruxin requested a review from brendankenny November 23, 2019 00:04
@paulirish paulirish merged commit 0f600e0 into GoogleChrome:master Nov 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants