-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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: support traces with TracingStartedInBrowser event #5271
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9785181
core: Support traces with TracingStartedInBrowser event
a1ph 328cd03
add name to externs
patrickhulce 3678880
brendan's comments
patrickhulce d63f491
semicolon
patrickhulce 559ae44
core: Support traces with TracingStartedInBrowser event
a1ph File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,6 +112,55 @@ describe('Trace of Tab computed artifact:', () => { | |
assert.equal(trace.firstMeaningfulPaintEvt, undefined, 'bad fmp'); | ||
}); | ||
|
||
it('handles traces with TracingStartedInBrowser events', async () => { | ||
const tracingStartedInBrowserTrace = { | ||
'traceEvents': [{ | ||
'pid': 69850, | ||
'tid': 69850, | ||
'ts': 2193564729582, | ||
'ph': 'I', | ||
'cat': 'disabled-by-default-devtools.timeline', | ||
'name': 'TracingStartedInBrowser', | ||
'args': {'data': { | ||
'frameTreeNodeId': 1, | ||
'frames': [{ | ||
'frame': 'B192D1F3355A6F961EC8F0B01623C1FB', | ||
'url': 'http://www.example.com/', | ||
'name': '', | ||
'processId': 69920, | ||
}], | ||
}}, | ||
'tts': 1085165, | ||
's': 't', | ||
}, { | ||
'pid': 69920, | ||
'tid': 1, | ||
'ts': 2193564790059, | ||
'ph': 'R', | ||
'cat': 'blink.user_timing', | ||
'name': 'navigationStart', | ||
'args': { | ||
'frame': 'B192D1F3355A6F961EC8F0B01623C1FB', | ||
'data': { | ||
'documentLoaderURL': 'http://www.example.com/', | ||
'isLoadingMainFrame': true, | ||
}, | ||
}, | ||
'tts': 141371, | ||
}, { | ||
'pid': 69920, | ||
'tid': 1, | ||
'ts': 0, | ||
'ph': 'M', | ||
'cat': '__metadata', | ||
'name': 'thread_name', | ||
'args': {'name': 'CrRendererMain'}, | ||
}]}; | ||
const trace = await traceOfTab.compute_(tracingStartedInBrowserTrace); | ||
assert.equal(trace.startedInPageEvt.ts, 2193564729582); | ||
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. want to assert the navStart is found and in the trace.mainThreadEvents since I assume that's what the 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. Done |
||
assert.equal(trace.navigationStartEvt.ts, 2193564790059); | ||
}); | ||
|
||
it('stably sorts events', async () => { | ||
const traceJson = fs.readFileSync(__dirname + | ||
'/../../fixtures/traces/tracingstarted-after-navstart.json', 'utf8'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the casts are annoying, could also do something like
above, and then here
because the compiler will know that
possibleStartedInPageEvt
is definitely defined at this point, the type forstartedInPageEvt
will be inferred correctly asLH.TraceEvent
, and then it won't need any casts below this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered that, but I didn't want to introduce more code to workaround compiler issues. I'm fine with casts.