Bug 149922

Summary: Web Inspector: Stack trace view doesn't properly display lines without function names
Product: WebKit Reporter: Nikita Vasilyev <nvasilyev>
Component: Web InspectorAssignee: Nikita Vasilyev <nvasilyev>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, commit-queue, graouts, joepeck, mattbaker, nvasilyev, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
[HTML] Reduction
none
Patch
timothy: review+, nvasilyev: commit-queue-
Patch (with a test) none

Description Nikita Vasilyev 2015-10-08 04:18:44 PDT
Image: https://bugs.webkit.org/attachment.cgi?id=262414.

Note how the last line of the stack trace didn't get parsed correctly.

Expected:
(anonymous function) - error-prefix.html:27

Actual:
Full path, cannot be clicked.
Comment 1 Radar WebKit Bug Importer 2015-10-08 04:18:59 PDT
<rdar://problem/23028382>
Comment 2 Nikita Vasilyev 2015-10-08 04:24:03 PDT
Created attachment 262686 [details]
[HTML] Reduction
Comment 3 Nikita Vasilyev 2015-10-08 04:28:23 PDT
Created attachment 262687 [details]
Patch
Comment 4 Timothy Hatcher 2015-10-08 07:55:23 PDT
Comment on attachment 262687 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=262687&action=review

> Source/WebInspectorUI/UserInterface/Models/StackTrace.js:65
> +                ({url, lineNumber, columnNumber} = WebInspector.StackTrace._parseLocation(line.slice(atIndex + 1)));

Is the wrapping () needed here?

> Source/WebInspectorUI/UserInterface/Models/StackTrace.js:67
> +                ({url, lineNumber, columnNumber} = WebInspector.StackTrace._parseLocation(line));

Ditto.
Comment 5 Joseph Pecoraro 2015-10-08 11:23:36 PDT
Comment on attachment 262687 [details]
Patch

It looks like this can be tested. Can we write a test for it?
Comment 6 Nikita Vasilyev 2015-10-08 22:08:47 PDT
(In reply to comment #4)
> Comment on attachment 262687 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=262687&action=review
> 
> > Source/WebInspectorUI/UserInterface/Models/StackTrace.js:65
> > +                ({url, lineNumber, columnNumber} = WebInspector.StackTrace._parseLocation(line.slice(atIndex + 1)));
> 
> Is the wrapping () needed here?
> 
> > Source/WebInspectorUI/UserInterface/Models/StackTrace.js:67
> > +                ({url, lineNumber, columnNumber} = WebInspector.StackTrace._parseLocation(line));
> 
> Ditto.

Yes! I was surprised to discover this too.

    var x = 0;
    {x} = {x: 2}; // SyntaxError: Unexpected token '='
    console.info(x);
    
This, however, works as you'd expect:

    var {x} = {x: 2};
    console.info(x); // 2
Comment 7 Nikita Vasilyev 2015-10-08 22:10:57 PDT
Created attachment 262747 [details]
Patch (with a test)
Comment 8 WebKit Commit Bot 2015-10-08 23:02:02 PDT
Comment on attachment 262747 [details]
Patch (with a test)

Clearing flags on attachment: 262747

Committed r190780: <http://trac.webkit.org/changeset/190780>
Comment 9 WebKit Commit Bot 2015-10-08 23:02:07 PDT
All reviewed patches have been landed.  Closing bug.