RESOLVED DUPLICATE of bug 149790149638
Web Inspector: Can't click on a stack trace link when it's in a console message preview
https://bugs.webkit.org/show_bug.cgi?id=149638
Summary Web Inspector: Can't click on a stack trace link when it's in a console messa...
Nikita Vasilyev
Reported 2015-09-29 12:57:09 PDT
Created attachment 262093 [details] [Image] Bug Steps: 1. Open stacktrace-preview.html 2. Open the console Expected: Console stack trace should have clickable source links. Line breaks should be line breaks and not "↵". Actual: Can't click on the source links and line breaks are shown as "↵". Notes: While the error object view was improved a couple of months ago, there are still cases when we don’t display stacktraces properly. We should do what Tim originally suggested, auto detect silly error.stack format and render it as a stack trace object tree instead (https://bugs.webkit.org/show_bug.cgi?id=143853#c0). That's what Chrome does, too.
Attachments
[Image] Bug (249.45 KB, image/png)
2015-09-29 12:57 PDT, Nikita Vasilyev
no flags
[HTML] Reduction (398 bytes, text/html)
2015-09-29 12:58 PDT, Nikita Vasilyev
no flags
WIP (2.19 KB, patch)
2015-10-17 21:10 PDT, Nikita Vasilyev
nvasilyev: review-
nvasilyev: commit-queue-
Radar WebKit Bug Importer
Comment 1 2015-09-29 12:57:29 PDT
Nikita Vasilyev
Comment 2 2015-09-29 12:58:42 PDT
Created attachment 262095 [details] [HTML] Reduction
Nikita Vasilyev
Comment 3 2015-10-17 21:10:08 PDT
Nikita Vasilyev
Comment 4 2015-10-17 21:18:35 PDT
Comment on attachment 263407 [details] WIP View in context: https://bugs.webkit.org/attachment.cgi?id=263407&action=review > Source/WebInspectorUI/UserInterface/Base/Main.js:2023 > + var linkStringRegEx = /(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|www\.)[\w$\-_+*'=\|\/\\(){}\[\]%@&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({%@&#~]/; [ character doesn't have to escaped here but it was driving me (and WebStorm) crazy. > Source/WebInspectorUI/UserInterface/Views/FormattedValue.css:49 > +.formatted-string, [class].formatted-string > a { "[class]" hack is used to increase rule specificity. > Source/WebInspectorUI/UserInterface/Views/FormattedValue.js:172 > + span.textContent = doubleQuotedString(displayString); This fails on console.log("blah", "a URL longer than WebInspector.FormattedValue.MAX_PREVIEW_STRING_LENGTH"). A long URL gets truncated first, which results in a wrong URL. The patch needs to be more complex than this.
Devin Rousso
Comment 5 2015-10-21 19:49:50 PDT
Comment on attachment 263407 [details] WIP View in context: https://bugs.webkit.org/attachment.cgi?id=263407&action=review >> Source/WebInspectorUI/UserInterface/Views/FormattedValue.js:172 >> + span.textContent = doubleQuotedString(displayString); > > This fails on console.log("blah", "a URL longer than WebInspector.FormattedValue.MAX_PREVIEW_STRING_LENGTH"). A long URL gets truncated first, which results in a wrong URL. > > The patch needs to be more complex than this. I am a bit confused here. If the only thing that is causing this to not work is the fact that the string is truncated before it is linkified, then why not just save the string before you modify it?
Nikita Vasilyev
Comment 6 2015-10-21 20:03:48 PDT
(In reply to comment #5) > Comment on attachment 263407 [details] > WIP > > View in context: > https://bugs.webkit.org/attachment.cgi?id=263407&action=review > > >> Source/WebInspectorUI/UserInterface/Views/FormattedValue.js:172 > >> + span.textContent = doubleQuotedString(displayString); > > > > This fails on console.log("blah", "a URL longer than WebInspector.FormattedValue.MAX_PREVIEW_STRING_LENGTH"). A long URL gets truncated first, which results in a wrong URL. > > > > The patch needs to be more complex than this. > > I am a bit confused here. If the only thing that is causing this to not > work is the fact that the string is truncated before it is linkified, then > why not just save the string before you modify it? We need to linkify first. Then we need to truncate the text. URLs shouldn't be affected, but links' text should. We wouldn't be able to use String#truncate any longer, since it operates on strings and after linkifying we'll have nodes (<a> and text nodes).
Devin Rousso
Comment 7 2015-10-22 00:20:33 PDT
(In reply to comment #6) > (In reply to comment #5) > > Comment on attachment 263407 [details] > > WIP > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=263407&action=review > > > > >> Source/WebInspectorUI/UserInterface/Views/FormattedValue.js:172 > > >> + span.textContent = doubleQuotedString(displayString); > > > > > > This fails on console.log("blah", "a URL longer than WebInspector.FormattedValue.MAX_PREVIEW_STRING_LENGTH"). A long URL gets truncated first, which results in a wrong URL. > > > > > > The patch needs to be more complex than this. > > > > I am a bit confused here. If the only thing that is causing this to not > > work is the fact that the string is truncated before it is linkified, then > > why not just save the string before you modify it? > > We need to linkify first. > Then we need to truncate the text. URLs shouldn't be affected, but links' > text should. > > We wouldn't be able to use String#truncate any longer, since it operates on > strings and after linkifying we'll have nodes (<a> and text nodes). Ah I understand now. Seems like we may need to create something like WebInspector.linkifyTruncatedStringAsFragment that will linkify and then truncate. It seems like WebInspector.linkifyStringAsFragmentWithCustomLinkifier is only ever called inside WebInspector.linkifyStringAsFragment, so maybe just add a parameter shouldTruncate and pass in the non-truncated string. Interesting situation :P
Timothy Hatcher
Comment 8 2015-12-09 16:09:51 PST
It would be good to finish this up.
Devin Rousso
Comment 9 2015-12-29 09:34:39 PST
Is this still an issue? I just tried this with the reduction file and am seeing it render with links just fine.
Joseph Pecoraro
Comment 10 2016-01-04 13:01:25 PST
Yeah, this looks like it is working now. Nikita, do you remember what fixed it?
Nikita Vasilyev
Comment 11 2016-01-05 08:59:49 PST
Bug 149790 "Web Inspector: When logging strings, detect stack traces and show them as StackTraceView" solved this.
Timothy Hatcher
Comment 12 2016-02-11 17:38:05 PST
*** This bug has been marked as a duplicate of bug 149790 ***
Note You need to log in before you can comment on or make changes to this bug.