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')
<rdar://problem/60181982>
(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 🤔
(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.
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.