Bug 142999 - Web Inspector: ES6: Provide a better view for Classes in the console
Summary: Web Inspector: ES6: Provide a better view for Classes in the console
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-03-23 22:55 PDT by Joseph Pecoraro
Modified: 2015-03-26 18:43 PDT (History)
9 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (36.31 KB, patch)
2015-03-23 23:42 PDT, Joseph Pecoraro
timothy: review+
joepeck: commit-queue-
Details | Formatted Diff | Diff
[IMAGE] Class View (75.96 KB, image/png)
2015-03-23 23:43 PDT, Joseph Pecoraro
no flags Details

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