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(fr): initial gatherer migration for snapshot, navigation #11993

Merged
merged 5 commits into from Jan 27, 2021

Conversation

connorjclark
Copy link
Collaborator

@connorjclark connorjclark commented Jan 22, 2021

This migrates the gatherers (14) that only use afterPass, the interface already supported by FRTransitionalContext, and no loadData.

CacheContents
Appcache
Doctype
Domstats
PasswordInputsWithPreventedPaste
FormElements
GlobalListeners
IframeElements
MetaElements
EmbeddedContent
FontSize
RobotsTxt
TapTargets
ViewportDimensions

ref #11313

@connorjclark connorjclark requested a review from a team as a code owner January 22, 2021 23:57
@connorjclark connorjclark requested review from patrickhulce and removed request for a team January 22, 2021 23:57
@google-cla google-cla bot added the cla: yes label Jan 22, 2021
@@ -30,10 +30,6 @@ function remoteObjectToString(obj) {
return `[${type} ${className}]`;
}

/**
* @implements {LH.Gatherer.GathererInstance}
* @implements {LH.Gatherer.FRGathererInstance}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This seemed unnecessary.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Depends on how explicit we want to be with knowing whether each gatherer supports FR and legacy or not :)

I erred on the side of "it's not yet obvious enough that a require('../../fraggle-rock/gather/base-gatherer.js'); at the top means this gatherer supports both APIs", but if everyone on the team feels it's already clear, wfm 👍

Copy link
Member

Choose a reason for hiding this comment

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

I would prefer keeping this around to keep it more explicit. The @implements was helpful when reviewing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

const FRGatherer = require('../../fraggle-rock/gather/base-gatherer.js');

class ... extends FRGatherer

?

Copy link
Member

Choose a reason for hiding this comment

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

That works for me.

One possible issue is that I already knew FRGatherer supports legacy mode. Probably not a big deal, I was mostly worried about missing the require('../../fraggle-rock/gather/base-gatherer.js'); at the top of the file.

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

LGTM, though would love for someone else on the team who I haven't explained anything to if the @implements is helpful for their understanding/clarity.

@adamraine perhaps? :)

@@ -5,35 +5,40 @@
*/
'use strict';

const Gatherer = require('./gatherer.js');
const Gatherer = require('../../fraggle-rock/gather/base-gatherer.js');

/**
* @fileoverview Tracks unused CSS rules.
*/
class CSSUsage extends Gatherer {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Conceptually, I don't think this should be a snapshot gatherer. Let's flag it in the FR issue for discussion and a potential rewrite soon?

const driver = passContext.driver;

await driver.sendCommand('DOM.enable');
await driver.defaultSession.sendCommand('DOM.enable');
Copy link
Collaborator

Choose a reason for hiding this comment

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

hm, unrelated but that's weird why do we enable/disable DOM if everything is in driver.evaluate anyway? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed

const driver = passContext.driver;

const formElements = await driver.evaluate(collectFormElements, {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: revert

when I see this structure I assume it's because there was a time where debugging this was necessary and console.log(formElements) seems useful + easy to keep :)

@connorjclark connorjclark changed the title core(fr): first-pass gatherer migration to support snapshot, navigation core(fr): first-pass gatherer migration for snapshot, navigation Jan 27, 2021
@connorjclark connorjclark changed the title core(fr): first-pass gatherer migration for snapshot, navigation core(fr): initial gatherer migration for snapshot, navigation Jan 27, 2021
@connorjclark connorjclark merged commit e2a0782 into master Jan 27, 2021
@connorjclark connorjclark deleted the fr-snapshot-first-pass branch January 27, 2021 18:33
@patrickhulce
Copy link
Collaborator

shoot @connorjclark I forgot to ask you to add these to the fraggle rock default config so we can check for any errors, could you pick that up next?

@connorjclark
Copy link
Collaborator Author

ya

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.

None yet

3 participants