Bug 199252

Summary: Web Inspector: throw an error if console.count/console.countReset is called with an object that throws an error from toString
Product: WebKit Reporter: Devin Rousso <drousso>
Component: Web InspectorAssignee: Devin Rousso <drousso>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, drousso, ews-watchlist, inspector-bugzilla-changes, joepeck, keith_miller, mark.lam, msaboff, ryanhaddad, sbarati, tsavell, tzagallo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
URL: http://w3c-test.org/console/console-label-conversion.any.html
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Devin Rousso 2019-06-26 17:49:37 PDT
This should throw an error, but doesn't :(

```
    console.count({ toString() { throw new Error('conversion error'); } })
```
Comment 1 Devin Rousso 2019-06-26 18:20:49 PDT
Created attachment 372986 [details]
Patch
Comment 2 EWS Watchlist 2019-06-26 18:23:09 PDT Comment hidden (obsolete)
Comment 3 Devin Rousso 2019-06-26 18:24:13 PDT
Created attachment 372987 [details]
Patch
Comment 4 Joseph Pecoraro 2019-06-26 18:53:51 PDT
Comment on attachment 372987 [details]
Patch

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

r=me

> Source/JavaScriptCore/ChangeLog:13
> +        for `console.time`, `console.timeLog`, and `console.TimeEnd`. Limit the call stack to only

Nit: "TimeEnd" => "timeEnd" (multiple times in multiple ChangeLogs)

> Source/WebCore/inspector/InspectorInstrumentation.cpp:880
> -    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
> -        timelineAgent->time(frame, title);
> -    if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent())
> -        consoleAgent->startTiming(title);
> +    if (auto* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
> +        timelineAgent->time(frame, label);
> +    if (auto* consoleAgent = instrumentingAgents.webConsoleAgent())
> +        consoleAgent->startTiming(exec, label);

I find the complete types in this file more useful when you need to search for them. But auto is fine.

> Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js:183
> +        timeLog: "label = \"default\"",

Nice!
Comment 5 Devin Rousso 2019-06-27 00:41:49 PDT
Created attachment 373007 [details]
Patch
Comment 6 WebKit Commit Bot 2019-06-27 01:25:10 PDT
Comment on attachment 373007 [details]
Patch

Clearing flags on attachment: 373007

Committed r246876: <https://trac.webkit.org/changeset/246876>
Comment 7 WebKit Commit Bot 2019-06-27 01:25:12 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2019-06-27 01:33:39 PDT
<rdar://problem/52242935>
Comment 9 Truitt Savell 2019-06-27 08:56:12 PDT
Looks like the changes in https://trac.webkit.org/changeset/246876/webkit
broke inspector/worker/console-basic.html

History:
http://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=inspector%2Fworker%2Fconsole-basic.html

I was able to reproduce this locally. 

Diff:
@@ -148,7 +148,7 @@
 {
   "_source": "console-api",
   "_level": "debug",
-  "_messageText": "Global: 1",
+  "_messageText": "default: 1",
   "_type": "log",
   "_url": "inspector/worker/resources/worker-console.js",
   "_line": 21,
Comment 10 Devin Rousso 2019-06-27 09:36:21 PDT
(In reply to Truitt Savell from comment #9)
> Looks like the changes in https://trac.webkit.org/changeset/246876/webkit
> broke inspector/worker/console-basic.html
> 
> History:
> http://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.
> html#showAllRuns=true&tests=inspector%2Fworker%2Fconsole-basic.html
> 
> I was able to reproduce this locally. 
> 
> Diff:
> @@ -148,7 +148,7 @@
>  {
>    "_source": "console-api",
>    "_level": "debug",
> -  "_messageText": "Global: 1",
> +  "_messageText": "default: 1",
>    "_type": "log",
>    "_url": "inspector/worker/resources/worker-console.js",
>    "_line": 21,
Ah crap I missed a test 😅

That just needs to be rebased.  "default" is now the correct behavior.
Comment 11 Ryan Haddad 2019-06-27 11:24:16 PDT
(In reply to Devin Rousso from comment #10)
> That just needs to be rebased.  "default" is now the correct behavior.

Done in https://trac.webkit.org/r246893
Comment 12 Devin Rousso 2019-06-27 11:29:11 PDT
(In reply to Ryan Haddad from comment #11)
> (In reply to Devin Rousso from comment #10)
> > That just needs to be rebased.  "default" is now the correct behavior.
> 
> Done in https://trac.webkit.org/r246893
You "beat" me to it 😅 <https://trac.webkit.org/r246894>