Issue 116: function return value when accessing/setting array is not
consistent with other JS engines
http://code.google.com/p/v8/issues/detail?id=116
New issue report by 280lifestyle:
When assigning a value to a array as part of the return from a function,
the results are not consistent with other web browsers. The full example is
attached, here is a quick overview:
var testCache = {};
var doLookup = function(id) {
// If 'id' is an array, then testCache is returned (although the
assignment happens properly).
// If 'id' is a number, then testCache[id] is returned (and the
assignment also happens properly).
// Without the assigment of 'foo', testCache[id] is always returned,
although this should not impact the lookup behavior.
return testCache[id] = 'foo';
};
var r2 = doLookup(0);
var r1 = doLookup([0]);
// Safari3 output:
// Pass = true
// r1 === testCache: false
// r1 = foo, r1[0] = f
// r2 = foo, r2[0] = f
// Firefox (3) output:
// Pass = true
// r1 === testCache: false
// r1 = foo, r1[0]=f
// r2 = foo, r2[0]=f
// v8 output (0.3.4 and 0.3.5):
// Pass = false
// r1 === testCache: true
// r1 = [object Object], r1[0]=foo
// r2 = foo, r2[0]=f
The problem seems to be in the value passed in as the array index. This
issue shows up inside the prototype library, for example.
Attachments:
return-call-failure.html 1.3 KB
Issue attributes:
Status: New
Owner: ----
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---