Skip to content

core(fr): minor renames… cdpSession, defaultSession, requestfinished #14097

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

Merged
merged 8 commits into from
Jun 8, 2022

Conversation

paulirish
Copy link
Member

@paulirish paulirish commented Jun 7, 2022

  • we fire an event called requestloaded but it fires from all the finished handlers.. (also from the loadingfailed) path. so i'm renaming it requestfinished to be more accurate
  • the FR session object has a property where it stores the pptr session. kinda confusing that in that file this._session is that pptr instance but in everywhere else its our FRProtocolSession, so this just clarifies that.
  • the FR driver currently has both _session AND _defaultSession. I can't really tell why the duplicated _session has existed, but it doesnt need to.

none of these should change behavior in any way

the motivation here is improved understandability for #14093 and #14078. i think the wins here are worth the minor churn

@paulirish paulirish requested a review from a team as a code owner June 7, 2022 21:00
@paulirish paulirish requested review from adamraine and removed request for a team June 7, 2022 21:00
@@ -13,10 +13,10 @@ const DEFAULT_PROTOCOL_TIMEOUT = 30000;
/** @implements {LH.Gatherer.FRProtocolSession} */
class ProtocolSession {
/**
* @param {LH.Puppeteer.CDPSession} session
* @param {LH.Puppeteer.CDPSession} cdpSession
Copy link
Member

Choose a reason for hiding this comment

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

Maybe pptrSession?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd be on board with pptrSession if this was external facing, but constructing these should (hopefully) always be internal. I'm +1 to cdpSession to match the class name in that case.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I'm happy with both. Let's change it in the future if we keep referring to it as the pptr session.

Copy link
Contributor

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

driver feels like there was a plan with _session and defaultSession, but I'm not sure what it could be, and it'll benefit the most from when legacy can be deleted, so LGTM to keep it simple in the meanwhile. Big fan of the cdpSession rename :)

@@ -13,10 +13,10 @@ const DEFAULT_PROTOCOL_TIMEOUT = 30000;
/** @implements {LH.Gatherer.FRProtocolSession} */
class ProtocolSession {
/**
* @param {LH.Puppeteer.CDPSession} session
* @param {LH.Puppeteer.CDPSession} cdpSession
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd be on board with pptrSession if this was external facing, but constructing these should (hopefully) always be internal. I'm +1 to cdpSession to match the class name in that case.

@adamraine
Copy link
Member

driver feels like there was a plan with _session and defaultSession, but I'm not sure what it could be, and it'll benefit the most from when legacy can be deleted, so LGTM to keep it simple in the meanwhile.

I think the plan had something to do with creating multiple sessions, but yeah I'm fine with removing the weird _session stuff until we know what we actually want to do there.

@connorjclark
Copy link
Collaborator

(tag removed just because tests failing / I merged some PRs touching same files)

@brendankenny brendankenny merged commit 1444c20 into master Jun 8, 2022
@brendankenny brendankenny deleted the requestfinished branch June 8, 2022 23:33
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.

5 participants