Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

console: console exposing non-implemented methods #12675

Closed
jasnell opened this issue Apr 26, 2017 · 8 comments
Closed

console: console exposing non-implemented methods #12675

jasnell opened this issue Apr 26, 2017 · 8 comments
Labels
console Issues and PRs related to the console subsystem. inspector Issues and PRs related to the V8 inspector protocol

Comments

@jasnell
Copy link
Member

jasnell commented Apr 26, 2017

In master, console is now exposing non-implemented methods found generally on the browser side but not currently implemented in Node.js:

james@ubuntu:~/node/node$ node -v
v7.9.0
james@ubuntu:~/node/node$ node
> console.
console.__defineGetter__      console.__defineSetter__      console.__lookupGetter__      console.__lookupSetter__      console.__proto__             console.constructor           console.hasOwnProperty
console.isPrototypeOf         console.propertyIsEnumerable  console.toLocaleString        console.toString              console.valueOf

console.assert                console.dir                   console.error                 console.info                  console.log                   console.time                  console.timeEnd
console.trace                 console.warn

console.Console               console._stderr               console._stdout               console._times

> console.
> .exit
james@ubuntu:~/node/node$ ./node -v
v8.0.0-pre
james@ubuntu:~/node/node$ ./node
> console.
console.__defineGetter__      console.__defineSetter__      console.__lookupGetter__      console.__lookupSetter__      console.__proto__             console.constructor           console.hasOwnProperty
console.isPrototypeOf         console.propertyIsEnumerable  console.toLocaleString        console.toString              console.valueOf

console.assert                console.dir                   console.error                 console.info                  console.log                   console.time                  console.timeEnd
console.trace                 console.warn

console.Console               console._ignoreErrors         console._stderr               console._stderrErrorHandler   console._stdout               console._stdoutErrorHandler   console._times
console.clear                 console.count                 console.debug                 console.dirxml                console.group                 console.groupCollapsed        console.groupEnd
console.markTimeline          console.profile               console.profileEnd            console.table                 console.timeStamp             console.timeline              console.timelineEnd

> console.

For instance, typeof console.group returns function, even tho console.group() is not implemented by Node.js at all currently. Calling these appear to be non-op:

> console.group('test')
undefined
> console.groupEnd()
undefined
>

These appear to originate from V8.

@jasnell jasnell added v8.x v8 engine Issues and PRs related to the V8 dependency. and removed v8.x labels Apr 26, 2017
@vsemozhetbyt vsemozhetbyt added the console Issues and PRs related to the console subsystem. label Apr 26, 2017
@addaleax addaleax added inspector Issues and PRs related to the V8 inspector protocol and removed v8 engine Issues and PRs related to the V8 dependency. labels Apr 26, 2017
@addaleax
Copy link
Member

These are inspector things, see installInspectorConsoleIfNeeded() in bootstrap_node.js. I’m not sure, what do you think Node should do about these? I would be okay with trying to provide these extra methods on Node’s own Console class.

/cc @nodejs/v8-inspector

@SimenB
Copy link
Member

SimenB commented Apr 26, 2017

Related? #1716

@jasnell
Copy link
Member Author

jasnell commented Apr 26, 2017

@addaleax ... curious. ok. We either should be providing implementation or should not be showing them when --inspect is not being used. I'll open a PR with some basic implementations.

@hashseed
Copy link
Member

hashseed commented Apr 26, 2017

FYI V8 does ship with a console object now. It's implemented through the inspector though.

