Closed
Bug 1362403
Opened 7 years ago
Closed 7 years ago
step in for...in loop jumps out of loop instead of next iteration
Categories
(DevTools :: Debugger, defect)
Tracking
(firefox55 fixed)
VERIFIED
FIXED
Firefox 55
Tracking | Status | |
---|---|---|
firefox55 | --- | fixed |
People
(Reporter: account-mozilla-bugzilla, Assigned: tromey)
References
Details
Attachments
(3 files)
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 10, 15, and 20. 4. Reload to hit first breakpoint. 5. Click "Step In" once Actual results: - Debugger pauses at line 14 (after for...in loop!) - Console shows output of three iterations ("for ... in 1", "for ... in 2", and "for ... in 3") Expected results: - Debugger should pause at line 10 again for next iteration - Console should show output only of first iteration after one step ("for ... in 1")
Reporter | ||
Comment 1•7 years ago
|
||
Reporter | ||
Comment 2•7 years ago
|
||
Note that the stepIn behavior in for...in loop is inconsistent with: 1. Breakpoints in for...in loop: A breakpoint on line 15 is hit 3 times when resuming execution, once per loop iteration. This is expected and correct. 2. Stepping and Breakpoints in for...of loop: stepIn on line 20 correctly executes only one iteration. We need to step multiple times to execute all iterations. This can also be seen in the video capture (see attachment 2 [details] [diff] [review]).
Reporter | ||
Updated•7 years ago
|
Component: Untriaged → Developer Tools: Debugger
Version: 53 Branch → 54 Branch
Assignee | ||
Updated•7 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 3•7 years ago
|
||
Thanks for the helpful videos. This helps explain the issue really well.
Assignee | ||
Comment 4•7 years ago
|
||
For me there is no difference between the first and second loops; only the third one works.
Assignee | ||
Comment 5•7 years ago
|
||
The problem with the for-in is that the loopentry is not marked as being in the "for" line. The loop looks like: 00017: goto 58 (+41) # ITER undefined # from ifeq @ 00063 00022: loophead # ITER MOREITER 00023: setlocal 1 # ITER MOREITER 00027: getgname "console" # ITER MOREITER console 00032: dup # ITER MOREITER console console 00033: callprop "log" # ITER MOREITER console console.log 00038: swap # ITER MOREITER console.log console 00039: string "for ... in " # ITER MOREITER console.log console "for ... in " 00044: getlocal 0 # ITER MOREITER console.log console "for ... in " array 00048: getlocal 1 # ITER MOREITER console.log console "for ... in " array prop1 00052: getelem # ITER MOREITER console.log console "for ... in " array[prop1] 00053: add # ITER MOREITER console.log console ("for ... in " + array[prop1]) 00054: call-ignores-rv 1 # ITER MOREITER console.log(...) 00057: pop # ITER MOREITER # from goto @ 00017 00058: loopentry 129 # ITER undefined And the line table says: ofs line pc delta desc args [...] 6: 4 17 [ 7] for-in closingjump 46 8: 4 23 [ 6] colspan 7 10: 4 27 [ 4] newline 11: 5 27 [ 0] colspan 4 13: 5 71 [ 44] xdelta That is, PC=58 is still marked as line 5 (which in my copy of the test is the console.log).
Comment hidden (mozreview-request) |
Comment 8•7 years ago
|
||
mozreview-review |
Comment on attachment 8864948 [details] Bug 1362403 - update source coordinates after emitting loop bodies; https://reviewboard.mozilla.org/r/136594/#review139700 Gorgeous! And a great test.
Attachment #8864948 -
Flags: review?(jimb) → review+
Pushed by ttromey@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3e44cbaec84b update source coordinates after emitting loop bodies; r=jimb
Comment 10•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/3e44cbaec84b
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
Comment 11•7 years ago
|
||
I have successfully reproduced the bug in firefox Nightly 55.0a1 (2017-05-05) (32-bit) with windows 10 (32 bit) Verified as fixed with latest nightly 55.0a1 (2017-05-17) (32-bit) Build ID: 20170517030204 Mozilla/5.0 (Windows NT 10.0; rv:55.0) Gecko/20100101 Firefox/55.0
QA Whiteboard: [bugday-20170517]
Comment 12•7 years ago
|
||
I have reproduced this bug with Nightly 55.0a1 (2017-04-18) (64-bit) in Ubuntu 16.04! This bug's fix is now verified with latest Nightly! Build ID : 20170518100156 User Agent : Mozilla/5.0 (X11; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0
Comment 13•7 years ago
|
||
As per Comment 11 & Comment 12, I am marking this bug as verified fixed.
Status: RESOLVED → VERIFIED
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•