Bug 157852 - Web Inspector: console.trace should show something useful for bound functions
Summary: Web Inspector: console.trace should show something useful for bound functions
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-05-18 11:28 PDT by BJ Burg
Modified: 2016-12-13 15:39 PST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description BJ Burg 2016-05-18 11:28:53 PDT
Currently it just says [native code] as the location and doesn't try to walk up the stack any further. This is annoying.

Since console.trace has a fairly compact format, we probably just want to list the bound function's source location, and continue up the call stack to show which source location called the bound function.
Comment 1 Radar WebKit Bug Importer 2016-05-18 11:30:57 PDT
<rdar://problem/26349545>
Comment 2 Joseph Pecoraro 2016-05-18 11:54:13 PDT
* TEST
<script>
function foo() {
    bar.bind(null)();
}
function bar() {
    console.trace("inner");
}
foo();
</script>

I get:

  [Log] Trace: inner
    [f] bar (bound.html:6)
    [N] bar
    [f] foo (bound.html:3)
    [S] Global Code (bound.html:8)

So, console.trace does not stop at bound functions.

It doesn't provide a location. It could provide a location. What location should it be? The location of where the function was bound (.bind() invocation), or the location of the target function (that is already available as the next call frame).

Honestly I would have expected this:

  [Log] Trace: inner
    [f] bar (bound.html:6)
    [N] bound bar
    [f] foo (bound.html:3)
    [S] Global Code (bound.html:8)

We can probably trivially get the improved "bound bar" name when creating the trace frames.