Bug 188946 - console.log() shows (anonymous function) instead of the passed string when a certain format is used
Summary: console.log() shows (anonymous function) instead of the passed string when a ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Devin Rousso
URL:
Keywords: InRadar
: 189750 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-08-25 12:00 PDT by Alicia Boya García
Modified: 2018-09-19 12:33 PDT (History)
9 users (show)

See Also:


Attachments
Screenshot of the problem in action (16.54 KB, image/png)
2018-08-25 12:00 PDT, Alicia Boya García
no flags Details
Patch (2.11 KB, patch)
2018-08-28 00:36 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (2.32 KB, patch)
2018-08-28 00:44 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews103 for mac-sierra (2.29 MB, application/zip)
2018-08-28 01:36 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews114 for mac-sierra (3.04 MB, application/zip)
2018-08-28 02:30 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews106 for mac-sierra-wk2 (3.42 MB, application/zip)
2018-08-28 02:33 PDT, EWS Watchlist
no flags Details
Patch (2.35 KB, patch)
2018-08-28 10:05 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews107 for mac-sierra-wk2 (3.29 MB, application/zip)
2018-08-28 11:58 PDT, EWS Watchlist
no flags Details
Patch (5.04 KB, patch)
2018-08-28 15:48 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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. ***