Update: This bug affects v28 and has been fixed for v29.
Having such a function:
function arrMany(len) {
var a = new Array(len);
}
If a function is called quickly, the length of the created array sometimes has the length of the previous function call.
Function extension to:
function arrMany(len, show) {
var a = new Array(len);
if (show) {
someElementTextA.value = a.length;
someElementTextB.value = len;
}
}
And a call, for example:
function tick() {
arrMany(2);
arrMany(4);
arrMany(6);
arrMany(10, true);
}
setInerval(tick, 1000 / 200);
after a while it someElementTextAshows the value 6, not 10.
When this happens, and one cancels fps to, for example, 1, it spills out the wrong length for a long time.
Behavior usually appears after about 20 seconds on my system.
Tested: Firefox Linux i686; sv: 28.0
Notes:
- No action in the browser console or web console.
- - , .
- - , .
- pt. 3. .
?
1:
Firefox, Chrome Opera. Firefox - , . .
: Window XP, Firefox v31. @jdigital - .
2:
show .
function tick() {
arrMany(2, false);
arrMany(4, false);
arrMany(6, false);
arrMany(10, true);
}
. , show .
, :
if (arr.length !== len) { arr = new Array(len); }
, . , , .
if (arr.length !== len) { arr = new Array(len); retry = 1; }
, .
( ); -. , . : retry 0.
for (retry = 0; arr.length !== len && retry < 10; ++retry) {
arr = new Array(len);
}
.
, , - , . , , , .
3:
, " ", , .
, , , , - , , . , .
, , , , .
; , , ...;)