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(tracing): support missing TracingStartedInBrowser #7122

Merged
merged 6 commits into from
Apr 29, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lighthouse-core/lib/traces/tracing-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,20 @@ class TraceProcessor {
}
}

// Support the case where everything else fails.
patrickhulce marked this conversation as resolved.
Show resolved Hide resolved
const navStartEvt = events.find(e => Boolean(e.name === 'navigationStart' && e.args &&
e.args.data && e.args.data.isLoadingMainFrame && e.args.data.documentLoaderURL));
if (navStartEvt && navStartEvt.args && navStartEvt.args.data) {
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);
}

Expand Down
1 change: 1 addition & 0 deletions types/externs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ declare global {
fileName?: string;
snapshot?: string;
data?: {
isLoadingMainFrame?: boolean;
documentLoaderURL?: string;
frames?: {
frame: string;
Expand Down