<?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>150826</bug_id>
          
          <creation_ts>2015-11-02 17:07:25 -0800</creation_ts>
          <short_desc>Web Inspector: Timeline Records Unexpected FunctionCall inside of FunctionCall</short_desc>
          <delta_ts>2026-01-12 09:01:52 -0800</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>WebKit Nightly Build</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></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="Nobody">webkit-unassigned</assigned_to>
          <cc>graouts</cc>
    
    <cc>inspector-bugzilla-changes</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1138773</commentid>
    <comment_count>0</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-11-02 17:07:25 -0800</bug_when>
    <thetext>* SUMMARY
Timeline Records Unexpected FunctionCall inside of FunctionCall.

* TEST
&lt;body&gt;
&lt;script&gt;
var observer = new MutationObserver(function alpha() {
    setTimeout(function beta() {
        console.log(&quot;whoa&quot;);
    }, 10);
});
observer.observe(document.body, {attributes: true, childList: true, characterData: true});
document.write(&quot;&lt;b&gt;Test&lt;/b&gt;&quot;);
&lt;/script&gt;

* STEPS TO REPRODUCE
1. Inspect test page
2. Show Timeline
3. Reload (needs at least one timestamp...)
4. Start recording timeline
5. Reload
6. Stop recording timeline
  =&gt; warning in console about missing FunctionCall inside of FunctionCall

* NOTES
The eventRecorded stacking looks like:

  - RenderingFrame
    - TimerFire
      - FunctionCall (with Profile)
        - FunctionCall (no Profile)
          - TimerInstall

I do find it interesting that the Profile for the Function Call has 2 root node (&quot;alpha&quot; and &quot;beta&quot;).

Given this issue, I have a feeling that this is a backend issue generating records nested incorrectly.

* PROTOCOL
    &quot;method&quot;: &quot;Timeline.eventRecorded&quot;,
    &quot;params&quot;: {
        &quot;record&quot;: {
            &quot;startTime&quot;: 0.010606311028823256,
            &quot;data&quot;: {},
            &quot;type&quot;: &quot;RenderingFrame&quot;,
            &quot;children&quot;: [{
                &quot;startTime&quot;: 0.02177164499880746,
                &quot;endTime&quot;: 0.02231149101862684,
                &quot;type&quot;: &quot;TimerFire&quot;
                &quot;children&quot;: [{
                    &quot;startTime&quot;: 0.021776599052827805,
                    &quot;endTime&quot;: 0.02230980701278895,
                    &quot;type&quot;: &quot;FunctionCall&quot;
                    &quot;data&quot;: {
                        &quot;scriptName&quot;: &quot;file:///Users/pecoraro/Desktop/function-call.html&quot;,
                        &quot;scriptLine&quot;: 5,
                        &quot;profile&quot;: {
                            &quot;rootNodes&quot;: [{
                                &quot;id&quot;: 8129808,
                                &quot;callInfo&quot;: {
                                    &quot;callCount&quot;: 1,
                                    &quot;startTime&quot;: 0.02185550204012543,
                                    &quot;endTime&quot;: 0.02203003002796322,
                                    &quot;totalTime&quot;: 0.00017452798783779144
                                },
                                &quot;functionName&quot;: &quot;beta&quot;,
                                ...
                            }, {
                                &quot;id&quot;: 4486534,
                                &quot;callInfo&quot;: {
                                    &quot;callCount&quot;: 1,
                                    &quot;startTime&quot;: 0.0220418720273301,
                                    &quot;endTime&quot;: 0.022289311047643423,
                                    &quot;totalTime&quot;: 0.00024743902031332254
                                },
                                &quot;functionName&quot;: &quot;alpha&quot;,
                                ...
                            }]
                        }
                    },
                    &quot;children&quot;: [{
                        &quot;startTime&quot;: 0.022038987022824585,
                        &quot;endTime&quot;: 0.02229272504337132,
                        &quot;type&quot;: &quot;FunctionCall&quot;
                        &quot;frameId&quot;: &quot;0.1&quot;,
                        &quot;data&quot;: {
                            &quot;scriptName&quot;: &quot;file:///Users/pecoraro/Desktop/function-call.html&quot;,
                            &quot;scriptLine&quot;: 3
                        },
                        &quot;children&quot;: [{
                            &quot;startTime&quot;: 0.022177679056767374,
                            &quot;frameId&quot;: &quot;0.1&quot;,
                            &quot;type&quot;: &quot;TimerInstall&quot;
                            &quot;stackTrace&quot;: [{
                                &quot;functionName&quot;: &quot;setTimeout&quot;,
                                &quot;url&quot;: &quot;[native code]&quot;,
                                &quot;lineNumber&quot;: 0,
                                &quot;columnNumber&quot;: 0
                            }, {
                                &quot;functionName&quot;: &quot;alpha&quot;,
                                &quot;url&quot;: &quot;file:///Users/pecoraro/Desktop/function-call.html&quot;,
                                &quot;lineNumber&quot;: 5,
                                &quot;columnNumber&quot;: 15
                            }],
                            &quot;data&quot;: {
                                &quot;timerId&quot;: 2,
                                &quot;timeout&quot;: 10,
                                &quot;singleShot&quot;: true
                            },
                        }],
                    }],
                }],
            }
            ...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1138774</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2015-11-02 17:07:58 -0800</bug_when>
    <thetext>&lt;rdar://problem/23366530&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1138778</commentid>
    <comment_count>2</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-11-02 17:14:37 -0800</bug_when>
    <thetext>* SIMPLER TEST (Just Reload)
&lt;body&gt;
&lt;script&gt;
var observer = new MutationObserver(function alpha() {
    setTimeout(function beta() {
        console.log(&quot;whoa&quot;);
    }, 1000);
});
observer.observe(document.body, {attributes: true, childList: true, characterData: true});
document.write(&quot;&lt;b&gt;Test&lt;/b&gt;&quot;);
&lt;/script&gt;

I&apos;m still not really sure what is going on.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1217020</commentid>
    <comment_count>3</comment_count>
    <who name="Blaze Burg">bburg</who>
    <bug_when>2016-08-03 11:12:09 -0700</bug_when>
    <thetext>Joe, is this bug invalid now that we have sampling profiler?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1218553</commentid>
    <comment_count>4</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2016-08-08 12:41:04 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; Joe, is this bug invalid now that we have sampling profiler?

The assertion can still happen. When viewing profile data it is not a problem. It might be possible for this to affect correlation of ScriptProfiler Event&apos;s and Timeline Event&apos;s.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>