Bug 208758
| Summary: | JSContext Inspector: CommandLineAPI `dir({a:1})` does not work - undefined is not an object (evaluating 'inspectedGlobalObject.console.dir') | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Joseph Pecoraro <joepeck> |
| Component: | Web Inspector | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED INVALID | ||
| Severity: | Normal | CC: | hi, inspector-bugzilla-changes, joepeck, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | All | ||
| OS: | All | ||
Joseph Pecoraro
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/60181982>
Devin Rousso
(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
(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
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.