New issue
Advanced search Search tips

Issue 645053 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Dec 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug

Blocking:
issue 405845



Sign in to add a comment

Function values missing from console logged object

Reported by oliverj...@gmail.com, Sep 8 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36

Steps to reproduce the problem:
1. console.log({ foo: 1, bar: function () {} })

What is the expected behavior?
The foo *and* bar function should be displayed in the console.

What went wrong?
The bar property is not displayed.

Did this work before? N/A 

Chrome version: 52.0.2743.116  Channel: n/a
OS Version: OS X 10.11.6
Flash Version: Shockwave Flash 22.0 r0

This lead me to believe an object didn't have a value I thought it had. Very confusing. Upon expanding the object, you can see the values, but this is misleading.
 
console.png
109 KB View Download
Components: Platform>DevTools>JavaScript
Owner: l...@chromium.org
Status: Assigned (was: Unconfirmed)
True. Thx for reporting.  We should do something in the object snapshot for functions.

Attached is a screenshot of the repro. Note the absent `bar` function in the snapshot.

Then, a proposal for including the function via arrow syntax.
currently.png
13.9 KB View Download
proposed.png
16.6 KB View Download

Comment 2 by l...@chromium.org, Sep 30 2016

Blocking: 405845

Comment 3 by l...@chromium.org, Nov 2 2016

Cc: pfeldman@chromium.org
I found a related bug from last year in which a decision was made to exclude functions from previews: https://bugs.chromium.org/p/chromium/issues/detail?id=339099

From that discussion, it sounds to me that the change was made to prioritize showing only the properties that were likely to change after capturing, since the preview is just a snapshot.  Functions usually don't change, so they were removed along with proto props in that other bug.

If this is misleading, we could do Paul's proposal and sort functions to be shown last when there is space available.  Or, we could just add an ellipsis ", ..." into the preview to indicate that other things are not being shown.

WDYT?
Project Member

Comment 4 by bugdroid1@chromium.org, Nov 10 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4713c97d015f1010216edb6b785e0707b0c72dc7

commit 4713c97d015f1010216edb6b785e0707b0c72dc7
Author: luoe <luoe@chromium.org>
Date: Thu Nov 10 21:06:31 2016

DevTools: sort functions last in object previews

In the near future, injected script source will add functions to object
previews. This CL is made in preparation for that change.

BUG= 645053 

Review-Url: https://codereview.chromium.org/2486953002
Cr-Commit-Position: refs/heads/master@{#431348}

[modify] https://crrev.com/4713c97d015f1010216edb6b785e0707b0c72dc7/third_party/WebKit/Source/devtools/front_end/components/RemoteObjectPreviewFormatter.js

Comment 5 by l...@chromium.org, Dec 2 2016

Labels: Hotlist-Polish
Project Member

Comment 6 by bugdroid1@chromium.org, Dec 7 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f966eb231dae371443c32cebab8b803f84b83f4b

commit f966eb231dae371443c32cebab8b803f84b83f4b
Author: luoe <luoe@chromium.org>
Date: Wed Dec 07 18:28:48 2016

DevTools: update test expectations before V8 roll for console previews

BUG= 645053 

Review-Url: https://codereview.chromium.org/2555983002
Cr-Commit-Position: refs/heads/master@{#437012}

[modify] https://crrev.com/f966eb231dae371443c32cebab8b803f84b83f4b/third_party/WebKit/LayoutTests/TestExpectations

Comment 8 by l...@chromium.org, Dec 9 2016

Status: Fixed (was: Assigned)

Sign in to add a comment