-
Notifications
You must be signed in to change notification settings - Fork 9.6k
core(tracing): support missing TracingStartedInBrowser #7122
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
Changes from all commits
960f332
a54a981
8fe6886
4864e08
c8629e7
3d090f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -237,6 +237,29 @@ class TraceProcessor { | |
| } | ||
| } | ||
|
|
||
| // Support the case where everything else fails, see https://github.com/GoogleChrome/lighthouse/issues/7118. | ||
| // If we can't find either TracingStarted event, then we'll fallback to the first navStart that | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. back in 2016, we used a diff hack.. which thread had the most events: 1c62db3#diff-a6b18ac2e75e02d6c1e53d586a319643R101 Since this is an uber-fallback case, I wonder if we should try that instead? @aslushnikov points out that corp managed chrome's that have required chrome apps probably have very active extension threads. might mess this up. also agrees that "most active" is gross. :D
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Instead of instead, double check it with most events? :) |
||
| // looks like it was loading the main frame with a real URL. Because the schema for this event | ||
| // has changed across Chrome versions, we'll be extra defensive about finding this case. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🏆 |
||
| const navStartEvt = events.find(e => Boolean(e.name === 'navigationStart' && e.args && | ||
| e.args.data && e.args.data.isLoadingMainFrame && e.args.data.documentLoaderURL)); | ||
| // Find the first resource that was requested and make sure it agrees on the id. | ||
| const firstResourceSendEvt = events.find(e => e.name === 'ResourceSendRequest'); | ||
| // We know that these properties exist if we found the events, but TSC doesn't. | ||
| if (navStartEvt && navStartEvt.args && navStartEvt.args.data && | ||
| firstResourceSendEvt && | ||
| firstResourceSendEvt.pid === navStartEvt.pid && | ||
| firstResourceSendEvt.tid === navStartEvt.tid) { | ||
| const frameId = navStartEvt.args.frame; | ||
| if (frameId) { | ||
| return { | ||
| pid: navStartEvt.pid, | ||
| tid: navStartEvt.tid, | ||
| frameId, | ||
| }; | ||
| } | ||
| } | ||
patrickhulce marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| throw new LHError(LHError.errors.NO_TRACING_STARTED); | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.