Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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(font-size): don't allow a deleted node to fail gatherer #9928
core(font-size): don't allow a deleted node to fail gatherer #9928
Changes from 1 commit
e2c008b
276c282
a3c1f15
5ca763f
1d2c7d8
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
(also when
fetchSourceRule
returns undefined)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.
does it?
we want to keep if it is undefined, I think
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.
Oh I see. Good catch, but this distinction is definitely going to be overlooked like I just did the next time someone is doing something in here :) (at least without a test for it, which is going to be annoying/hard)
Should we just treat these two failures the same to keep it simpler (e.g. count them both in the total length since the elements were at least in the DOM at some point)? Or rearrange the mapping/filtering to make it clearer.
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.
I think we shouldn't keep the nodes we know were deleted, because in the case of a timer (that can be modified many many many times) the percentages will be thrown off what is visible at any one point.
I added some comments to make it more clear. Importantly, that second filter isn't filtering result out of the artifact, it is just assigning the stylesheet object to the nodes that we could attribute a stylesheet to.
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.
Wouldn't it be more correct to include it, though? The gatherer is using
DOM.getFlattenedDocument
to get a snapshot of the DOM at a single point in time, so the percentage including it would be accurate for that moment (which is when all the text lengths come from, not from when we finally get to callingCSS.getMatchedStylesForNode
)e.g. if the timer is the only too-small text on screen, dropping it would give an
analyzedFailingTextLength
of 0 and no node listing when we do know the node that was failing, and in theory have a decent selector to that would indicate the issue was the timer element.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.
hmmm this sounds compelling. I was thinking we'd somehow have many copies of the "same" node, but that doesn't make sense b/c we just take a snapshot.
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.
any reason not to do
.filter(data => data.cssRule);
? Usually we reservein
for making tsc happy on poorly discriminated unionsThere 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.
this is also filtered down on
https://github.com/GoogleChrome/lighthouse/pull/9928/files#diff-aed43c42d5d8fb3c5d70f6775865c8deR351
, so could remove one of themThere 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.
hmm, i think the former check (the one here) needs to keep
undefined
b/c it still counts towards the total text length (we just failed to attribute to a specific sheet)