« Bugzilla Issues Index

#1454 — Invalid test? S15.4.4.4_A3_T1


The third test is erroneous.
Array.prototype[1] = 1;
var x = [0];
x.length = 2;
var arr = x.concat();

After this prep code, arr is an array that has a '0' own property and length 2, so "arr.hasOwnProperty('1')" should evaluates to false according to spec.
So the test (arr.hasOwnProperty('1') !== true) erroneously evaluates to true (because false !== true <=> true)

To fix the test, turn "!== true" to "!== false"

TEST: TestCases/ch15/15.4/15.4.4/
TEST SUITE DATE: 2013-03-24
PLATFORM: Mozilla/5.0 (X11; Linux x86_64; rv:23.0) Gecko/20130426 Firefox/23.0
ERROR: Error: Unexpected exception, "uncaught exception: Test262 Error: #3: Array.prototype[1] = 1; x = [0]; x.length = 2; var arr = x.concat(); arr.hasOwnProperty('1') === true. Actual: false" was thrown.

(ES5.1), step 5.b.iii.2 uses [[HasProperty]] which includes prototype chain look-up. That means the property created in `Array.prototype[1] = 1` will be used as a new, own property for the resulting array.

So the test is _not_ invalid.

Testcase is valid as André points out.

Step 5.b.iii.2 becomes active for this test as step 5.b evaluates true since the 'item' that is being inspected is an Array. (9.9 ToObject() on an Array will return the Array object without conversion)