RESOLVED FIXED 156566
JSContext Inspector: Improve Class instances and JSC API Exported Values view in Console / ObjectTree
https://bugs.webkit.org/show_bug.cgi?id=156566
Summary JSContext Inspector: Improve Class instances and JSC API Exported Values view...
Joseph Pecoraro
Reported 2016-04-13 19:28:04 PDT
* SUMMARY Improve Class instances and JSC API Exported Values view in Console / ObjectTree Given this example ObjC Exported class: @protocol JSBridgeExports <JSExport> @property (readonly) NSUInteger count; - (void)log:(NSString *)str; - (void)clear; - (void)test; @end @interface JSBridge : NSObject <JSBridgeExports> @end ... /* implementation */ _bridge = [[JSBridge alloc] init]; JSValue *globalObject = [_context globalObject]; globalObject[@"bridge"] = _bridge; Or the same as an ES6 Class instance: JSBridge = class JSBridge { get count() { return 1; } log(str) {} clear() {} test() {} }; bridge = new JSBridge; Currently logging this object in the console results in very little: js> bridge JSBridge {} There are a couple improvements that can be made here. All of the properties / methods of these objects are non-enumerable, which is why our UI treats them as lossless. 1. Any non-basic Object type that has a prototype should be expandable - having a non-basic prototype likely means there are methods you can use, so treat them as not lossless, to allow expanding to see the methods. 2. Special Case Native Getters to show in Preview, even if non-enumerable - This applies to the JSC API Exported @property getters, which are non-enumerable. We skipped non-enumerable properties in previews before. - This follows the existing convention we have of invoking getters if they are native because we assume they shouldn't have side-effects. - This would make the preview "JSBridge {count:#}" for the Exported API object
Attachments
[PATCH] Proposed Fix (12.24 KB, patch)
2016-04-13 19:29 PDT, Joseph Pecoraro
no flags
Joseph Pecoraro
Comment 1 2016-04-13 19:28:17 PDT
Joseph Pecoraro
Comment 2 2016-04-13 19:29:58 PDT
Created attachment 276370 [details] [PATCH] Proposed Fix
WebKit Commit Bot
Comment 3 2016-04-13 21:59:42 PDT
Comment on attachment 276370 [details] [PATCH] Proposed Fix Clearing flags on attachment: 276370 Committed r199529: <http://trac.webkit.org/changeset/199529>
WebKit Commit Bot
Comment 4 2016-04-13 21:59:45 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.