Bug 141173 - Web Inspector: ES6: Improved Console Support for Symbol Objects
Summary: Web Inspector: ES6: Improved Console Support for Symbol Objects
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: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-02-02 14:33 PST by Joseph Pecoraro
Modified: 2015-02-04 19:15 PST (History)
9 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (12.98 KB, patch)
2015-02-03 19:05 PST, Joseph Pecoraro
timothy: review+
Details | Formatted Diff | Diff
[IMAGE] Symbol Appearance (100.04 KB, image/png)
2015-02-03 19:05 PST, 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-02-02 14:33:31 PST
* SUMMARY
JSC got ES6 Symbol support in: http://trac.webkit.org/changeset/179429

We should do a good job with Symbols in the Console.

  (1) Formatting Symbol Objects

      js> Symbol("test")
      ACTUAL => Symbol
      EXPECT => Symbol(test)

  (2) Showing Symbol properties on Objects

      js> var o = {}; o[Symbol("test")] = 1; o;
      ACTUAL => {}
      EXPECT => {Symbol("test"): 1}

Note, for (2) we may need Object.getOwnPropertySymbols, which doesn't look like JSC has yet.

Anything else that might be useful for Symbols?
Comment 1 Radar WebKit Bug Importer 2015-02-02 14:34:03 PST
<rdar://problem/19690733>
Comment 2 Joseph Pecoraro 2015-02-02 14:40:21 PST
Note inspector is already complaining in a few places that it doesn't know about symbols, since it is a new default type:

    js> typeof Symbol("test")
    "symbol"

I'll probably have to look into this sooner than later!
Comment 3 Joseph Pecoraro 2015-02-02 14:46:14 PST
>   (2) Showing Symbol properties on Objects
> 
>       js> var o = {}; o[Symbol("test")] = 1; o;
>       ACTUAL => {}
>       EXPECT => {Symbol("test"): 1}

Err, the EXPECT should have been {Symbol(test): 1}
Comment 4 Joseph Pecoraro 2015-02-02 14:49:35 PST
Another note about Symbols:

    js> "" + Symbol("test")
    TypeError: Type error

However, String() works:

    js> String(Symbol("test"))
    "Symbol(test)"

So we likely have to update InjectedScriptSource's stringification to use String() or move away from (""+o).
Comment 5 Joseph Pecoraro 2015-02-03 19:05:16 PST
Created attachment 246006 [details]
[PATCH] Proposed Fix

This handles (1). I'll have to address (2) "symbol properties on objects" separately. Ideally once we get Object.getOwnPropertySymbols in JavaScriptCore.
Comment 6 Joseph Pecoraro 2015-02-03 19:05:50 PST
Created attachment 246007 [details]
[IMAGE] Symbol Appearance
Comment 7 Joseph Pecoraro 2015-02-04 19:15:42 PST
http://trac.webkit.org/changeset/179659

Part (2) to be covered by bug 141279:
<https://webkit.org/b/141279> Web Inspector: ES6: Show Symbol properties on Objects