Skip to content

Conversation

@patrickhulce
Copy link
Collaborator

Summary
Replace all our scattered meta gatherers with a single MetaElements artifact.

Related Issues/PRs
#6747

failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['FontSize', 'URL', 'Viewport'],
requiredArtifacts: ['FontSize', 'URL', 'MetaElements'],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no changes to functionality needed here because it just calls out to the viewport audit

@paulirish paulirish mentioned this pull request Jan 16, 2019
6 tasks
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.

maybe it's unavoidable, but are we setting ourselves up for ballooning the size of the artifacts? People put crazy things in meta tags sometimes.

We could have a list of allowed meta names and add the ones we need as we go. On the other hand, that would prevent plugins from being able to just use the meta tags they're interested in without getting changes landed in core.

MetaDescription: string|null;
/** The value of the <meta name="robots">'s content attribute, or null. */
MetaRobots: string|null;
/** The value of the <meta>elements in the head. */
Copy link
Contributor

Choose a reason for hiding this comment

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

values

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

<meta name="viewport" content="invalid-content=should_have_looked_it_up">
<!-- no <meta name="description" content=""> -->
<meta name="robots" content="nofollow, NOINDEX, all">
<meta name="RoBots" content="nofollow, NOINDEX, all">
Copy link
Contributor

Choose a reason for hiding this comment

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

document the reason for this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done


/**
* @param {LH.Artifacts['ThemeColor']} themeColorMeta
* @param {LH.Artifacts['MetaElements'][0]|undefined} themeColorMeta
Copy link
Contributor

Choose a reason for hiding this comment

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

should we make an alias of LH.Artifacts.MetaElement since we use this so often?

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 is the only usage of it, but sure :)

Copy link
Contributor

Choose a reason for hiding this comment

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

this is the only usage of it, but sure

ha, whoops

const artifacts = {
URL,
Viewport: null,
MetaElements: makeMetaElements(null),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the conditional in makeMetaElements just for this case? null could just be undefined or this one could just be [] an no conditional needed :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure, done

devtoolsLogs: {[IsCrawlableAudit.DEFAULT_PASS]: devtoolsLog},
URL: {finalUrl},
MetaRobots: null,
MetaElements: makeMetaElements(null),
Copy link
Contributor

Choose a reason for hiding this comment

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

switch to no argument or just use [] and no function call?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure, done

passes: [{
passName: unlikelyPassName,
gatherers: ['viewport'],
gatherers: ['meta-elements'],
Copy link
Contributor

Choose a reason for hiding this comment

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

I apologize for the number of times I've used viewport as a dummy gatherer name :)

@patrickhulce
Copy link
Collaborator Author

maybe it's unavoidable, but are we setting ourselves up for ballooning the size of the artifacts? People put crazy things in meta tags sometimes.

FWIW, I'm not really worried about this. Of all the artifact size concerns, we know these artifacts have to be constrained to roughly the size of the page. trace/devtoolslog/screenshots are always going to dwarf this.

We could have a list of allowed meta names and add the ones we need as we go. On the other hand, that would prevent plugins from being able to just use the meta tags they're interested in without getting changes landed in core.

This limitation would kinda defeat the purpose of having generic gatherers IMO, would it not? Seems like if we just limited to what we needed then it's no different from the position we were in before functionality-wise.

@patrickhulce
Copy link
Collaborator Author

@brendankenny LGTY?

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.

LGTM

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants