RESOLVED INVALID208758
JSContext Inspector: CommandLineAPI `dir({a:1})` does not work - undefined is not an object (evaluating 'inspectedGlobalObject.console.dir')
https://bugs.webkit.org/show_bug.cgi?id=208758
Summary JSContext Inspector: CommandLineAPI `dir({a:1})` does not work - undefined is...
Joseph Pecoraro
Reported 2020-03-06 21:30:51 PST
CommandLineAPI `dir({a:1})` does not work - undefined is not an object (evaluating 'inspectedGlobalObject.console.dir') Something with the Basic Command Line API for JSContexts is broken. Steps to Reproduce: 1. Setup Safari to auto-inspect JSContexts 2. $ jsc --remote-debug 3. jsc> 123 4. In JSContext Inspector evaluate: dir({a:1}) => TypeError: undefined is not an object (evaluating 'inspectedGlobalObject.console.dir')
Attachments
Radar WebKit Bug Importer
Comment 1 2020-03-06 21:31:17 PST
Devin Rousso
Comment 2 2020-03-06 23:07:44 PST
(In reply to Joseph Pecoraro from comment #0) > Steps to Reproduce: > 1. Setup Safari to auto-inspect JSContexts > 2. $ jsc --remote-debug > 3. jsc> 123 > 4. In JSContext Inspector evaluate: dir({a:1}) > => TypeError: undefined is not an object (evaluating 'inspectedGlobalObject.console.dir') Interestingly, it looks like `console` and `globalThis.console` are `undefined` here too. I'm not sure how that is possible 🤔
Joseph Pecoraro
Comment 3 2020-03-06 23:58:36 PST
(In reply to Devin Rousso from comment #2) > (In reply to Joseph Pecoraro from comment #0) > > Steps to Reproduce: > > 1. Setup Safari to auto-inspect JSContexts > > 2. $ jsc --remote-debug > > 3. jsc> 123 > > 4. In JSContext Inspector evaluate: dir({a:1}) > > => TypeError: undefined is not an object (evaluating 'inspectedGlobalObject.console.dir') > > Interestingly, it looks like `console` and `globalThis.console` are > `undefined` here too. I'm not sure how that is possible 🤔 Ohhhh, this might just be `jsc` which purposely deletes `console`. This might be my mistake then.
Joseph Pecoraro
Comment 4 2020-03-07 00:01:18 PST
Yeah, my mistake. Working with a test program: ``` #import <Foundation/Foundation.h> #import <JavaScriptCore/JavaScriptCore.h> int main() { JSContext* context = [[JSContext alloc] init]; [context evaluateScript:@"1+1"]; [[NSRunLoop mainRunLoop] run]; return 0; } ``` Everything works fine. Closing.
Note You need to log in before you can comment on or make changes to this bug.