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(render-blocking): handle amp-style stylesheets #4555

Merged
merged 6 commits into from
Feb 26, 2018

Conversation

patrickhulce
Copy link
Collaborator

fixes #2832

@@ -90,6 +103,9 @@
</style>
</template>

<!-- Force FCP to be ~5s out, necessary to make sure our render-blocking audits still work -->
<!-- even when other forces were responsible for delaying the render. -->
<script> while (Date.now() - performance.timing.responseStart < 5000) ; </script>
Copy link
Member

Choose a reason for hiding this comment

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

can we use an add'l stylesheet with delay=5000 instead? Seems more natural.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

unfortunately, no. since the only way we assert that we didn't flag the amp stylesheet is by asserting the overall render-blocking stylesheets value is <3s. in the future details, but extendedInfo-style world this will be easier :)

prev.push({
tag,
transferSize: request.transferSize || 0,
startTime: request.startTime,
endTime: request.endTime,
endTime: Math.min(request.endTime, request.startTime + earliestNonBlockingTime / 1000),
Copy link
Member

Choose a reason for hiding this comment

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

can you extract request.startTime + earliestNonBlockingTime / 1000) into a variable above?

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

Copy link
Member

@paulirish paulirish left a comment

Choose a reason for hiding this comment

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

lgtm just naming ideas.

@@ -30,7 +30,7 @@ function installMediaListener() {
window.___linkMediaChanges.push({
url: this.href,
Copy link
Member

Choose a reason for hiding this comment

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

naming bikesheds?

url => href
value => media
time => msSinceHTMLEnd
matches == matches

// Even if the request was initially blocking or appeared to be blocking once the
// page was loaded, the media attribute could have been changed during load, capping the
// amount of time it was render blocking. See https://github.com/GoogleChrome/lighthouse/issues/2832.
const nonMatchingMediaChangeTimes = (tag.mediaChanges || [])
Copy link
Member

Choose a reason for hiding this comment

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

timesMediaSetToNonBlocking ?

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.

Font style sheets in AMP misclassified as render blocking.
3 participants