Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
20 changes: 9 additions & 11 deletions src/components/timeline/VerticalIndicators.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,16 @@ export class VerticalIndicators extends React.PureComponent<Props> {
innerWindowIDToPageMap &&
data &&
data.type === 'tracing' &&
data.category === 'Navigation'
data.category === 'Navigation' &&
data.innerWindowID
) {
const innerWindowID = data.innerWindowID;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Flow was failing with innerWindowID is missing in ChromeDurationTraceEventPayload` and this is the only way I could silence it.

if (innerWindowID) {
const page = innerWindowIDToPageMap.get(innerWindowID);
if (page) {
url = (
<div className="timelineVerticalIndicatorsUrl">
{displayNiceUrl(page.url)}
</div>
);
}
const page = innerWindowIDToPageMap.get(data.innerWindowID);
if (page) {
url = (
<div className="timelineVerticalIndicatorsUrl">
{displayNiceUrl(page.url)}
</div>
);
}
}

Expand Down
21 changes: 20 additions & 1 deletion src/profile-logic/import/chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export type TracingEventUnion =
| ProcessLabelsEvent
| ProcessSortIndexEvent
| ThreadSortIndexEvent
| ScreenshotEvent;
| ScreenshotEvent
| FallbackEndEvent;

type TracingEvent<Event> = {|
cat: string,
Expand All @@ -50,11 +51,24 @@ type TracingEvent<Event> = {|
pid: number, // Process ID
tid: number, // Thread ID
ts: number, // Timestamp
tts?: number, // Thread Timestamp
tdur?: number, // Time duration
dur?: number, // Time duration
...Event,
|};

// V8 can generate this backward compatible event.
// See https://github.com/firefox-devtools/profiler/issues/4308#issuecomment-1303551614
type FallbackEndEvent = TracingEvent<{|
name: 'ProfileChunk',
id: string,
args: {|
data: {|
endTime: number,
|},
|},
|}>;

type ProfileEvent = TracingEvent<{|
name: 'Profile',
args: {
Expand Down Expand Up @@ -525,6 +539,11 @@ async function processTracingEvents(
}

for (const profileChunk of profileChunks) {
if (!profileChunk.args.data || !profileChunk.args.data.cpuProfile) {
// This is probably a FallbackEndEvent, ignore it instead of crashing.
continue;
}

const { cpuProfile } = profileChunk.args.data;
const { nodes, samples } = cpuProfile;
const timeDeltas = getTimeDeltas(profileChunk);
Expand Down
Loading