Thu 13 Dec 2007 02:08:57 PM UTC, original submission:
The following function is not executed correctly in Gnash:
function do_test() {
var foo = [];
foo["3"] = 1;
foo["2"] = 2;
foo["1"] = 3;
trace(foo.length+" elements");
for (var bar in foo) {
foo[bar] *= _root.something;
trace("["+bar+":"+(typeof bar)+"]");
}
}
do_test();
output with proprietary player
4 elements
[1:string]
[2:string]
[3:string]
output with Gnash
17325] 15:04:11: TRACE: 4 elements
17325] 15:04:11: TRACE: [3:number]
17325] 15:04:11: TRACE: [2:number]
17325] 15:04:11: TRACE: [1:number]
17325] 15:04:11: TRACE: [0:number]
Problem 1: Gnash says the variable is a "number", it should be "string"
Problem 2: Gnash finds four elements in an array that has only three, even though also PP says it contains 4 elements !?
Problem 3: The order is wrong
Note 1: It does not matter that the code is inside a function (checked)
Note 2: I still get four trace()s with Gnash when I use numeric indexes.
Note 3: I wanted to create a testcase for a different problem where a much similar code (especially the for loop) becomes an endless loop
Note 4: the assignment to foo[bar] inside the "for" section can be removed -> still same problem
|