for-loop variable shown with wrong value in Debugger Scopes/Variables view

RESOLVED FIXED

Status

defect
RESOLVED FIXED
2 years ago
Last month

People

(Reporter: account-mozilla-bugzilla, Unassigned)

Tracking

54 Branch

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

Reporter

Description

2 years ago
Posted file example.html
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0
Build ID: 20170418123106

Steps to reproduce:

1. Open attached example.html in Firefox 53.0 or Firefox Developer Edition 54.0a2 (both affected).
2. Open Developer Tools, go to Debugger.
3. Set breakpoints in lines 7, 11, and 15 (for loops).
4. Reload to hit first breakpoint.
5. See debugger Variables/Scopes view.
6. Resume to hit next loop, see debugger Variables/Scopes view again.
7. Resume to hit last loop, see debugger Variables/Scopes view again.


Actual results:

- Variable k of second loop is shown with value 3 in debugger.
- Variable a of third loop is shown with value 7 in debugger.


Expected results:

- k should be either undefined in debugger (like in first loop) or show value after initialization with let k = 4
- a should be either undefined in debugger (like in first loop) or show value after initialization with let a = ""

Note: It seems the value shown in the Debugger is the last value of the previous for loop's variable.
Note: This bug appears even when the loop variables have different names (compare "i" of first loop with "k" of second).
Note: This bug appears even when the loop variable have different types (compare typeof k === number with typeof a === string)
Reporter

Updated

2 years ago
Component: Untriaged → Developer Tools: Debugger
Reporter

Comment 2

2 years ago
I have fiddled with the bug a bit more and found an even simpler test case that exposes it:

{
	let a = "foo";
}
{
	let b = 42; // set breakpoint here: debugger shows b == "foo"!
}

Note that _b_ is shown in the second block with the value of _a_ from the first block, even both are completely unrelated!
Definitely seeing this in Nightly as well, test case here: https://gist.github.com/clarkbw/bd45805e9498faa591dd102cae09571a

Our guess is that this is a platform or server bug
Status: UNCONFIRMED → NEW
Ever confirmed: true

Updated

Last year
Product: Firefox → DevTools

I believe this has been fixed.

https://jealous-toucan.glitch.me/

Daniel, could you verify?

Flags: needinfo?(account-mozilla-bugzilla)
Reporter

Comment 5

Last month

Hi Jason, sorry for the late reply.
I can reproduce the bug with 66.0.5 (64-bit) on Ubuntu, but not with the most recent nightly: 68.0a1 (2019-05-13) (64-Bit). So it seems fixed indeed! Thanks a lot and keep up the great work :)

Flags: needinfo?(account-mozilla-bugzilla)
Status: NEW → RESOLVED
Closed: Last month
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.