-
Bug
-
Resolution: Fixed
-
P3
-
8
-
generic
-
generic
-
Verified
Instead of performance tips, some more bugs in NativeArray ;-)
- André
Object.defineProperty([],"length",{writable:false}).push(0)
=> should throw an exception (strict = true!)
Object.defineProperty([],"length",{writable:false}).pop()
=> should throw an exception (strict = true!)
Object.defineProperty([,,],"0",{writable:false}).reverse()
=> should throw an exception (strict = true!)
Object.defineProperty([],"length",{writable:false}).shift()
=> should throw an exception (strict = true!)
Array.prototype.sort() also calls ScriptObject#isStrictContext(), but
implementations are allowed to use a custom behaviour if array index
properties are non-writable/non-configurable. Nevertheless, I'd still
remove isStrictContext() from this method...
Object.defineProperty([],"length",{writable:false}).splice(0)
=> should throw an exception (strict = true!)
Object.defineProperty([],"length",{writable:false}).unshift()
=> should throw an exception (strict = true!)
[].concat([,]).hasOwnProperty("0")
=> should return false instead of true
a = []; a[0x7fffffff]=1; a.sort()[0]
=> should return 1 instead of undefined
(Unchecked conversion from long to int also present in
NativeArray#splice() and NativeArray#slice())
[2,1].sort(null)
=> should throw an exception (comparefn != undefined && not callable)
[2,1].sort(function(x,y){return x<y?-Infinity:x>y?Infinity:0})+""
=> should return "1,2" instead of "2,1"
- André
Object.defineProperty([],"length",{writable:false}).push(0)
=> should throw an exception (strict = true!)
Object.defineProperty([],"length",{writable:false}).pop()
=> should throw an exception (strict = true!)
Object.defineProperty([,,],"0",{writable:false}).reverse()
=> should throw an exception (strict = true!)
Object.defineProperty([],"length",{writable:false}).shift()
=> should throw an exception (strict = true!)
Array.prototype.sort() also calls ScriptObject#isStrictContext(), but
implementations are allowed to use a custom behaviour if array index
properties are non-writable/non-configurable. Nevertheless, I'd still
remove isStrictContext() from this method...
Object.defineProperty([],"length",{writable:false}).splice(0)
=> should throw an exception (strict = true!)
Object.defineProperty([],"length",{writable:false}).unshift()
=> should throw an exception (strict = true!)
[].concat([,]).hasOwnProperty("0")
=> should return false instead of true
a = []; a[0x7fffffff]=1; a.sort()[0]
=> should return 1 instead of undefined
(Unchecked conversion from long to int also present in
NativeArray#splice() and NativeArray#slice())
[2,1].sort(null)
=> should throw an exception (comparefn != undefined && not callable)
[2,1].sort(function(x,y){return x<y?-Infinity:x>y?Infinity:0})+""
=> should return "1,2" instead of "2,1"