New issue
Advanced search Search tips

Issue 724092 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: May 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

Chrome debugger protocol inconsistency for representing boolean values

Reported by petton.n...@gmail.com, May 18 2017

Issue description

UserAgent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Steps to reproduce the problem:
1. enter `true` in the console
2. enter `var a = {b: true}; a` in the console
3. sniff the protocol for both WS frames

What is the expected behavior?

What went wrong?
In the first case, the response looks like:

{"id":319,"result":{"result":{"type":"boolean","value":true}}}

The value of the boolean is a boolean in the JSON data.

In the second case, I get:

{"type":"object","description":"Object","overflow":false,"properties":[{"name":"b","type":"boolean","value":"true"}]}

In the preview of the array, the boolean property is represented as a string.

It could be more consistent if in all cases boolean were represented as such in JSON data.

Did this work before? N/A 

Chrome version: Version 57.0.2987.133 Fedora Project (64-bit)  Channel: n/a
OS Version: Fedora 25 64bits
Flash Version:
 

Comment 1 by l...@chromium.org, May 19 2017

Owner: dgozman@chromium.org
Status: Untriaged (was: Unconfirmed)
Thanks for the report, and your interest in the protocol!  It looks like the first case is a Runtime.evaluate response that returns a {"result": RemoteObject}.  The RemoteObject's internal value is an actual value "in case of primitive values or JSON values".

In the second case after evaluating `a`, it looks like you've pasted an ObjectPreview, not a RemoteObject.  ObjectPreview properties is really an array of PropertyPreviews, which aren't meant to hold the actual contents, but just a snapshot of a few properties.  It's intended to be used only for previewing contents.

https://cs.chromium.org/chromium/src/v8/src/inspector/js_protocol.json?q=js_protocol&sq=package:chromium&dr&l=78

If you'd like to get the values of `a`'s properties, calling Runtime.getProperties on `a` would get you a result that includes PropertyDescriptors, which internally hold RemoteObjects with actual values.
Labels: Needs-Feedback
Status: Assigned (was: Untriaged)
Why did you stumble upon this? Are you trying to do something which is blocked by this? I'd like to understand the usecase to maybe adjust our future changes in this area.
I'm implementing an Emacs mode that interacts with Chrome's debugger protocol:

https://github.com/NicolasPetton/Indium

Now I understand better why there is a difference, but I still think that it's a bit inconsistent, and I don't really see why primitive values can't be sent as such in the PreviewObject.

Status: WontFix (was: Assigned)
Thank you for the explanation! I will close the issue since we are not going to change this in the short term.

Note that all previews are marked as "experimental", so they may go away in the long run. Previews are intended to be strings, since they are not communicating the properties of an object (in fact, there may be many properties missing from preview) but rather something which captures some state at the moment of reporting.

Sign in to add a comment