Bug 93019

Summary: Web Inspector: WebInspector.linkifyStringAsFragment gives wrong typeof lineNumber
Product: WebKit Reporter: johnjbarton <johnjbarton>
Component: Web Inspector (Deprecated)Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: apavlov, bweinstein, joepeck, keishi, loislo, pfeldman, pmuellr, rik, timothy, webkit.review.bot, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description johnjbarton 2012-08-02 12:40:09 PDT
User reported issue is upstream:
Issue 135493:	[DevTools] Links to source locations from stacktraces do not work.
http://code.google.com/p/chromium/issues/detail?id=135493

The test case writes
 
Error: The original error
    at triggerError (http://fiddle.jshell.net/Ad2Rr/4/show/:22:11)
    at HTMLButtonElement.onclick (http://fiddle.jshell.net/Ad2Rr/4/show/:36:121) 

into the console and the text goes through WebInspector.linkifyStringAsFragment. That calls WebInspector.linkifyStringAsFragmentWithCustomLinkifier() with a custom linkifier that is supposed to accept a string arg for lineNumber. However that linkifier function treats the lineNumber as a number.
Comment 1 johnjbarton 2012-08-02 12:53:21 PDT
Created attachment 156144 [details]
Patch
Comment 2 Vsevolod Vlasov 2012-08-03 00:26:09 PDT
Comment on attachment 156144 [details]
Patch

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

> Source/WebCore/inspector/front-end/ResourceUtils.js:-251
> -            urlNode.lineNumber = lineNumber;

linkifier function is passed to linkifyStringAsFragmentWithCustomLinkifier as a parameter. I think we should fix linkifyStringAsFragmentWithCustomLinkifier instead to always pass the number to linkifier.

> LayoutTests/inspector/debugger/linkifier.html:44
> +        var linkifyMe = "at triggerError (http://fiddle.jshell.net/Ad2Rr/4/show/:22:11)";

nit: This real life url is distracting, I would use something like http://localhost/:22:11 instead.
Comment 3 johnjbarton 2012-08-03 09:53:06 PDT
Created attachment 156403 [details]
Patch
Comment 4 Pavel Feldman 2012-08-06 06:20:23 PDT
Comment on attachment 156403 [details]
Patch

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

> Source/WebCore/inspector/front-end/ResourceUtils.js:210
> +            lineNumber = parseInt(lineColumnMatch[1]);

Nit: we explicitly say parseInt(foo, 10) to make closure compiler happy.
Comment 5 johnjbarton 2012-08-06 11:31:52 PDT
Created attachment 156730 [details]
Patch
Comment 6 WebKit Review Bot 2012-08-06 12:04:47 PDT
Comment on attachment 156730 [details]
Patch

Clearing flags on attachment: 156730

Committed r124792: <http://trac.webkit.org/changeset/124792>
Comment 7 WebKit Review Bot 2012-08-06 12:04:51 PDT
All reviewed patches have been landed.  Closing bug.