New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 646304 link

Starred by 3 users

Issue metadata

Status: WontFix
Owner:
Last visit > 30 days ago
Closed: Nov 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

Console.log not defined on Prototype

Reported by pekka201...@gmail.com, Sep 13 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.101 Safari/537.36

Steps to reproduce the problem:
1. Console.log does not work
2. Applying .method(argument) in prototype not work
3. Works only when manually force in new Proto.method(argument)

What is the expected behavior?
I want to this work

What went wrong?
Console.log, variables just not working properly

Did this work before? Yes Chrome 52

Chrome version: 53.0.2785.101  Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: Shockwave Flash 22.0 r0
 

Comment 1 by kochi@chromium.org, Sep 13 2016

Labels: Needs-Feedback
Do you have any example which any one can verify (e.g. jsbin.com)?

Components: -Blink Platform>DevTools Blink>DOM
Ok; I'm interpreting this as:

Object.getPrototypeOf(console).log

returns Undefined as opposed to a function for it.

Labels: -Needs-Feedback Hotlist-Interop
Summary: Console.log not defined on Prototype (was: Console.log does not work in Chrome 53)
Same thing happens in FireFox as well.

But in IE Object.getPrototypeOf(console).log is defined.

Comment 4 by tkent@chromium.org, Sep 30 2016

Components: -Blink>DOM Blink>Bindings

Comment 5 by bashi@chromium.org, Sep 30 2016

Owner: yukishiino@chromium.org
According to [1], the console object is [NoInterfaceObject] which means that there is no "Console" interface. IIUC, in that case there is no prototype object.

[1] https://console.spec.whatwg.org/#console-interface
[2] https://heycam.github.io/webidl/#NoInterfaceObject

I think that the current behavior is expected, but yukishiino@ should confirm.

FYI: There is a discussion of static console functions (I didn't follow it though)
https://github.com/whatwg/console/issues/3


Cc: yukishiino@chromium.org
Labels: -OS-Windows OS-All
Owner: pfeldman@chromium.org
Status: Untriaged (was: Unconfirmed)
[NoInterfaceObject] only means that the global object (e.g. |window|) does not have a property named the interface name (e.g. window.Console), and has nothing to do with the prototype object.  My understanding is that we should have console APIs on the prototype object instead of on the platform object.

IIRC, Console APIs are implemented by devtools team without using the binding code generator.

pfeldman@, could you triage this issue?
Cc: dgozman@chromium.org foolip@chromium.org
In particular: Object.getOwnPropertyNames(console) is returning all the properties, where Object.getOwnPropertyNames(Object.getPrototypeOf(console)) is returning an empty list.

Now that there's WebIDL for the console API in a spec, ideally we'd use the bindings generator for them so that the semantics really match what the spec says.  dgozman: thoughts?


Cc: domenic@chromium.org
domenic@, is https://console.spec.whatwg.org/#console-interface the latest thinking on how this should work? I assume it's not in IDL because other V8 embedders also want the same API?
No, the spec is not quite updated with the latest changes. It was blocked for a long time on adding namespaces to Web IDL, which happened recently.

The current consensus (which all non-Edge browsers follow) is that `console` is a namespace object, which means it has no prototype or constructor. Except, for legacy-compat reasons, `console.__proto__` must be an empty object, instead of being `Object.prototype`. See https://github.com/whatwg/console/issues/3#issuecomment-219549472

I can prioritize getting the spec updated if that would help people. But looking through this bug thread, I think this is working as intended and should be WontFixed.

My understanding of why this is not implemented in IDL in Blink is that the dev tools team prefers to implement things in JavaScript instead of C++?
Owner: kozyatinskiy@chromium.org
Status: Assigned (was: Untriaged)
We changed behavior recently to what domenic@ describes after the discussion linked above.

Implementation is not in IDL because it's now a part of v8-inspector, not blink.

Historically, there was never an agreement on console from different browsers, so we tried to unify with Mozilla but then changed a bit after lengthy discussion. Note there was a fix even after that, which changed console.prototype from Object.prototype to an empty object, because original behavior broke existing code. See  issue 613631 .

We can follow up with implementation once the spec is updated.
To be clear, once the spec is updated, I think the spec and Chrome will match.
Cc: kozyatinskiy@chromium.org
 Issue 621839  has been merged into this issue.
Status: WontFix (was: Assigned)
For historical web-compatibility reasons, the namespace object for console must have as its [[Prototype]] an empty object, created as if by ObjectCreate(%ObjectPrototype%), instead of %ObjectPrototype%. [1]

[1] https://console.spec.whatwg.org/#console-namespace

Sign in to add a comment