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

new_audit: bf-cache #14465

Merged
merged 63 commits into from
Jan 11, 2023
Merged

new_audit: bf-cache #14465

merged 63 commits into from
Jan 11, 2023

Conversation

adamraine
Copy link
Member

@adamraine adamraine commented Oct 24, 2022

Example result on https://www.espn.com/:

Screen Shot 2022-10-24 at 3 26 37 PM

Screen Shot 2022-11-29 at 4 21 10 PM

Changes we should consider:

  • Using the explanations tree to identify which frame the errors are referring to. We can provide more insight than "The page has an unload handler in a sub frame".
  • Right now, the audit only fails when there are actionable failures (PageSupportNeeded reason type). It's common for bf cache to fail for reasons related to the browser. Perhaps we should still surface these "non actionable" errors but still pass the audit. The DT panel lists them under "Pending support" and "Not Actionable" sections.
  • Create a BFCacheErrors computed artifact and get the event from the DT log for timespan mode.

Ref
#13960

import FRGatherer from '../base-gatherer.js';
import {waitForFrameNavigated, waitForLoadEvent} from '../driver/wait-for-condition.js';

class BFCacheErrors extends FRGatherer {
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe name to just BFCache or BFCacheReasonsNotRestored?

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to differentiate from the BFCache audit, and BFCacheReasonsNotRestored feels too long. This also mirrors the InstallabilityErrors artifact.

const entry = history.entries[history.currentIndex];

await Promise.all([
session.sendCommand('Page.navigate', {url: 'chrome://terms'}),
Copy link
Collaborator

Choose a reason for hiding this comment

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

  • need to verify this url works in edge and brave
  • need to confirm we can't just use about:blank (does the devtools CL suggest why, exactly?)

Copy link
Member Author

@adamraine adamraine Oct 24, 2022

Choose a reason for hiding this comment

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

need to verify this url works in edge and brave

It works but the contents are different for each browser. (Doesn't work in opera if that matters)

need to confirm we can't just use about:blank (does the devtools CL suggest why, exactly?)

https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/panels/application/components/BackForwardCacheView.ts;l=266-270?q=BackForwardCacheView&ss=chromium%2Fchromium%2Fsrc:third_party%2Fdevtools-frontend%2Fsrc%2F

Seems like about:blank would fit the bill as well?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Pending response from chrome peeps about if about:blank would suffice here.

core/audits/bf-cache.js Outdated Show resolved Hide resolved
@@ -13,6 +13,10 @@ const config = {
// webpages present here, hence the inclusion of 'best-practices'.
onlyCategories: ['performance', 'best-practices'],

// BF cache will request the page again, initiating additional network requests.
// Disable the audit so we only detect requests from the normal page load.
skipAudits: ['bf-cache'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we should have a test-definition base config we extend from? we could also specify only-categories: [] in it, forcing smoke configs that extend it to be more specific (I assume that works...)

Copy link
Member Author

@adamraine adamraine Nov 9, 2022

Choose a reason for hiding this comment

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

Seems like overkill plus it would be confusing when writing a test to bounce between the smokehouse base config and the test specific config.

This issue is only present on a handful of tests.

core/audits/bf-cache.js Outdated Show resolved Hide resolved
core/audits/bf-cache.js Outdated Show resolved Hide resolved
}

return {
score: 0,
Copy link
Collaborator

Choose a reason for hiding this comment

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

may want to mark n/a if supportPendingTable or notActionableTable is >0

Copy link
Member Author

Choose a reason for hiding this comment

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

If there are still actionable failures I think it's worth surfacing them

const entry = history.entries[history.currentIndex];

await Promise.all([
session.sendCommand('Page.navigate', {url: 'chrome://terms'}),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Pending response from chrome peeps about if about:blank would suffice here.

copybara-service bot pushed a commit to ChromeDevTools/devtools-frontend that referenced this pull request Jan 10, 2023
Required for bfcache testing in Lighthouse to work:
GoogleChrome/lighthouse#14465

Bug: None
Change-Id: I4faf54e5dee9acdf8ffde4ee8762c21ed7fb50b5
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4117673
Commit-Queue: Adam Raine <asraine@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Paul Irish <paulirish@chromium.org>
@adamraine
Copy link
Member Author

Looks like we might need a longer timeout than 50ms:
https://github.com/GoogleChrome/lighthouse/actions/runs/3896792832/jobs/6653843105

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