Skip to content

Relax the check about chrome profiles #5439

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
12 changes: 5 additions & 7 deletions src/profile-logic/import/chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,12 @@ export function attemptToConvertChromeProfile(

if (Array.isArray(json)) {
// Chrome profiles come as a list of events.
const event: mixed = json[0];
// Lightly check that some properties exist that are in the TracingEvent.
const firstEvents = json.slice(0, 5);
// Lightly check that the first items look like a TracingEvent.
if (
event &&
typeof event === 'object' &&
'ph' in event &&
'cat' in event &&
'args' in event
Comment on lines -221 to -225
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The trace doesn't have cat nor args so I went with a simpler check.
Then I decided to look at more than just the first event, so that we'd have some more certainty.

firstEvents.every(
(event) => event && typeof event === 'object' && 'ph' in event
)
) {
events = coerce<mixed[], TracingEventUnion[]>(json);
}
Expand Down
Binary file not shown.
Loading