Closed Bug 1744016 Opened 3 years ago Closed 9 months ago

cached console.* parameters are displayed with their state at the time the console opens, not when the console.* call was made

Categories

(DevTools :: Console, defect, P3)

Firefox 94
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 754861

People

(Reporter: peter.mlich, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; rv:94.0) Gecko/20100101 Firefox/94.0

Steps to reproduce:

<script>
var list;
list = [1,2,3];
console.log(list);
console.log(JSON.stringify(list));
list[list.length] = 4;
/*
13:08:41.910 Array(4) [ 1, 2, 3, 4 ]
13:08:41.910 [1,2,3]
*/
</script>

Actual results:

Array(4) [ 1, 2, 3, 4 ]
show fake values of array, array in there time not have this values

Expected results:

Array(4) [ 1, 2, 3]

The Bugbug bot thinks this bug should belong to the 'DevTools::Console' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Console
Product: Firefox → DevTools

More detailed STR:

  1. Navigate to data:text/html,<meta charset=utf8><script>var list = ["at init time"];console.log(list);console.log(JSON.stringify(list));list.push("added after log")</script>
  2. Open the console

Expected result:

the 2 console.logs are the same (["at init time"])

Actual result:

the console.log of the variable, without stringifying, also has the item added after (["at init time", "added after log"]);

Note that if you reload the page, the logs are the same then.

This is a known issue (I thought we had a bug for that, but I can't find it)

Severity: -- → S3
Priority: -- → P3
Summary: console log fake array values → cached console.* parameters are displayed with their state at the time the console opens, not when the console.* call was made

I testing function for checkboxes. Run after click on checkbox, not on program init.

list = [1,2,3]; // checked
findinlist(box, list) // write nod found
when not found, add
when found, remove

console write
time0: value = 4
time1: state array before 1,2,3,4
time2: finding state = false
time3: state array after 1,2,3,4


I found, this is may be normal console working. Link on array. But, i think, this is critical error. Not usable, because not show real snapshoot in time, which write before message.
But, in program init its this conduct too bad. If you add time stamp, state but respond state in time. Or, you not do logging in console.log.

I lose 1h for find error in console.log... Shit firefox developers. I before use Alert for tracing program or innerHTML, because need log of lot of states of cycle or sometnig on one paper.

Unfortunately this is an old time known issue.
But I'd like to do something about this.

Status: UNCONFIRMED → RESOLVED
Closed: 9 months ago
Duplicate of bug: 754861
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.