Bug 188946

Summary: console.log() shows (anonymous function) instead of the passed string when a certain format is used
Product: WebKit Reporter: Alicia Boya García <aboya>
Component: Web InspectorAssignee: Devin Rousso <hi>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, commit-queue, ews-watchlist, fitzgen, hi, inspector-bugzilla-changes, joepeck, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Screenshot of the problem in action
none
Patch
none
Patch
none
Archive of layout-test-results from ews103 for mac-sierra
none
Archive of layout-test-results from ews114 for mac-sierra
none
Archive of layout-test-results from ews106 for mac-sierra-wk2
none
Patch
none
Archive of layout-test-results from ews107 for mac-sierra-wk2
none
Patch none

Description Alicia Boya García 2018-08-25 12:00:24 PDT
Created attachment 348079 [details]
Screenshot of the problem in action

How to reproduce:

Run the following code:

console.log("video:1:2");
console.log("video/mp4:1:2");
console.log("video/mp4 : 00:04:42-00:04:44");

Expected output:

video:1:2
video/mp4:1:2
video/mp4 : 00:04:42-00:04:44

Actual output:

[f] video:1:2
[N] (anonymous function)
[N] (anonymous function)

What's going on?

The issue also reproduces when evaluating strings directly in the console, but not when they are enclosed in an array.
Comment 1 Joseph Pecoraro 2018-08-25 12:55:58 PDT
This seems like a heuristic gone bad! I think this is the "attempt to detect a callstack" code. That should probably only work if it seems multiple potential frames, not one.
Comment 2 Alicia Boya García 2018-08-25 14:50:35 PDT
(In reply to Joseph Pecoraro from comment #1)
> This seems like a heuristic gone bad! I think this is the "attempt to detect
> a callstack" code. That should probably only work if it seems multiple
> potential frames, not one.

Does it think it's a Error.stack and is trying to be helpful? How does that work, given that JSC `Error.stack` does not include line numbers nor a very distinct syntax?
Comment 3 Radar WebKit Bug Importer 2018-08-27 09:23:44 PDT
<rdar://problem/43756428>
Comment 4 Devin Rousso 2018-08-28 00:36:56 PDT
Created attachment 348271 [details]
Patch
Comment 5 Devin Rousso 2018-08-28 00:44:59 PDT
Created attachment 348272 [details]
Patch

Just saw Joe's comment.  Added another condition relating to the number of lines/frames.
Comment 6 EWS Watchlist 2018-08-28 01:36:44 PDT Comment hidden (obsolete)
Comment 7 EWS Watchlist 2018-08-28 01:36:46 PDT Comment hidden (obsolete)
Comment 8 EWS Watchlist 2018-08-28 02:30:20 PDT Comment hidden (obsolete)
Comment 9 EWS Watchlist 2018-08-28 02:30:22 PDT Comment hidden (obsolete)
Comment 10 EWS Watchlist 2018-08-28 02:33:13 PDT Comment hidden (obsolete)
Comment 11 EWS Watchlist 2018-08-28 02:33:15 PDT Comment hidden (obsolete)
Comment 12 Devin Rousso 2018-08-28 10:05:19 PDT
Created attachment 348303 [details]
Patch
Comment 13 EWS Watchlist 2018-08-28 11:58:43 PDT Comment hidden (obsolete)
Comment 14 EWS Watchlist 2018-08-28 11:58:45 PDT Comment hidden (obsolete)
Comment 15 BJ Burg 2018-08-28 14:52:42 PDT
Comment on attachment 348303 [details]
Patch

Code change seems fine, but you need to add new coverage to LayoutTests/inspector/console/js-isLikelyStackTrace.html
Comment 16 Devin Rousso 2018-08-28 15:48:28 PDT
Created attachment 348356 [details]
Patch
Comment 17 BJ Burg 2018-08-28 15:51:25 PDT
Comment on attachment 348356 [details]
Patch

r=me (wait for EWS)
Comment 18 WebKit Commit Bot 2018-08-28 18:36:45 PDT
Comment on attachment 348356 [details]
Patch

Clearing flags on attachment: 348356

Committed r235452: <https://trac.webkit.org/changeset/235452>
Comment 19 WebKit Commit Bot 2018-08-28 18:36:47 PDT
All reviewed patches have been landed.  Closing bug.
Comment 20 Joseph Pecoraro 2018-09-19 12:33:22 PDT
*** Bug 189750 has been marked as a duplicate of this bug. ***