jasnell added a commit that referenced this issue Aug 2, 2017
Both are simple utility functions defined by the WHATWG
console spec (https://console.spec.whatwg.org/).

PR-URL: #12678
Ref: #12675
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
addaleax pushed a commit that referenced this issue Aug 7, 2017
Both are simple utility functions defined by the WHATWG
console spec (https://console.spec.whatwg.org/).

PR-URL: #12678
Ref: #12675
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
@Trott
Copy link
Member

Trott commented Aug 18, 2017

#14910 PR for the most minimal console.group() and console.groupEnd() implementation I could muster.

Trott added a commit to Trott/io.js that referenced this issue Aug 22, 2017
Node.js exposes `console.group()` and `console.groupEnd()` via the
inspector. These functions have no apparent effect when called from
Node.js without the inspector. We cannot easily hide them when Node.js
is started without the inspector because we support opening the
inspector during runtime via `inspector.port()`.

Implement a minimal `console.group()`/`console.groupEnd()`. More
sophisticated implementations are possible, but they can be done in
userland and/or features can be added to this at a later time. (It lacks
the `label` argument to `console.group()` right now, for example. How to
handle `label`, or even whether to handle it,  may become
a bikeshed discussion. Landing a minimal implementation first avoids the
pitfall of that discussion or a similar discussion delaying the
implementation indefinitely.)

Refs: nodejs#12675
Fixes: nodejs#1716
Trott added a commit to Trott/io.js that referenced this issue Aug 24, 2017
Node.js exposes `console.group()` and `console.groupEnd()` via the
inspector. These functions have no apparent effect when called from
Node.js without the inspector. We cannot easily hide them when Node.js
is started without the inspector because we support opening the
inspector during runtime via `inspector.port()`.

Implement a minimal `console.group()`/`console.groupEnd()`. More
sophisticated implementations are possible, but they can be done in
userland and/or features can be added to this at a later time.

`console.groupCollapsed()` is implemented as an alias for
`console.group()`.

PR-URL: nodejs#14910
Fixes: nodejs#1716
Ref: nodejs#12675
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
addaleax pushed a commit to addaleax/ayo that referenced this issue Aug 25, 2017
Node.js exposes `console.group()` and `console.groupEnd()` via the
inspector. These functions have no apparent effect when called from
Node.js without the inspector. We cannot easily hide them when Node.js
is started without the inspector because we support opening the
inspector during runtime via `inspector.port()`.

Implement a minimal `console.group()`/`console.groupEnd()`. More
sophisticated implementations are possible, but they can be done in
userland and/or features can be added to this at a later time.

`console.groupCollapsed()` is implemented as an alias for
`console.group()`.

PR-URL: nodejs/node#14910
Fixes: nodejs/node#1716
Ref: nodejs/node#12675
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
addaleax pushed a commit to ayojs/ayo that referenced this issue Aug 28, 2017
Node.js exposes `console.group()` and `console.groupEnd()` via the
inspector. These functions have no apparent effect when called from
Node.js without the inspector. We cannot easily hide them when Node.js
is started without the inspector because we support opening the
inspector during runtime via `inspector.port()`.

Implement a minimal `console.group()`/`console.groupEnd()`. More
sophisticated implementations are possible, but they can be done in
userland and/or features can be added to this at a later time.

`console.groupCollapsed()` is implemented as an alias for
`console.group()`.

PR-URL: nodejs/node#14910
Fixes: nodejs/node#1716
Ref: nodejs/node#12675
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
MylesBorins pushed a commit that referenced this issue Sep 10, 2017
Node.js exposes `console.group()` and `console.groupEnd()` via the
inspector. These functions have no apparent effect when called from
Node.js without the inspector. We cannot easily hide them when Node.js
is started without the inspector because we support opening the
inspector during runtime via `inspector.port()`.

Implement a minimal `console.group()`/`console.groupEnd()`. More
sophisticated implementations are possible, but they can be done in
userland and/or features can be added to this at a later time.

`console.groupCollapsed()` is implemented as an alias for
`console.group()`.

PR-URL: #14910
Fixes: #1716
Ref: #12675
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
MylesBorins pushed a commit that referenced this issue Sep 11, 2017
Node.js exposes `console.group()` and `console.groupEnd()` via the
inspector. These functions have no apparent effect when called from
Node.js without the inspector. We cannot easily hide them when Node.js
is started without the inspector because we support opening the
inspector during runtime via `inspector.port()`.

Implement a minimal `console.group()`/`console.groupEnd()`. More
sophisticated implementations are possible, but they can be done in
userland and/or features can be added to this at a later time.

`console.groupCollapsed()` is implemented as an alias for
`console.group()`.

PR-URL: #14910
Fixes: #1716
Ref: #12675
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
MylesBorins pushed a commit that referenced this issue Sep 11, 2017
Node.js exposes `console.group()` and `console.groupEnd()` via the
inspector. These functions have no apparent effect when called from
Node.js without the inspector. We cannot easily hide them when Node.js
is started without the inspector because we support opening the
inspector during runtime via `inspector.port()`.

Implement a minimal `console.group()`/`console.groupEnd()`. More
sophisticated implementations are possible, but they can be done in
userland and/or features can be added to this at a later time.

`console.groupCollapsed()` is implemented as an alias for
`console.group()`.

PR-URL: #14910
Fixes: #1716
Ref: #12675
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
MylesBorins pushed a commit that referenced this issue Sep 12, 2017
Node.js exposes `console.group()` and `console.groupEnd()` via the
inspector. These functions have no apparent effect when called from
Node.js without the inspector. We cannot easily hide them when Node.js
is started without the inspector because we support opening the
inspector during runtime via `inspector.port()`.

Implement a minimal `console.group()`/`console.groupEnd()`. More
sophisticated implementations are possible, but they can be done in
userland and/or features can be added to this at a later time.

`console.groupCollapsed()` is implemented as an alias for
`console.group()`.

PR-URL: #14910
Fixes: #1716
Ref: #12675
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@bengl
Copy link
Member

bengl commented Sep 20, 2017

There are still a bunch of methods that show up despite not being implemented. Would bypassing setupInspectorConsole() when --inspect/--inspect-brk aren't provided be the correct thing to do here?

There's also the case of the debugger being triggered by SIGUSR1, so maybe it makes sense to keep it there at startup in case SIGUSR1 happens. Replacing console when the signal is caught might be alright, but if anything is holding onto and using references to properties of console, then that could potentially break those use cases unless there's already some internal trickery done in Console.prototype methods to check if (1) debugging is active, and (2) this === global.console, and then in that case defer to the inspector console.

bengl added a commit to bengl/node that referenced this issue Sep 27, 2017
Also, remove undocumented (and unusable without inspector) methods from
the global console object.

Rather than having the undocumented methods on the global console, these
methods are now available on the console.inspector object.

Fixes: nodejs#12675
MylesBorins pushed a commit that referenced this issue Jan 16, 2018
Both are simple utility functions defined by the WHATWG
console spec (https://console.spec.whatwg.org/).

PR-URL: #12678
Ref: #12675
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins pushed a commit that referenced this issue Jan 17, 2018
Both are simple utility functions defined by the WHATWG
console spec (https://console.spec.whatwg.org/).

PR-URL: #12678
Ref: #12675
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins pushed a commit that referenced this issue Feb 12, 2018
Both are simple utility functions defined by the WHATWG
console spec (https://console.spec.whatwg.org/).

PR-URL: #12678
Ref: #12675
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins pushed a commit that referenced this issue Feb 13, 2018
Both are simple utility functions defined by the WHATWG
console spec (https://console.spec.whatwg.org/).

PR-URL: #12678
Ref: #12675
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
@apapirovski
Copy link
Member

@jasnell Should this remain open? As far as I can tell we've implemented some of these since and others have been documented as being inspector-only.

@jasnell
Copy link
Member Author

jasnell commented Apr 12, 2018

Should be ok to close at this point

@jasnell jasnell closed this as completed Apr 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
console Issues and PRs related to the console subsystem. inspector Issues and PRs related to the V8 inspector protocol
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants