<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>132109</bug_id>
          
          <creation_ts>2014-04-23 22:37:03 -0700</creation_ts>
          <short_desc>Web Inspector: Expect to see top level JavaScript function profiler details for event handlers in timeline</short_desc>
          <delta_ts>2014-08-12 00:57:18 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Web Inspector</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joseph Pecoraro">joepeck</reporter>
          <assigned_to name="Timothy Hatcher">timothy</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>graouts</cc>
    
    <cc>joepeck</cc>
    
    <cc>timothy</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1003544</commentid>
    <comment_count>0</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2014-04-23 22:37:03 -0700</bug_when>
    <thetext>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 &lt;http://timothy.hatcher.name/tetris/&gt;
2. Start a timeline
3. Press keys &apos;a&apos;, &apos;s&apos;, &apos;d&apos;, &apos;f&apos; in the inspected page
4. Stop timeline
5. Select the range with keydown events

* RESULTS
- Notice that key events for &apos;a&apos;, &apos;d&apos;, and &apos;f&apos; have no profiler information, despite the fact that they ran the &quot;onKeyDown&quot; function.
- The &apos;s&apos; handler does have profiler information for calling into &quot;save game&quot; code, but the top level &quot;onKeyDown&quot; function is not shown</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1003545</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2014-04-23 22:37:18 -0700</bug_when>
    <thetext>&lt;rdar://problem/16709018&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1026332</commentid>
    <comment_count>2</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2014-08-01 14:18:36 -0700</bug_when>
    <thetext>This was really bugging me in recent Timeline work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1026380</commentid>
    <comment_count>3</comment_count>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2014-08-01 16:07:53 -0700</bug_when>
    <thetext>Was this fixed by recompiling the functions during timeline recording?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1026410</commentid>
    <comment_count>4</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2014-08-01 17:47:24 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; 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(&quot;click&quot;, myHandler, false);

I would expect to see:

    Click Event (line 5)
      -&gt; myHandler (line 1)
        -&gt; foo

But what we currently see is:

    Click Event (line 5)
      -&gt; foo

Essentially the &quot;myHandler&quot; 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&apos;t know what happens if there are multiple click handlers. Does that mean we produce two &quot;Click Event&quot; records, or one? It might be nice to have 1, with all of the event listeners it executed nested under it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1026411</commentid>
    <comment_count>5</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2014-08-01 17:48:25 -0700</bug_when>
    <thetext>&gt; But what we currently see is:
&gt; 
&gt;     Click Event (line 5)
&gt;       -&gt; foo

Correction: Click Event (line 1)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1026414</commentid>
    <comment_count>6</comment_count>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2014-08-01 18:14:29 -0700</bug_when>
    <thetext>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 &quot;Load Event Dispatched&quot; record with an &quot;onload&quot; 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;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1026415</commentid>
    <comment_count>7</comment_count>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2014-08-01 18:17:46 -0700</bug_when>
    <thetext>Right now where the event was registered is a separate record, not attached to the firing records.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1026438</commentid>
    <comment_count>8</comment_count>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2014-08-01 22:01:44 -0700</bug_when>
    <thetext>This does have an effect on filtering. You can&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1026901</commentid>
    <comment_count>9</comment_count>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2014-08-05 11:37:21 -0700</bug_when>
    <thetext>Lets just remove those lines of code and revisit this later if we have better ideas.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1028186</commentid>
    <comment_count>10</comment_count>
      <attachid>236368</attachid>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2014-08-11 08:37:21 -0700</bug_when>
    <thetext>Created attachment 236368
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1028415</commentid>
    <comment_count>11</comment_count>
      <attachid>236368</attachid>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2014-08-11 21:52:58 -0700</bug_when>
    <thetext>Comment on attachment 236368
Patch

r=me. Yeah, I just played with this on the tetris page and I like it much better!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1028448</commentid>
    <comment_count>12</comment_count>
      <attachid>236368</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2014-08-12 00:57:15 -0700</bug_when>
    <thetext>Comment on attachment 236368
Patch

Clearing flags on attachment: 236368

Committed r172432: &lt;http://trac.webkit.org/changeset/172432&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1028449</commentid>
    <comment_count>13</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2014-08-12 00:57:18 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>236368</attachid>
            <date>2014-08-11 08:37:21 -0700</date>
            <delta_ts>2014-08-12 00:57:15 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-132109-20140811083710.patch</filename>
            <type>text/plain</type>
            <size>2061</size>
            <attacher name="Timothy Hatcher">timothy</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTcyMzcyCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViSW5zcGVj
dG9yVUkvQ2hhbmdlTG9nIGIvU291cmNlL1dlYkluc3BlY3RvclVJL0NoYW5nZUxvZwppbmRleCA1
ZGQ1NDdhMDU0ZDUyMWNiNGViY2U2YTQ4Mzk3MDhjM2I0M2ZlYTA3Li45ZTZhZGYzMDMwNDBlYzJm
ODA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9h
ZCIgcm9vdCBwcm9maWxlIG5vZGUpLgotICAgICAgICAgICAgICAgIC8vIEZJWE1FOiBPbmx5IGRv
IHRoaXMgZm9yIHRoZSB0b3AtZG93biBtb2RlLiBEb2luZyB0aGlzIGZvciBib3R0b20tdXAgd291
bGQgYmUgaW5jb3JyZWN0LgotICAgICAgICAgICAgICAgIGlmIChyb290Tm9kZXMubGVuZ3RoID09
PSAxKQotICAgICAgICAgICAgICAgICAgICByb290Tm9kZXMgPSByb290Tm9kZXNbMF0uY2hpbGRO
b2RlczsKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgdmFyIHplcm9UaW1lID0gdGhpcy56
ZXJvVGltZTsK
</data>

          </attachment>
      

    </bug>

</bugzilla>