Open
Bug 1505304
Opened 6 years ago
Updated 2 years ago
Developer Tools - console.log(object) always shows the last content of the object in expanded object view in the console
Categories
(DevTools :: Console, defect, P2)
Tracking
(Not tracked)
ASSIGNED
People
(Reporter: marcelbay, Assigned: nchevobbe)
References
Details
Attachments
(1 file, 1 obsolete file)
(deleted),
image/png
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0 Steps to reproduce: I created a variable with an js object and printed its content to the console via console.log then changed its content serval times and after each edit i printed the content again vie console.log. (example screenshot is attached, at the top it is collapsed, and at the bottom the same output and all objects are expanded) (in my case the first output is an empty object, the second and third is the same [value is a string] and in the last output i splitted the string to an object [value is an object]) Actual results: These printed object are collapsed in the dev tools console and you see a partial view of this object. The content you see there is correct but if you expand this object to see the detailed content, you always see the content of the last version of the object. Expected results: You should see the version of the object in the expanded view from the moment the console.log is called.
Component: Untriaged → Device Permissions
OS: Unspecified → Windows 10
Hardware: Unspecified → x86
Updated•6 years ago
|
Component: General → Console
Product: Firefox → DevTools
Assignee | ||
Comment 1•6 years ago
|
||
Yes, this is a known issue (when you expand the object, we check retrieve the properties from the current object, which as you said you modified, hence causing the issue). A workaround is to clone the object before printing: `console.log(JSON.parse(JSON.stringify(myObj)))` or `console.log({...myObj})`. The drawback being that not all object are serializable (for json.stringify), or that creating a clone of the object is not straightforward (e.g. Maps, ...)
Assignee | ||
Updated•6 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P2
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 4•3 years ago
|
||
Updated•3 years ago
|
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9dfd5e6601a1 [devtools] Make watchTargets take a single object param. r=ochameau.
Backout by nbeleuzu@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9cd4e2e23e40 Backed out changeset 9dfd5e6601a1 as requested by nchevobbe
Comment 7•3 years ago
|
||
Comment on attachment 9251835 [details]
Bug 1505304 - [devtools] Make watchTargets take a single object param. r=ochameau.
Revision D131755 was moved to bug 1741811. Setting attachment 9251835 [details] to obsolete.
Attachment #9251835 -
Attachment is obsolete: true
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•