Bug 142999

Summary: Web Inspector: ES6: Provide a better view for Classes in the console
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Joseph Pecoraro <joepeck>
Status: RESOLVED FIXED    
Severity: Normal CC: ggaren, graouts, joepeck, jonowells, mattbaker, nvasilyev, rniwa, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Proposed Fix
timothy: review+, joepeck: commit-queue-
[IMAGE] Class View none

Description Joseph Pecoraro 2015-03-23 22:55:43 PDT
* SUMMARY
Provide a better view of classes in the console when referred to by the class name / constructor function.

* TEST
If I have a "var myClass = class Foo { /* ... */ };" and I console.log(myClass) or write `myClass` in the console, I want to view the API of the class, not the constructor function. If I really want to see the function, I can `myClass.toString()`.

* NOTES
- WebKit currently just shows the toString of the constructor function
- Firefox currently shows the toString of the constructor function
- Chrome currently shows the toString of the entire class
Comment 1 Radar WebKit Bug Importer 2015-03-23 22:56:16 PDT
<rdar://problem/20271520>
Comment 2 Joseph Pecoraro 2015-03-23 23:42:17 PDT
Created attachment 249314 [details]
[PATCH] Proposed Fix

I'm hitting some mysterious crashes, but I don't know if they are my changes. Regardless I will not land this without figuring out what is causing those.
Comment 3 Joseph Pecoraro 2015-03-23 23:43:11 PDT
Created attachment 249315 [details]
[IMAGE] Class View

This is the basic class view we see right now. It is basically a re-purposed API view. Ultimately we will probably want something better to show all static functions, and all methods.
Comment 4 Timothy Hatcher 2015-03-24 05:31:39 PDT
Comment on attachment 249314 [details]
[PATCH] Proposed Fix

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

I think the "A prototype" and "B prototype" toggle buttons should say "class" in ClassAPI mode. Maybe we need a badge or type treatment for static once you have them?

> LayoutTests/inspector/model/remote-object-expected.txt:4100
> +  "_description": "ReferenceError: Can't find variable: person"

Oops?

> Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js:96
> +    ClassAPI: Symbol("object-tree--class-api"),        // API view without an object instance, can not invoke getters.

Double hyphen.
Comment 5 Joseph Pecoraro 2015-03-26 18:43:48 PDT
http://trac.webkit.org/changeset/182047