-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Conversation
clients/devtools-entry.js
Outdated
* @return {Promise<LH.RunnerResult|void>} | ||
*/ | ||
function runLighthouseInWorker(port, url, flags, categoryIDs) { | ||
function runLighthouse(url, flags, categoryIDs, connection) { |
There was a problem hiding this comment.
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
).
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ya?
ya!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Merged your commit
eviscerate runLighthouse
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. ℹ️ Googlers: Go here for more info. |
@googlebot I fixed it. |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
To support LH localization in DevTools, this PR splits
runLighthouseInWorker
into two functions and expose them to the audits worker. The first function issetUpWorkerConnection
which sets up and returns the connection that allows the worker to make an xhr request to the LH locale file. The second function isrunLighthouse
, which processes the configs to run lighthouse and returns the report.