Closed Bug 462504 Opened 16 years ago Closed 16 years ago

Looping over array values skips values if loop variable is changed

Categories

(Core :: JavaScript Engine, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 458851

People

(Reporter: jwkbugzilla, Unassigned)

References

Details

(Keywords: regression)

Got an error from one of my automated tests, managed to refine the problem to this code:

  let data = "1 2 3 4 5 6 7 8 9 10".split(" ");

  let result = [];
  for each (let entry in data)
  {
    entry = 2;
    result.push(entry);
  }
  alert(result.length + " " + data.length);

Both data and result should have the same length after this code runs - but instead I get "6 10", so four array entries have been skipped. Switching off JIT or not modifying loop variable gives the expected result - "10 10". Given that 20081027 build worked fine whereas 20081030 build shows this bug, I am guessing that this is caused by bug 450833.
dvander@hayate:src$ Linux_All_DBG.OBJ/js -j c.js
10 10

WFM in TM branch.  bug 450833 hasn't landed in mozilla-central yet.  You might be seeing bug 458851 (which has only been fixed in mozilla-central as well).
I see. Bug 458851 does look very similar - but it was reported a while ago. Did whatever caused it land in mozilla-central in the last three days?
Flags: blocking1.9.1?
This is a dup of bug 458851. What changed in m-c three days ago was the JIT being turned on by default for content.

We will sync tm and m-c today.

/be
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
Flags: blocking1.9.1? → blocking1.9.1+
You need to log in before you can comment on or make changes to this bug.