WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
132109
Web Inspector: Expect to see top level JavaScript function profiler details for event handlers in timeline
https://bugs.webkit.org/show_bug.cgi?id=132109
Summary
Web Inspector: Expect to see top level JavaScript function profiler details f...
Joseph Pecoraro
Reported
2014-04-23 22:37:03 PDT
If a JS event handler A calls function B then B shows up in the profile, but not A. This means that event handler functions themselves are not showing up with timeline profiler details. * STEPS TO REPRODUCE 1. Inspect <
http://timothy.hatcher.name/tetris/
> 2. Start a timeline 3. Press keys 'a', 's', 'd', 'f' in the inspected page 4. Stop timeline 5. Select the range with keydown events * RESULTS - Notice that key events for 'a', 'd', and 'f' have no profiler information, despite the fact that they ran the "onKeyDown" function. - The 's' handler does have profiler information for calling into "save game" code, but the top level "onKeyDown" function is not shown
Attachments
Patch
(2.01 KB, patch)
2014-08-11 08:37 PDT
,
Timothy Hatcher
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2014-04-23 22:37:18 PDT
<
rdar://problem/16709018
>
Joseph Pecoraro
Comment 2
2014-08-01 14:18:36 PDT
This was really bugging me in recent Timeline work.
Timothy Hatcher
Comment 3
2014-08-01 16:07:53 PDT
Was this fixed by recompiling the functions during timeline recording?
Joseph Pecoraro
Comment 4
2014-08-01 17:47:24 PDT
(In reply to
comment #3
)
> Was this fixed by recompiling the functions during timeline recording?
Nope, that just shows the proper functions underneath. The issue is with showing the top level function. So given: 1. function myHandler(event) { 2. foo(); 3. } 4. 5. elem.addEventListener("click", myHandler, false); I would expect to see: Click Event (line 5) -> myHandler (line 1) -> foo But what we currently see is: Click Event (line 5) -> foo Essentially the "myHandler" time is rolled up into the Click Event record. It would be good to see both (1) where the event was attached and (2) the handler being run. Also, I don't know what happens if there are multiple click handlers. Does that mean we produce two "Click Event" records, or one? It might be nice to have 1, with all of the event listeners it executed nested under it.
Joseph Pecoraro
Comment 5
2014-08-01 17:48:25 PDT
> But what we currently see is: > > Click Event (line 5) > -> foo
Correction: Click Event (line 1)
Timothy Hatcher
Comment 6
2014-08-01 18:14:29 PDT
Oh! That… This is explicit and all done on the UI side. If there is only one listener, it becomes the top level record. See ScriptTimelineView.js:208. // If there is only one node, promote its children. The TimelineRecordTreeElement already reflects the root // node in this case (e.g. a "Load Event Dispatched" record with an "onload" root profile node). // FIXME: Only do this for the top-down mode. Doing this for bottom-up would be incorrect. if (rootNodes.length === 1) rootNodes = rootNodes[0].childNodes;
Timothy Hatcher
Comment 7
2014-08-01 18:17:46 PDT
Right now where the event was registered is a separate record, not attached to the firing records.
Timothy Hatcher
Comment 8
2014-08-01 22:01:44 PDT
This does have an effect on filtering. You can't filter for the entry function name. Either the entry function name needs to be included in the top level record, or it needs to be nested under it so filtering works.
Timothy Hatcher
Comment 9
2014-08-05 11:37:21 PDT
Lets just remove those lines of code and revisit this later if we have better ideas.
Timothy Hatcher
Comment 10
2014-08-11 08:37:21 PDT
Created
attachment 236368
[details]
Patch
Joseph Pecoraro
Comment 11
2014-08-11 21:52:58 PDT
Comment on
attachment 236368
[details]
Patch r=me. Yeah, I just played with this on the tetris page and I like it much better!
WebKit Commit Bot
Comment 12
2014-08-12 00:57:15 PDT
Comment on
attachment 236368
[details]
Patch Clearing flags on attachment: 236368 Committed
r172432
: <
http://trac.webkit.org/changeset/172432
>
WebKit Commit Bot
Comment 13
2014-08-12 00:57:18 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug