summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Array/prototype/filter
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/built-ins/Array/prototype/filter
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Array/prototype/filter')
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-1.js14
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-10.js19
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-11.js21
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-12.js21
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-13.js19
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-14.js21
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-15.js22
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-2.js14
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-3.js20
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-4.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-5.js20
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-6.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-7.js17
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-8.js18
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-9.js24
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-10-1.js24
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-10-2.js26
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-10-3.js24
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-10-4.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-1.js26
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-10.js36
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-11.js32
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-12.js39
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-13.js36
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-14.js28
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-17.js22
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-18.js21
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-19.js26
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-2.js17
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-3.js32
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-4.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-5.js40
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-6.js31
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-7.js32
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-8.js39
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-9.js45
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-1.js26
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-10.js28
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-11.js26
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-12.js26
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-13.js26
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-14.js26
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-15.js26
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-16.js26
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-17.js26
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-18.js28
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-19.js30
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-2.js25
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-20.js30
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-21.js41
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-22.js43
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-23.js48
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-24.js26
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-25.js26
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-3.js25
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-4.js27
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-5.js27
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-6.js26
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-7.js25
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-9.js28
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-1.js14
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-10.js27
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-11.js31
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-12.js21
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-15.js36
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-2.js16
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-3.js14
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-4.js14
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-5.js14
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-6.js14
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-7.js16
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-8.js30
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-9.js34
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-1-s.js22
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-1.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-10.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-11.js22
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-12.js22
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-13.js22
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-14.js21
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-15.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-16.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-17.js21
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-18.js22
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-19.js28
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-2.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-21.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-22.js21
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-23.js21
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-24.js21
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-27.js15
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-28.js13
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-29.js13
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-3.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-30.js24
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-4.js28
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-5.js26
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-6.js25
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-7.js22
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-9.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-1.js18
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-2.js25
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-3.js25
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-4.js25
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-5.js25
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-6.js31
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-7.js38
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-8.js40
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-1.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-2.js29
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-3.js30
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-4.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-5.js25
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-6.js32
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-7.js28
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-8.js29
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-9.js38
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-1.js27
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-10.js34
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-11.js31
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-12.js37
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-13.js31
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-14.js31
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-15.js37
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-16.js39
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-2.js31
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-3.js33
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-4.js38
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-5.js36
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-6.js37
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-7.js35
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-8.js42
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-9.js37
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-1.js28
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-10.js29
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-11.js39
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-12.js31
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-13.js43
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-14.js36
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-15.js34
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-16.js26
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-17.js28
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-18.js27
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-19.js30
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-2.js22
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-20.js29
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-21.js31
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-22.js24
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-25.js25
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-26.js31
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-27.js34
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-28.js41
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-29.js43
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-3.js33
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-30.js37
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-31.js35
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-4.js21
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-5.js41
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-6.js26
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-7.js32
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-8.js21
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-9.js32
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-1.js27
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-10.js19
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-11.js19
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-12.js19
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-13.js19
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-16.js24
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-17.js24
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-18.js24
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-19.js27
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-2.js25
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-20.js28
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-21.js34
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-22.js34
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-23.js25
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-4.js28
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-5.js34
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-6.js29
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-7.js32
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-8.js29
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-9.js19
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-1.js25
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-2.js27
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-3.js33
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-4.js28
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-5.js29
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-6.js35
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1.js29
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-10.js20
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-11.js20
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-12.js20
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-13.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-14.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-15.js20
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-16.js20
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-17.js20
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-18.js20
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-19.js20
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-2.js26
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-20.js20
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-21.js20
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-22.js20
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-23.js20
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-24.js20
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-25.js20
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-26.js20
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-28.js22
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-29.js30
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-3.js26
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-30.js20
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-4.js28
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-5.js25
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-6.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-7.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-8.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-9.js20
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/call-with-boolean.js21
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/callbackfn-resize-arraybuffer.js74
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/create-ctor-non-object.js53
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/create-ctor-poisoned.js34
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/create-non-array.js36
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/create-proto-from-ctor-realm-array.js45
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/create-proto-from-ctor-realm-non-array.js46
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/create-proxy.js41
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/create-revoked-proxy.js46
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/create-species-abrupt.js40
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/create-species-non-ctor.js46
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/create-species-null.js35
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/create-species-poisoned.js39
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/create-species-undef.js36
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/create-species.js45
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/length.js32
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/name.js28
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/prop-desc.js23
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/shell.js161
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/target-array-non-extensible.js44
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/target-array-with-non-configurable-property.js46
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/filter/target-array-with-non-writable-property.js39
241 files changed, 6814 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-1.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-1.js
new file mode 100644
index 0000000000..353a38d2bc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-1.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter applied to undefined throws a TypeError
+---*/
+
+
+assert.throws(TypeError, function() {
+ Array.prototype.filter.call(undefined); // TypeError is thrown if value is undefined
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-10.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-10.js
new file mode 100644
index 0000000000..5b57ba7a12
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-10.js
@@ -0,0 +1,19 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter applied to the Math object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return '[object Math]' === Object.prototype.toString.call(obj);
+}
+
+Math.length = 1;
+Math[0] = 1;
+var newArr = Array.prototype.filter.call(Math, callbackfn);
+
+assert.sameValue(newArr[0], 1, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-11.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-11.js
new file mode 100644
index 0000000000..8f187eb12f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-11.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter applied to Date object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj instanceof Date;
+}
+
+var obj = new Date();
+obj.length = 1;
+obj[0] = 1;
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr[0], 1, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-12.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-12.js
new file mode 100644
index 0000000000..99a2fbb219
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-12.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter applied to RegExp object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj instanceof RegExp;
+}
+
+var obj = new RegExp();
+obj.length = 2;
+obj[1] = true;
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr[0], true, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-13.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-13.js
new file mode 100644
index 0000000000..81433b27d3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-13.js
@@ -0,0 +1,19 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter applied to the JSON object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return '[object JSON]' === Object.prototype.toString.call(JSON);
+}
+
+JSON.length = 1;
+JSON[0] = 1;
+var newArr = Array.prototype.filter.call(JSON, callbackfn);
+
+assert.sameValue(newArr[0], 1, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-14.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-14.js
new file mode 100644
index 0000000000..c92ef73121
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-14.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter applied to Error object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj instanceof Error;
+}
+
+var obj = new Error();
+obj.length = 1;
+obj[0] = 1;
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr[0], 1, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-15.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-15.js
new file mode 100644
index 0000000000..ae7b4382ce
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-15.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter applied to the Arguments object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return '[object Arguments]' === Object.prototype.toString.call(obj);
+}
+
+var obj = (function() {
+ return arguments;
+}("a", "b"));
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr[0], "a", 'newArr[0]');
+assert.sameValue(newArr[1], "b", 'newArr[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-2.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-2.js
new file mode 100644
index 0000000000..a060c4dbcb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-2.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter applied to null throws a TypeError
+---*/
+
+
+assert.throws(TypeError, function() {
+ Array.prototype.filter.call(null);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-3.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-3.js
new file mode 100644
index 0000000000..ded3e11af6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-3.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter applied to boolean primitive
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj instanceof Boolean;
+}
+
+Boolean.prototype[0] = true;
+Boolean.prototype.length = 1;
+
+var newArr = Array.prototype.filter.call(false, callbackfn);
+
+assert.sameValue(newArr[0], true, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-4.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-4.js
new file mode 100644
index 0000000000..8ee3b23f02
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-4.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter applied to Boolean Object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj instanceof Boolean;
+}
+
+var obj = new Boolean(true);
+obj.length = 2;
+obj[0] = 11;
+obj[1] = 12;
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert.sameValue(newArr[1], 12, 'newArr[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-5.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-5.js
new file mode 100644
index 0000000000..f1877b6544
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-5.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter applied to number primitive
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj instanceof Number;
+}
+
+Number.prototype[0] = 1;
+Number.prototype.length = 1;
+
+var newArr = Array.prototype.filter.call(2.5, callbackfn);
+
+assert.sameValue(newArr[0], 1, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-6.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-6.js
new file mode 100644
index 0000000000..210a2b538e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-6.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter applied to Number object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj instanceof Number;
+}
+
+var obj = new Number(-128);
+obj.length = 2;
+obj[0] = 11;
+obj[1] = 12;
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert.sameValue(newArr[1], 12, 'newArr[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-7.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-7.js
new file mode 100644
index 0000000000..fc358c7460
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-7.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter applied to string primitive
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj instanceof String;
+}
+
+var newArr = Array.prototype.filter.call("abc", callbackfn);
+
+assert.sameValue(newArr[0], "a", 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-8.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-8.js
new file mode 100644
index 0000000000..7e0ddc08d2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-8.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter applied to String object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj instanceof String;
+}
+
+var obj = new String("abc");
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr[0], "a", 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-9.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-9.js
new file mode 100644
index 0000000000..da468f6cb0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-1-9.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter applied to Function object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj instanceof Function;
+}
+
+var obj = function(a, b) {
+ return a + b;
+};
+obj[0] = 11;
+obj[1] = 9;
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert.sameValue(newArr[1], 9, 'newArr[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-10-1.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-10-1.js
new file mode 100644
index 0000000000..d69b8f89ff
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-10-1.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter doesn't mutate the Array on which it is
+ called on
+---*/
+
+function callbackfn(val, idx, obj)
+{
+ return true;
+}
+var srcArr = [1, 2, 3, 4, 5];
+srcArr.filter(callbackfn);
+
+assert.sameValue(srcArr[0], 1, 'srcArr[0]');
+assert.sameValue(srcArr[1], 2, 'srcArr[1]');
+assert.sameValue(srcArr[2], 3, 'srcArr[2]');
+assert.sameValue(srcArr[3], 4, 'srcArr[3]');
+assert.sameValue(srcArr[4], 5, 'srcArr[4]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-10-2.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-10-2.js
new file mode 100644
index 0000000000..b1e81d72ca
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-10-2.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter returns new Array with length equal to
+ number of true returned by callbackfn
+---*/
+
+function callbackfn(val, idx, obj)
+{
+ if (val % 2)
+ return true;
+ else
+ return false;
+}
+var srcArr = [1, 2, 3, 4, 5];
+var resArr = srcArr.filter(callbackfn);
+
+assert.sameValue(resArr.length, 3, 'resArr.length');
+assert.sameValue(resArr[0], 1, 'resArr[0]');
+assert.sameValue(resArr[1], 3, 'resArr[1]');
+assert.sameValue(resArr[2], 5, 'resArr[2]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-10-3.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-10-3.js
new file mode 100644
index 0000000000..ea732a2775
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-10-3.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - subclassed array when length is reduced
+---*/
+
+foo.prototype = new Array(1, 2, 3);
+
+function foo() {}
+var f = new foo();
+f.length = 1;
+
+function cb() {
+ return true;
+}
+var a = f.filter(cb);
+
+
+assert(Array.isArray(a), 'Array.isArray(a) !== true');
+assert.sameValue(a.length, 1, 'a.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-10-4.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-10-4.js
new file mode 100644
index 0000000000..417828fe76
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-10-4.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter doesn't visit expandos
+---*/
+
+var callCnt = 0;
+
+function callbackfn(val, idx, obj)
+{
+ callCnt++;
+}
+var srcArr = [1, 2, 3, 4, 5];
+srcArr["i"] = 10;
+srcArr[true] = 11;
+
+var resArr = srcArr.filter(callbackfn);
+
+assert.sameValue(callCnt, 5, 'callCnt');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-1.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-1.js
new file mode 100644
index 0000000000..48bd125ee0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-1.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter applied to Array-like object, 'length' is
+ own data property
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj.length === 2;
+}
+
+var obj = {
+ 0: 12,
+ 1: 11,
+ 2: 9,
+ length: 2
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 2, 'newArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-10.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-10.js
new file mode 100644
index 0000000000..36ccaaa6f7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-10.js
@@ -0,0 +1,36 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter applied to Array-like object, 'length' is
+ inherited accessor property
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj.length === 2;
+}
+
+var proto = {};
+
+Object.defineProperty(proto, "length", {
+ get: function() {
+ return 2;
+ },
+ configurable: true
+});
+
+var Con = function() {};
+Con.prototype = proto;
+
+var child = new Con();
+child[0] = 12;
+child[1] = 11;
+child[2] = 9;
+
+var newArr = Array.prototype.filter.call(child, callbackfn);
+
+assert.sameValue(newArr.length, 2, 'newArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-11.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-11.js
new file mode 100644
index 0000000000..5a677b381b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-11.js
@@ -0,0 +1,32 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter applied to Array-like object, 'length' is
+ own accessor property without a get function
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return true;
+}
+
+var obj = {
+ 0: 11,
+ 1: 12
+};
+Object.defineProperty(obj, "length", {
+ set: function() {},
+ configurable: true
+});
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert.sameValue(accessed, false, 'accessed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-12.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-12.js
new file mode 100644
index 0000000000..195c29d06d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-12.js
@@ -0,0 +1,39 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - 'length' is own accessor property without
+ a get function that overrides an inherited accessor property
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return true;
+}
+
+Object.defineProperty(Object.prototype, "length", {
+ get: function() {
+ return 2;
+ },
+ configurable: true
+});
+
+var obj = {
+ 0: 12,
+ 1: 11
+};
+Object.defineProperty(obj, "length", {
+ set: function() {},
+ configurable: true
+});
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert.sameValue(accessed, false, 'accessed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-13.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-13.js
new file mode 100644
index 0000000000..dac99a967d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-13.js
@@ -0,0 +1,36 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter applied to the Array-like object that
+ 'length' is inherited accessor property without a get function
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return true;
+}
+
+var proto = {};
+Object.defineProperty(proto, "length", {
+ set: function() {},
+ configurable: true
+});
+
+var Con = function() {};
+Con.prototype = proto;
+
+var child = new Con();
+child[0] = 11;
+child[1] = 12;
+
+var newArr = Array.prototype.filter.call(child, callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert.sameValue(accessed, false, 'accessed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-14.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-14.js
new file mode 100644
index 0000000000..f2d7e5e276
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-14.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter applied to the Array-like object that
+ 'length property doesn't exist
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return true;
+}
+
+var obj = {
+ 0: 11,
+ 1: 12
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert.sameValue(accessed, false, 'accessed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-17.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-17.js
new file mode 100644
index 0000000000..9250b9fbd9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-17.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter applied to the Arguments object, which
+ implements its own property get method
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj.length === 2;
+}
+
+var func = function(a, b) {
+ var newArr = Array.prototype.filter.call(arguments, callbackfn);
+ return newArr.length === 2;
+};
+
+assert(func(12, 11), 'func(12, 11) !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-18.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-18.js
new file mode 100644
index 0000000000..3660e392ad
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-18.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter applied to String object, which implements
+ its own property get method
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj.length === 3;
+}
+
+var str = new String("012");
+
+var newArr = Array.prototype.filter.call(str, callbackfn);
+
+assert.sameValue(newArr.length, 3, 'newArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-19.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-19.js
new file mode 100644
index 0000000000..876e104660
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-19.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter applied to Function object, which
+ implements its own property get method
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj.length === 2;
+}
+
+var fun = function(a, b) {
+ return a + b;
+};
+fun[0] = 12;
+fun[1] = 11;
+fun[2] = 9;
+
+var newArr = Array.prototype.filter.call(fun, callbackfn);
+
+assert.sameValue(newArr.length, 2, 'newArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-2.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-2.js
new file mode 100644
index 0000000000..b67bb19b26
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-2.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - 'length' is own data property on an Array
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj.length === 2;
+}
+
+var newArr = [12, 11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 2, 'newArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-3.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-3.js
new file mode 100644
index 0000000000..674169313a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-3.js
@@ -0,0 +1,32 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter applied to Array-like object, 'length' is
+ an own data property that overrides an inherited data property
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj.length === 2;
+}
+
+var proto = {
+ length: 3
+};
+
+var Con = function() {};
+Con.prototype = proto;
+
+var child = new Con();
+child.length = 2;
+child[0] = 12;
+child[1] = 11;
+child[2] = 9;
+
+var newArr = Array.prototype.filter.call(child, callbackfn);
+
+assert.sameValue(newArr.length, 2, 'newArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-4.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-4.js
new file mode 100644
index 0000000000..33c1bf0fc5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-4.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - 'length' is own data property that
+ overrides an inherited data property on an Array
+---*/
+
+var arrProtoLen;
+
+function callbackfn(val, idx, obj) {
+ return obj.length === 2;
+}
+
+arrProtoLen = Array.prototype.length;
+Array.prototype.length = 0;
+var newArr = [12, 11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 2, 'newArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-5.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-5.js
new file mode 100644
index 0000000000..0e3692f636
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-5.js
@@ -0,0 +1,40 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter to Array-like object, 'length' is an own
+ data property that overrides an inherited accessor property
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj.length === 2;
+}
+
+var proto = {};
+
+Object.defineProperty(proto, "length", {
+ get: function() {
+ return 3;
+ },
+ configurable: true
+});
+
+var Con = function() {};
+Con.prototype = proto;
+
+var child = new Con();
+Object.defineProperty(child, "length", {
+ value: 2,
+ configurable: true
+});
+child[0] = 12;
+child[1] = 11;
+child[2] = 9;
+
+var newArr = Array.prototype.filter.call(child, callbackfn);
+
+assert.sameValue(newArr.length, 2, 'newArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-6.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-6.js
new file mode 100644
index 0000000000..e6c242e034
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-6.js
@@ -0,0 +1,31 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter applied to Array-like object, 'length' is
+ an inherited data property
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj.length === 2;
+}
+
+var proto = {
+ length: 2
+};
+
+var Con = function() {};
+Con.prototype = proto;
+
+var child = new Con();
+child[0] = 12;
+child[1] = 11;
+child[2] = 9;
+
+var newArr = Array.prototype.filter.call(child, callbackfn);
+
+assert.sameValue(newArr.length, 2, 'newArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-7.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-7.js
new file mode 100644
index 0000000000..1cc47a52e7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-7.js
@@ -0,0 +1,32 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter applied to Array-like object, 'length' is
+ an own accessor property
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj.length === 2;
+}
+
+var obj = {};
+
+Object.defineProperty(obj, "length", {
+ get: function() {
+ return 2;
+ },
+ configurable: true
+});
+
+obj[0] = 12;
+obj[1] = 11;
+obj[2] = 9;
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 2, 'newArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-8.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-8.js
new file mode 100644
index 0000000000..739aed6976
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-8.js
@@ -0,0 +1,39 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter applied to Array-like object, 'length' is
+ own accessor property that overrides an inherited data property
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj.length === 2;
+}
+
+var proto = {
+ length: 3
+};
+
+var Con = function() {};
+Con.prototype = proto;
+
+var child = new Con();
+
+Object.defineProperty(child, "length", {
+ get: function() {
+ return 2;
+ },
+ configurable: true
+});
+
+child[0] = 12;
+child[1] = 11;
+child[2] = 9;
+
+var newArr = Array.prototype.filter.call(child, callbackfn);
+
+assert.sameValue(newArr.length, 2, 'newArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-9.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-9.js
new file mode 100644
index 0000000000..5f0a0f513b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-2-9.js
@@ -0,0 +1,45 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter applied to Array-like object, 'length' is
+ an own accessor property that overrides an inherited accessor
+ property
+---*/
+
+function callbackfn(val, idx, obj) {
+ return obj.length === 2;
+}
+
+var proto = {};
+
+Object.defineProperty(proto, "length", {
+ get: function() {
+ return 3;
+ },
+ configurable: true
+});
+
+var Con = function() {};
+Con.prototype = proto;
+
+var child = new Con();
+
+Object.defineProperty(child, "length", {
+ get: function() {
+ return 2;
+ },
+ configurable: true
+});
+
+child[0] = 12;
+child[1] = 11;
+child[2] = 9;
+
+var newArr = Array.prototype.filter.call(child, callbackfn);
+
+assert.sameValue(newArr.length, 2, 'newArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-1.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-1.js
new file mode 100644
index 0000000000..68cb7c9124
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-1.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - value of 'length' is undefined
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return true;
+}
+
+var obj = {
+ 0: 0,
+ 1: 1,
+ length: undefined
+};
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert.sameValue(accessed, false, 'accessed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-10.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-10.js
new file mode 100644
index 0000000000..4d2bb32d41
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-10.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - value of 'length' is a number (value is
+ NaN)
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return true;
+}
+
+var obj = {
+ 0: 9,
+ length: NaN
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert.sameValue(accessed, false, 'accessed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-11.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-11.js
new file mode 100644
index 0000000000..90943c5308
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-11.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - 'length' is a string containing a
+ positive number
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {
+ 1: 11,
+ 2: 9,
+ length: "2"
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-12.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-12.js
new file mode 100644
index 0000000000..8188fddfd7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-12.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - 'length' is a string containing a
+ negative number
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {
+ 1: 11,
+ 2: 9,
+ length: "-4294967294"
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert.sameValue(newArr[0], undefined, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-13.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-13.js
new file mode 100644
index 0000000000..802c761bc1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-13.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - 'length' is a string containing a decimal
+ number
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {
+ 1: 11,
+ 2: 9,
+ length: "2.5"
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-14.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-14.js
new file mode 100644
index 0000000000..5be62103ba
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-14.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - 'length' is a string containing -Infinity
+---*/
+
+var accessed2 = false;
+
+function callbackfn2(val, idx, obj) {
+ accessed2 = true;
+ return true;
+}
+
+var obj2 = {
+ 0: 9,
+ length: "-Infinity"
+};
+
+var newArr2 = Array.prototype.filter.call(obj2, callbackfn2);
+
+assert.sameValue(accessed2, false, 'accessed2');
+assert.sameValue(newArr2.length, 0, 'newArr2.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-15.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-15.js
new file mode 100644
index 0000000000..cca36b39c4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-15.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - 'length' is a string containing an
+ exponential number
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {
+ 1: 11,
+ 2: 9,
+ length: "2E0"
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-16.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-16.js
new file mode 100644
index 0000000000..29cf064b6b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-16.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - 'length' is a string containing a hex
+ number
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {
+ 1: 11,
+ 2: 9,
+ length: "0x0002"
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-17.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-17.js
new file mode 100644
index 0000000000..30b986ef1d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-17.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - 'length' is a string containing a number
+ with leading zeros
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {
+ 1: 11,
+ 2: 9,
+ length: "0002.00"
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-18.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-18.js
new file mode 100644
index 0000000000..0215e2694b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-18.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - value of 'length' is a string that can't
+ convert to a number
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return true;
+}
+
+var obj = {
+ 0: 9,
+ length: "asdf!_"
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(accessed, false, 'accessed');
+assert.sameValue(newArr.length, 0, 'newArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-19.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-19.js
new file mode 100644
index 0000000000..3ab158f710
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-19.js
@@ -0,0 +1,30 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - value of 'length' is an Object which has
+ an own toString method.
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {
+ 1: 11,
+ 2: 9,
+ length: {
+ toString: function() {
+ return '2';
+ }
+ }
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-2.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-2.js
new file mode 100644
index 0000000000..22e01265b7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-2.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter applied on an Array-like object if 'length'
+ is 1 (length overridden to true(type conversion))
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {
+ 0: 11,
+ 1: 9,
+ length: true
+};
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-20.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-20.js
new file mode 100644
index 0000000000..f90742ca90
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-20.js
@@ -0,0 +1,30 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - value of 'length' is an Object which has
+ an own valueOf method.
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {
+ 1: 11,
+ 2: 9,
+ length: {
+ valueOf: function() {
+ return 2;
+ }
+ }
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-21.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-21.js
new file mode 100644
index 0000000000..9ff6c26339
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-21.js
@@ -0,0 +1,41 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - 'length' is an object that has an own
+ valueOf method that returns an object and toString method that
+ returns a string
+---*/
+
+var firstStepOccured = false;
+var secondStepOccured = false;
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {
+ 1: 11,
+ 2: 9,
+ length: {
+ valueOf: function() {
+ firstStepOccured = true;
+ return {};
+ },
+ toString: function() {
+ secondStepOccured = true;
+ return '2';
+ }
+ }
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert(firstStepOccured, 'firstStepOccured !== true');
+assert(secondStepOccured, 'secondStepOccured !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-22.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-22.js
new file mode 100644
index 0000000000..154689a2fb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-22.js
@@ -0,0 +1,43 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter throws TypeError exception when 'length' is
+ an object with toString and valueOf methods that don�t return
+ primitive values
+---*/
+
+var accessed = false;
+var firstStepOccured = false;
+var secondStepOccured = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return true;
+}
+
+var obj = {
+ 1: 11,
+ 2: 12,
+
+ length: {
+ valueOf: function() {
+ firstStepOccured = true;
+ return {};
+ },
+ toString: function() {
+ secondStepOccured = true;
+ return {};
+ }
+ }
+};
+assert.throws(TypeError, function() {
+ Array.prototype.filter.call(obj, callbackfn);
+});
+assert.sameValue(accessed, false, 'accessed');
+assert(firstStepOccured, 'firstStepOccured !== true');
+assert(secondStepOccured, 'secondStepOccured !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-23.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-23.js
new file mode 100644
index 0000000000..b8c1c53bf7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-23.js
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter uses inherited valueOf method when 'length'
+ is an object with an own toString and inherited valueOf methods
+---*/
+
+var valueOfAccessed = false;
+var toStringAccessed = false;
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var proto = {
+ valueOf: function() {
+ valueOfAccessed = true;
+ return 2;
+ }
+};
+
+var Con = function() {};
+Con.prototype = proto;
+
+var child = new Con();
+
+child.toString = function() {
+ toStringAccessed = true;
+ return '1';
+};
+
+var obj = {
+ 1: 11,
+ 2: 9,
+ length: child
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert(valueOfAccessed, 'valueOfAccessed !== true');
+assert.sameValue(toStringAccessed, false, 'toStringAccessed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-24.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-24.js
new file mode 100644
index 0000000000..3e36d93bde
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-24.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - value of 'length' is a positive
+ non-integer, ensure truncation occurs in the proper direction
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {
+ 1: 11,
+ 2: 9,
+ length: 2.685
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-25.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-25.js
new file mode 100644
index 0000000000..7c49e457ba
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-25.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - value of 'length' is a negative
+ non-integer
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {
+ 1: 11,
+ 2: 9,
+ length: -4294967294.5
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert.sameValue(newArr[0], undefined, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-3.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-3.js
new file mode 100644
index 0000000000..1c736e81fc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-3.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - value of 'length' is a number (value is 0)
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return true;
+}
+
+var obj = {
+ 0: 11,
+ length: 0
+};
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert.sameValue(accessed, false, 'accessed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-4.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-4.js
new file mode 100644
index 0000000000..b2c07a36e1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-4.js
@@ -0,0 +1,27 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - value of 'length' is a number (value is
+ +0)
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return true;
+}
+
+var obj = {
+ 0: 11,
+ length: +0
+};
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert.sameValue(accessed, false, 'accessed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-5.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-5.js
new file mode 100644
index 0000000000..1f42a8adb7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-5.js
@@ -0,0 +1,27 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - value of 'length' is a number (value is
+ -0)
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return true;
+}
+
+var obj = {
+ 0: 11,
+ length: -0
+};
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert.sameValue(accessed, false, 'accessed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-6.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-6.js
new file mode 100644
index 0000000000..b1c1ce75a4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-6.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - value of 'length' is a number (value is
+ positive)
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {
+ 1: 11,
+ 2: 9,
+ length: 2
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-7.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-7.js
new file mode 100644
index 0000000000..d1271b8e26
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-7.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - value of 'length' is a number (value is
+ negative)
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {
+ 1: 11,
+ 2: 9,
+ length: -4294967294
+};
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert.sameValue(newArr[0], undefined, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-9.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-9.js
new file mode 100644
index 0000000000..04964b5017
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-3-9.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - value of 'length' is a number (value is
+ -Infinity)
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return true;
+}
+
+var obj = {
+ 0: 9,
+ length: -Infinity
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert.sameValue(accessed, false, 'accessed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-1.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-1.js
new file mode 100644
index 0000000000..195ff47c06
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-1.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter throws TypeError if callbackfn is undefined
+---*/
+
+var arr = new Array(10);
+assert.throws(TypeError, function() {
+ arr.filter();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-10.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-10.js
new file mode 100644
index 0000000000..d96861317d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-10.js
@@ -0,0 +1,27 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - the exception is not thrown if exception
+ was thrown by step 2
+---*/
+
+var obj = {
+ 0: 11,
+ 1: 12
+};
+
+Object.defineProperty(obj, "length", {
+ get: function() {
+ throw new Test262Error();
+ },
+ configurable: true
+});
+
+assert.throws(Test262Error, function() {
+ Array.prototype.filter.call(obj, undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-11.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-11.js
new file mode 100644
index 0000000000..a9ece8bd6e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-11.js
@@ -0,0 +1,31 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - the exception is not thrown if exception
+ was thrown by step 3
+---*/
+
+var obj = {
+ 0: 11,
+ 1: 12
+};
+
+Object.defineProperty(obj, "length", {
+ get: function() {
+ return {
+ toString: function() {
+ throw new Test262Error();
+ }
+ };
+ },
+ configurable: true
+});
+
+assert.throws(Test262Error, function() {
+ Array.prototype.filter.call(obj, undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-12.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-12.js
new file mode 100644
index 0000000000..4b7a09be3a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-12.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - 'callbackfn' is a function
+---*/
+
+function callbackfn(val, idx, obj) {
+ if (idx === 1) {
+ return val === 9;
+ }
+ return false;
+}
+
+var newArr = [11, 9].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 9, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-15.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-15.js
new file mode 100644
index 0000000000..5da546cf1b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-15.js
@@ -0,0 +1,36 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - calling with no callbackfn is the same as
+ passing undefined for callbackfn
+---*/
+
+var obj = {
+ 10: 10
+};
+var lengthAccessed = false;
+var loopAccessed = false;
+Object.defineProperty(obj, "length", {
+ get: function() {
+ lengthAccessed = true;
+ return 20;
+ },
+ configurable: true
+});
+Object.defineProperty(obj, "0", {
+ get: function() {
+ loopAccessed = true;
+ return 10;
+ },
+ configurable: true
+});
+assert.throws(TypeError, function() {
+ Array.prototype.filter.call(obj);
+});
+assert(lengthAccessed, 'lengthAccessed !== true');
+assert.sameValue(loopAccessed, false, 'loopAccessed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-2.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-2.js
new file mode 100644
index 0000000000..2cbeba24f7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-2.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter throws ReferenceError if callbackfn is
+ unreferenced
+---*/
+
+var arr = new Array(10);
+assert.throws(ReferenceError, function() {
+ arr.filter(foo);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-3.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-3.js
new file mode 100644
index 0000000000..00e84f9daa
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-3.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter throws TypeError if callbackfn is null
+---*/
+
+var arr = new Array(10);
+assert.throws(TypeError, function() {
+ arr.filter(null);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-4.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-4.js
new file mode 100644
index 0000000000..c3903d90df
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-4.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter throws TypeError if callbackfn is boolean
+---*/
+
+var arr = new Array(10);
+assert.throws(TypeError, function() {
+ arr.filter(true);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-5.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-5.js
new file mode 100644
index 0000000000..20df59f015
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-5.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter throws TypeError if callbackfn is number
+---*/
+
+var arr = new Array(10);
+assert.throws(TypeError, function() {
+ arr.filter(5);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-6.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-6.js
new file mode 100644
index 0000000000..ea86a87569
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-6.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter throws TypeError if callbackfn is string
+---*/
+
+var arr = new Array(10);
+assert.throws(TypeError, function() {
+ arr.filter("abc");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-7.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-7.js
new file mode 100644
index 0000000000..b5438a1094
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-7.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter throws TypeError if callbackfn is Object
+ without [[Call]] internal method
+---*/
+
+var arr = new Array(10);
+assert.throws(TypeError, function() {
+ arr.filter(new Object());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-8.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-8.js
new file mode 100644
index 0000000000..ee4539946c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-8.js
@@ -0,0 +1,30 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - side effects produced by step 2 are
+ visible when an exception occurs
+---*/
+
+var obj = {
+ 0: 11,
+ 1: 12
+};
+
+var accessed = false;
+
+Object.defineProperty(obj, "length", {
+ get: function() {
+ accessed = true;
+ return 2;
+ },
+ configurable: true
+});
+assert.throws(TypeError, function() {
+ Array.prototype.filter.call(obj, null);
+});
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-9.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-9.js
new file mode 100644
index 0000000000..172734d3d1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-4-9.js
@@ -0,0 +1,34 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - side effects produced by step 3 are
+ visible when an exception occurs
+---*/
+
+var obj = {
+ 0: 11,
+ 1: 12
+};
+
+var accessed = false;
+
+Object.defineProperty(obj, "length", {
+ get: function() {
+ return {
+ toString: function() {
+ accessed = true;
+ return "2";
+ }
+ };
+ },
+ configurable: true
+});
+assert.throws(TypeError, function() {
+ Array.prototype.filter.call(obj, null);
+});
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-1-s.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-1-s.js
new file mode 100644
index 0000000000..c9a8b2fdf7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-1-s.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - thisArg not passed to strict callbackfn
+flags: [noStrict]
+---*/
+
+var innerThisCorrect = false;
+
+function callbackfn(val, idx, obj) {
+ "use strict";
+ innerThisCorrect = this === undefined;
+ return true;
+}
+
+[1].filter(callbackfn);
+
+assert(innerThisCorrect, 'innerThisCorrect !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-1.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-1.js
new file mode 100644
index 0000000000..b1aa2e4d26
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-1.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - thisArg is passed
+flags: [noStrict]
+---*/
+
+(function() {
+ this._15_4_4_20_5_1 = false;
+ var _15_4_4_20_5_1 = true;
+
+ function callbackfn(val, idx, obj) {
+ return this._15_4_4_20_5_1;
+ }
+ var srcArr = [1];
+ var resArr = srcArr.filter(callbackfn);
+
+ assert.sameValue(resArr.length, 0, 'resArr.length');
+})();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-10.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-10.js
new file mode 100644
index 0000000000..57f34c4413
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-10.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - Array Object can be used as thisArg
+---*/
+
+var accessed = false;
+var objArray = new Array(10);
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return this === objArray;
+}
+
+
+var newArr = [11].filter(callbackfn, objArray);
+
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-11.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-11.js
new file mode 100644
index 0000000000..8046262733
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-11.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - String Object can be used as thisArg
+---*/
+
+var accessed = false;
+var objString = new String();
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return this === objString;
+}
+
+var newArr = [11].filter(callbackfn, objString);
+
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-12.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-12.js
new file mode 100644
index 0000000000..38088bbfa6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-12.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - Boolean Object can be used as thisArg
+---*/
+
+var accessed = false;
+var objBoolean = new Boolean();
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return this === objBoolean;
+}
+
+var newArr = [11].filter(callbackfn, objBoolean);
+
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-13.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-13.js
new file mode 100644
index 0000000000..7015603bab
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-13.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - Number Object can be used as thisArg
+---*/
+
+var accessed = false;
+var objNumber = new Number();
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return this === objNumber;
+}
+
+var newArr = [11].filter(callbackfn, objNumber);
+
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-14.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-14.js
new file mode 100644
index 0000000000..d920aeb176
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-14.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - the Math object can be used as thisArg
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return this === Math;
+}
+
+var newArr = [11].filter(callbackfn, Math);
+
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-15.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-15.js
new file mode 100644
index 0000000000..5d8633d077
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-15.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - Date Object can be used as thisArg
+---*/
+
+var accessed = false;
+
+var objDate = new Date();
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return this === objDate;
+}
+
+var newArr = [11].filter(callbackfn, objDate);
+
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-16.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-16.js
new file mode 100644
index 0000000000..cc8b0c651d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-16.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - RegExp Object can be used as thisArg
+---*/
+
+var accessed = false;
+
+var objRegExp = new RegExp();
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return this === objRegExp;
+}
+
+var newArr = [11].filter(callbackfn, objRegExp);
+
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-17.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-17.js
new file mode 100644
index 0000000000..162cec62bb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-17.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - the JSON object can be used as thisArg
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return this === JSON;
+}
+
+var newArr = [11].filter(callbackfn, JSON);
+
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-18.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-18.js
new file mode 100644
index 0000000000..4803e432ed
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-18.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - Error Object can be used as thisArg
+---*/
+
+var accessed = false;
+var objError = new RangeError();
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return this === objError;
+}
+
+var newArr = [11].filter(callbackfn, objError);
+
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-19.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-19.js
new file mode 100644
index 0000000000..fdf60d6557
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-19.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - the Arguments object can be used as
+ thisArg
+---*/
+
+var accessed = false;
+var arg;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return this === arg;
+}
+
+(function fun() {
+ arg = arguments;
+}(1, 2, 3));
+
+var newArr = [11].filter(callbackfn, arg);
+
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-2.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-2.js
new file mode 100644
index 0000000000..3049d8b4d3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-2.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - thisArg is Object
+---*/
+
+var res = false;
+var o = new Object();
+o.res = true;
+
+function callbackfn(val, idx, obj)
+{
+ return this.res;
+}
+
+var srcArr = [1];
+var resArr = srcArr.filter(callbackfn, o);
+
+assert.sameValue(resArr.length, 1, 'resArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-21.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-21.js
new file mode 100644
index 0000000000..fcee8ec25c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-21.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - the global object can be used as thisArg
+---*/
+
+var global = this;
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return this === global;
+}
+
+var newArr = [11].filter(callbackfn, global);
+
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-22.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-22.js
new file mode 100644
index 0000000000..5b66d3c755
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-22.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - boolean primitive can be used as thisArg
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return this.valueOf() === false;
+}
+
+var newArr = [11].filter(callbackfn, false);
+
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-23.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-23.js
new file mode 100644
index 0000000000..cc9a5e62e1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-23.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - number primitive can be used as thisArg
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return this.valueOf() === 101;
+}
+
+var newArr = [11].filter(callbackfn, 101);
+
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-24.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-24.js
new file mode 100644
index 0000000000..4b8f2b9eb0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-24.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - string primitive can be used as thisArg
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return this.valueOf() === "abc";
+}
+
+var newArr = [11].filter(callbackfn, "abc");
+
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-27.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-27.js
new file mode 100644
index 0000000000..f53147f35e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-27.js
@@ -0,0 +1,15 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - Array.isArray(arg) returns true when arg
+ is the returned array
+---*/
+
+var newArr = [11].filter(function() {});
+
+assert(Array.isArray(newArr), 'Array.isArray(newArr) !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-28.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-28.js
new file mode 100644
index 0000000000..e1aad658de
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-28.js
@@ -0,0 +1,13 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - the returned array is instanceof Array
+---*/
+
+var newArr = [11].filter(function() {});
+
+assert(newArr instanceof Array, 'newArr instanceof Array !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-29.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-29.js
new file mode 100644
index 0000000000..2c8a19cbac
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-29.js
@@ -0,0 +1,13 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - returns an array whose length is 0
+---*/
+
+var newArr = [11].filter(function() {});
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-3.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-3.js
new file mode 100644
index 0000000000..591e1e0c88
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-3.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - thisArg is Array
+---*/
+
+var res = false;
+var a = new Array();
+a.res = true;
+
+function callbackfn(val, idx, obj)
+{
+ return this.res;
+}
+
+var srcArr = [1];
+var resArr = srcArr.filter(callbackfn, a);
+
+assert.sameValue(resArr.length, 1, 'resArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-30.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-30.js
new file mode 100644
index 0000000000..135964229e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-30.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - thisArg not passed
+flags: [noStrict]
+---*/
+
+function innerObj() {
+ this._15_4_4_20_5_30 = true;
+ var _15_4_4_20_5_30 = false;
+
+ function callbackfn(val, idx, obj) {
+ return this._15_4_4_20_5_30;
+ }
+ var srcArr = [1];
+ var resArr = srcArr.filter(callbackfn);
+ this.retVal = resArr.length === 0;
+}
+
+assert(new innerObj().retVal, 'new innerObj().retVal !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-4.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-4.js
new file mode 100644
index 0000000000..e46344834a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-4.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-5-4
+description: >
+ Array.prototype.filter - thisArg is object from object
+ template(prototype)
+---*/
+
+var res = false;
+
+function callbackfn(val, idx, obj)
+{
+ return this.res;
+}
+
+function foo() {}
+foo.prototype.res = true;
+var f = new foo();
+
+var srcArr = [1];
+var resArr = srcArr.filter(callbackfn, f);
+
+assert.sameValue(resArr.length, 1, 'resArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-5.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-5.js
new file mode 100644
index 0000000000..1e18d25e06
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-5.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-5-5
+description: Array.prototype.filter - thisArg is object from object template
+---*/
+
+var res = false;
+
+function callbackfn(val, idx, obj)
+{
+ return this.res;
+}
+
+function foo() {}
+var f = new foo();
+f.res = true;
+
+var srcArr = [1];
+var resArr = srcArr.filter(callbackfn, f);
+
+assert.sameValue(resArr.length, 1, 'resArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-6.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-6.js
new file mode 100644
index 0000000000..2784f54252
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-6.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-5-6
+description: Array.prototype.filter - thisArg is function
+---*/
+
+var res = false;
+
+function callbackfn(val, idx, obj)
+{
+ return this.res;
+}
+
+function foo() {}
+foo.res = true;
+
+var srcArr = [1];
+var resArr = srcArr.filter(callbackfn, foo);
+
+assert.sameValue(resArr.length, 1, 'resArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-7.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-7.js
new file mode 100644
index 0000000000..76f7b0161a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-7.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-5-7
+description: Array.prototype.filter - built-in functions can be used as thisArg
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return this === eval;
+}
+
+var newArr = [11].filter(callbackfn, eval);
+
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-9.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-9.js
new file mode 100644
index 0000000000..f2be4d947a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-5-9.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-5-9
+description: Array.prototype.filter - Function Object can be used as thisArg
+---*/
+
+var accessed = false;
+var objFunction = function() {};
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return this === objFunction;
+}
+
+var newArr = [11].filter(callbackfn, objFunction);
+
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-1.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-1.js
new file mode 100644
index 0000000000..b37bd42001
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-1.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-6-1
+description: >
+ Array.prototype.filter returns an empty array if 'length' is 0
+ (empty array)
+---*/
+
+function cb() {}
+var a = [].filter(cb);
+
+assert(Array.isArray(a), 'Array.isArray(a) !== true');
+assert.sameValue(a.length, 0, 'a.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-2.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-2.js
new file mode 100644
index 0000000000..babc443f62
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-2.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-6-2
+description: >
+ Array.prototype.filter returns an empty array if 'length' is 0
+ (subclassed Array, length overridden to null (type conversion))
+---*/
+
+foo.prototype = new Array(1, 2, 3);
+
+function foo() {}
+var f = new foo();
+f.length = null;
+
+function cb() {}
+var a = f.filter(cb);
+
+
+assert(Array.isArray(a), 'Array.isArray(a) !== true');
+assert.sameValue(a.length, 0, 'a.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-3.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-3.js
new file mode 100644
index 0000000000..fa85fb3e6d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-3.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-6-3
+description: >
+ Array.prototype.filter returns an empty array if 'length' is 0
+ (subclassed Array, length overridden to false (type conversion))
+---*/
+
+foo.prototype = new Array(1, 2, 3);
+
+function foo() {}
+var f = new foo();
+f.length = false;
+
+function cb() {}
+var a = f.filter(cb);
+
+
+assert(Array.isArray(a), 'Array.isArray(a) !== true');
+assert.sameValue(a.length, 0, 'a.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-4.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-4.js
new file mode 100644
index 0000000000..da5b339473
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-4.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-6-4
+description: >
+ Array.prototype.filter returns an empty array if 'length' is 0
+ (subclassed Array, length overridden to 0 (type conversion))
+---*/
+
+foo.prototype = new Array(1, 2, 3);
+
+function foo() {}
+var f = new foo();
+f.length = 0;
+
+function cb() {}
+var a = f.filter(cb);
+
+
+assert(Array.isArray(a), 'Array.isArray(a) !== true');
+assert.sameValue(a.length, 0, 'a.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-5.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-5.js
new file mode 100644
index 0000000000..2c163c61c8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-5.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-6-5
+description: >
+ Array.prototype.filter returns an empty array if 'length' is 0
+ (subclassed Array, length overridden to '0' (type conversion))
+---*/
+
+foo.prototype = new Array(1, 2, 3);
+
+function foo() {}
+var f = new foo();
+f.length = '0';
+
+function cb() {}
+var a = f.filter(cb);
+
+
+assert(Array.isArray(a), 'Array.isArray(a) !== true');
+assert.sameValue(a.length, 0, 'a.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-6.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-6.js
new file mode 100644
index 0000000000..9284917cb5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-6.js
@@ -0,0 +1,31 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-6-6
+description: >
+ Array.prototype.filter returns an empty array if 'length' is 0
+ (subclassed Array, length overridden with obj with valueOf)
+---*/
+
+foo.prototype = new Array(1, 2, 3);
+
+function foo() {}
+var f = new foo();
+
+var o = {
+ valueOf: function() {
+ return 0;
+ }
+};
+f.length = o;
+
+function cb() {}
+var a = f.filter(cb);
+
+
+assert(Array.isArray(a), 'Array.isArray(a) !== true');
+assert.sameValue(a.length, 0, 'a.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-7.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-7.js
new file mode 100644
index 0000000000..3197dd19e9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-7.js
@@ -0,0 +1,38 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-6-7
+description: >
+ Array.prototype.filter returns an empty array if 'length' is 0
+ (subclassed Array, length overridden with obj w/o valueOf
+ (toString))
+---*/
+
+foo.prototype = new Array(1, 2, 3);
+
+function foo() {}
+var f = new foo();
+
+var o = {
+ toString: function() {
+ return '0';
+ }
+};
+f.length = o;
+
+// objects inherit the default valueOf method of the Object object;
+// that simply returns the itself. Since the default valueOf() method
+// does not return a primitive value, ES next tries to convert the object
+// to a number by calling its toString() method and converting the
+// resulting string to a number.
+
+function cb() {}
+var a = f.filter(cb);
+
+
+assert(Array.isArray(a), 'Array.isArray(a) !== true');
+assert.sameValue(a.length, 0, 'a.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-8.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-8.js
new file mode 100644
index 0000000000..08cd6176e9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-6-8.js
@@ -0,0 +1,40 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-6-8
+description: >
+ Array.prototype.filter returns an empty array if 'length' is 0
+ (subclassed Array, length overridden with []
+---*/
+
+foo.prototype = new Array(1, 2, 3);
+
+function foo() {}
+var f = new foo();
+
+f.length = [];
+
+// objects inherit the default valueOf method of the Object object;
+// that simply returns the itself. Since the default valueOf() method
+// does not return a primitive value, ES next tries to convert the object
+// to a number by calling its toString() method and converting the
+// resulting string to a number.
+//
+// The toString( ) method on Array converts the array elements to strings,
+// then returns the result of concatenating these strings, with commas in
+// between. An array with no elements converts to the empty string, which
+// converts to the number 0. If an array has a single element that is a
+// number n, the array converts to a string representation of n, which is
+// then converted back to n itself. If an array contains more than one element,
+// or if its one element is not a number, the array converts to NaN.
+
+function cb() {}
+var a = f.filter(cb);
+
+
+assert(Array.isArray(a), 'Array.isArray(a) !== true');
+assert.sameValue(a.length, 0, 'a.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-1.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-1.js
new file mode 100644
index 0000000000..005f390cc4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-1.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-1
+description: >
+ Array.prototype.filter doesn't consider new elements added to
+ array after it is called
+---*/
+
+function callbackfn(val, idx, obj) {
+ srcArr[2] = 3;
+ srcArr[5] = 6;
+ return true;
+}
+
+var srcArr = [1, 2, , 4, 5];
+var resArr = srcArr.filter(callbackfn);
+
+assert.sameValue(resArr.length, 5, 'resArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-2.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-2.js
new file mode 100644
index 0000000000..3814a7614f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-2.js
@@ -0,0 +1,29 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-2
+description: >
+ Array.prototype.filter considers new value of elements in array
+ after it is called
+---*/
+
+function callbackfn(val, idx, obj)
+{
+ srcArr[2] = -1;
+ srcArr[4] = -1;
+ if (val > 0)
+ return true;
+ else
+ return false;
+}
+
+var srcArr = [1, 2, 3, 4, 5];
+var resArr = srcArr.filter(callbackfn);
+
+assert.sameValue(resArr.length, 3, 'resArr.length');
+assert.sameValue(resArr[0], 1, 'resArr[0]');
+assert.sameValue(resArr[2], 4, 'resArr[2]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-3.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-3.js
new file mode 100644
index 0000000000..a793631f50
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-3.js
@@ -0,0 +1,30 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-3
+description: >
+ Array.prototype.filter doesn't visit deleted elements in array
+ after the call
+---*/
+
+function callbackfn(val, idx, obj)
+{
+ delete srcArr[2];
+ delete srcArr[4];
+ if (val > 0)
+ return true;
+ else
+ return false;
+}
+
+var srcArr = [1, 2, 3, 4, 5];
+var resArr = srcArr.filter(callbackfn);
+
+// two elements deleted
+assert.sameValue(resArr.length, 3, 'resArr.length');
+assert.sameValue(resArr[0], 1, 'resArr[0]');
+assert.sameValue(resArr[2], 4, 'resArr[2]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-4.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-4.js
new file mode 100644
index 0000000000..84f7a666c4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-4.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-4
+description: >
+ Array.prototype.filter doesn't visit deleted elements when
+ Array.length is decreased
+---*/
+
+function callbackfn(val, idx, obj)
+{
+ srcArr.length = 2;
+ return true;
+}
+
+var srcArr = [1, 2, 3, 4, 6];
+var resArr = srcArr.filter(callbackfn);
+
+assert.sameValue(resArr.length, 2, 'resArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-5.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-5.js
new file mode 100644
index 0000000000..4b29c8d726
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-5.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-5
+description: >
+ Array.prototype.filter doesn't consider newly added elements in
+ sparse array
+---*/
+
+function callbackfn(val, idx, obj)
+{
+ srcArr[1000] = 3;
+ return true;
+}
+
+var srcArr = new Array(10);
+srcArr[1] = 1;
+srcArr[2] = 2;
+var resArr = srcArr.filter(callbackfn);
+
+assert.sameValue(resArr.length, 2, 'resArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-6.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-6.js
new file mode 100644
index 0000000000..4086e87b1a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-6.js
@@ -0,0 +1,32 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-6
+description: >
+ Array.prototype.filter visits deleted element in array after the
+ call when same index is also present in prototype
+---*/
+
+function callbackfn(val, idx, obj)
+{
+ delete srcArr[2];
+ delete srcArr[4];
+ if (val > 0)
+ return true;
+ else
+ return false;
+}
+
+Array.prototype[4] = 5;
+var srcArr = [1, 2, 3, 4, 5];
+var resArr = srcArr.filter(callbackfn);
+delete Array.prototype[4];
+
+// only one element deleted
+assert.sameValue(resArr.length, 4, 'resArr.length');
+assert.sameValue(resArr[0], 1, 'resArr[0]');
+assert.sameValue(resArr[3], 5, 'resArr[3]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-7.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-7.js
new file mode 100644
index 0000000000..911b7bf0a0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-7.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-7
+description: >
+ Array.prototype.filter stops calling callbackfn once the array is
+ deleted during the call
+---*/
+
+var o = new Object();
+o.srcArr = [1, 2, 3, 4, 5];
+
+function callbackfn(val, idx, obj) {
+ delete o.srcArr;
+ if (val > 0)
+ return true;
+ else
+ return false;
+}
+
+var resArr = o.srcArr.filter(callbackfn);
+
+assert.sameValue(resArr.length, 5, 'resArr.length');
+assert.sameValue(typeof o.srcArr, "undefined", 'typeof o.srcArr');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-8.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-8.js
new file mode 100644
index 0000000000..36cd0cd218
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-8.js
@@ -0,0 +1,29 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-8
+description: Array.prototype.filter - no observable effects occur if len is 0
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return val > 10;
+}
+
+var obj = {
+ 0: 11,
+ 1: 12,
+ length: 0
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(accessed, false, 'accessed');
+assert.sameValue(obj.length, 0, 'obj.length');
+assert.sameValue(newArr.length, 0, 'newArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-9.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-9.js
new file mode 100644
index 0000000000..199c15d30e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-9.js
@@ -0,0 +1,38 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-9
+description: >
+ Array.prototype.filter - modifications to length don't change
+ number of iterations
+---*/
+
+var called = 0;
+
+function callbackfn(val, idx, obj) {
+ called++;
+ return true;
+}
+
+var obj = {
+ 1: 12,
+ 2: 9,
+ length: 2
+};
+
+Object.defineProperty(obj, "0", {
+ get: function() {
+ obj.length = 3;
+ return 11;
+ },
+ configurable: true
+});
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 2, 'newArr.length');
+assert.sameValue(called, 2, 'called');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-1.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-1.js
new file mode 100644
index 0000000000..dce5fdae23
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-1.js
@@ -0,0 +1,27 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-b-1
+description: >
+ Array.prototype.filter - callbackfn not called for indexes never
+ been assigned values
+---*/
+
+var callCnt = 0;
+
+function callbackfn(val, idx, obj)
+{
+ callCnt++;
+ return false;
+}
+
+var srcArr = new Array(10);
+srcArr[1] = undefined; //explicitly assigning a value
+var resArr = srcArr.filter(callbackfn);
+
+assert.sameValue(resArr.length, 0, 'resArr.length');
+assert.sameValue(callCnt, 1, 'callCnt');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-10.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-10.js
new file mode 100644
index 0000000000..bbd0c85461
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-10.js
@@ -0,0 +1,34 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-b-10
+description: >
+ Array.prototype.filter - deleting property of prototype causes
+ prototype index property not to be visited on an Array-like Object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+var obj = {
+ 2: 2,
+ length: 20
+};
+
+Object.defineProperty(obj, "0", {
+ get: function() {
+ delete Object.prototype[1];
+ return 0;
+ },
+ configurable: true
+});
+
+Object.prototype[1] = 1;
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 2, 'newArr.length');
+assert.notSameValue(newArr[1], 1, 'newArr[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-11.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-11.js
new file mode 100644
index 0000000000..5b16c7f308
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-11.js
@@ -0,0 +1,31 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-b-11
+description: >
+ Array.prototype.filter - deleting property of prototype causes
+ prototype index property not to be visited on an Array
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+var arr = [0, , 2];
+
+Object.defineProperty(arr, "0", {
+ get: function() {
+ delete Array.prototype[1];
+ return 0;
+ },
+ configurable: true
+});
+
+Array.prototype[1] = 1;
+var newArr = arr.filter(callbackfn);
+
+assert.sameValue(newArr.length, 2, 'newArr.length');
+assert.notSameValue(newArr[1], 1, 'newArr[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-12.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-12.js
new file mode 100644
index 0000000000..5474b0e6f8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-12.js
@@ -0,0 +1,37 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-b-12
+description: >
+ Array.prototype.filter - deleting own property with prototype
+ property causes prototype index property to be visited on an
+ Array-like object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+var obj = {
+ 0: 0,
+ 1: 111,
+ 2: 2,
+ length: 10
+};
+
+Object.defineProperty(obj, "0", {
+ get: function() {
+ delete obj[1];
+ return 0;
+ },
+ configurable: true
+});
+
+Object.prototype[1] = 1;
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 3, 'newArr.length');
+assert.sameValue(newArr[1], 1, 'newArr[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-13.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-13.js
new file mode 100644
index 0000000000..bd91c8bf50
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-13.js
@@ -0,0 +1,31 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-b-13
+description: >
+ Array.prototype.filter - deleting own property with prototype
+ property causes prototype index property to be visited on an Array
+---*/
+
+function callbackfn(val, idx, obj) {
+ return val < 3 ? true : false;
+}
+var arr = [0, 111, 2];
+
+Object.defineProperty(arr, "0", {
+ get: function() {
+ delete arr[1];
+ return 0;
+ },
+ configurable: true
+});
+
+Array.prototype[1] = 1;
+var newArr = arr.filter(callbackfn);
+
+assert.sameValue(newArr.length, 3, 'newArr.length');
+assert.sameValue(newArr[1], 1, 'newArr[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-14.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-14.js
new file mode 100644
index 0000000000..3d1136e563
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-14.js
@@ -0,0 +1,31 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-b-14
+description: >
+ Array.prototype.filter - decreasing length of array causes index
+ property not to be visited
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+var arr = [0, 1, 2, "last"];
+
+Object.defineProperty(arr, "0", {
+ get: function() {
+ arr.length = 3;
+ return 0;
+ },
+ configurable: true
+});
+
+var newArr = arr.filter(callbackfn);
+
+
+assert.sameValue(newArr.length, 3, 'newArr.length');
+assert.sameValue(newArr[2], 2, 'newArr[2]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-15.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-15.js
new file mode 100644
index 0000000000..9869b600ea
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-15.js
@@ -0,0 +1,37 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-b-15
+description: >
+ Array.prototype.filter - decreasing length of array with prototype
+ property causes prototype index property to be visited
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+var arr = [0, 1, 2];
+
+Object.defineProperty(Array.prototype, "2", {
+ get: function() {
+ return "prototype";
+ },
+ configurable: true
+});
+
+Object.defineProperty(arr, "1", {
+ get: function() {
+ arr.length = 2;
+ return 1;
+ },
+ configurable: true
+});
+
+var newArr = arr.filter(callbackfn);
+
+assert.sameValue(newArr.length, 3, 'newArr.length');
+assert.sameValue(newArr[2], "prototype", 'newArr[2]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-16.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-16.js
new file mode 100644
index 0000000000..8c47a71c1f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-16.js
@@ -0,0 +1,39 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-b-16
+description: >
+ Array.prototype.filter - decreasing length of array does not
+ delete non-configurable properties
+flags: [noStrict]
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var arr = [0, 1, 2];
+
+Object.defineProperty(arr, "2", {
+ get: function() {
+ return "unconfigurable";
+ },
+ configurable: false
+});
+
+Object.defineProperty(arr, "1", {
+ get: function() {
+ arr.length = 2;
+ return 1;
+ },
+ configurable: true
+});
+
+var newArr = arr.filter(callbackfn);
+
+assert.sameValue(newArr.length, 3, 'newArr.length');
+assert.sameValue(newArr[2], "unconfigurable", 'newArr[2]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-2.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-2.js
new file mode 100644
index 0000000000..051659aa81
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-2.js
@@ -0,0 +1,31 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-b-2
+description: >
+ Array.prototype.filter - added properties in step 2 are visible
+ here
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {};
+
+Object.defineProperty(obj, "length", {
+ get: function() {
+ obj[2] = "length";
+ return 3;
+ },
+ configurable: true
+});
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], "length", 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-3.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-3.js
new file mode 100644
index 0000000000..b9261879dd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-3.js
@@ -0,0 +1,33 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-b-3
+description: >
+ Array.prototype.filter - deleted properties in step 2 are visible
+ here
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+var obj = {
+ 2: 6.99,
+ 8: 19
+};
+
+Object.defineProperty(obj, "length", {
+ get: function() {
+ delete obj[2];
+ return 10;
+ },
+ configurable: true
+});
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.notSameValue(newArr[0], 6.99, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-4.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-4.js
new file mode 100644
index 0000000000..e2af2fac14
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-4.js
@@ -0,0 +1,38 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-b-4
+description: >
+ Array.prototype.filter - properties added into own object after
+ current position are visited on an Array-like object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {
+ length: 2
+};
+
+Object.defineProperty(obj, "0", {
+ get: function() {
+ Object.defineProperty(obj, "1", {
+ get: function() {
+ return 6.99;
+ },
+ configurable: true
+ });
+ return 0;
+ },
+ configurable: true
+});
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 2, 'newArr.length');
+assert.sameValue(newArr[1], 6.99, 'newArr[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-5.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-5.js
new file mode 100644
index 0000000000..0095c888a0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-5.js
@@ -0,0 +1,36 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-b-5
+description: >
+ Array.prototype.filter - properties added into own object after
+ current position are visited on an Array
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var arr = [0, , 2];
+
+Object.defineProperty(arr, "0", {
+ get: function() {
+ Object.defineProperty(arr, "1", {
+ get: function() {
+ return 6.99;
+ },
+ configurable: true
+ });
+ return 0;
+ },
+ configurable: true
+});
+
+var newArr = arr.filter(callbackfn);
+
+assert.sameValue(newArr.length, 3, 'newArr.length');
+assert.sameValue(newArr[1], 6.99, 'newArr[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-6.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-6.js
new file mode 100644
index 0000000000..acc9dfcb04
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-6.js
@@ -0,0 +1,37 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-b-6
+description: >
+ Array.prototype.filter - properties can be added to prototype
+ after current position are visited on an Array-like object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+var obj = {
+ length: 2
+};
+
+Object.defineProperty(obj, "0", {
+ get: function() {
+ Object.defineProperty(Object.prototype, "1", {
+ get: function() {
+ return 6.99;
+ },
+ configurable: true
+ });
+ return 0;
+ },
+ configurable: true
+});
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 2, 'newArr.length');
+assert.sameValue(Array[1], 6.99, 'Array[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-7.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-7.js
new file mode 100644
index 0000000000..60f19c3b63
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-7.js
@@ -0,0 +1,35 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-b-7
+description: >
+ Array.prototype.filter - properties can be added to prototype
+ after current position are visited on an Array
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+var arr = [0, , 2];
+
+Object.defineProperty(arr, "0", {
+ get: function() {
+ Object.defineProperty(Array.prototype, "1", {
+ get: function() {
+ return 6.99;
+ },
+ configurable: true
+ });
+ return 0;
+ },
+ configurable: true
+});
+
+var newArr = arr.filter(callbackfn);
+
+assert.sameValue(newArr.length, 3, 'newArr.length');
+assert.sameValue(newArr[1], 6.99, 'newArr[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-8.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-8.js
new file mode 100644
index 0000000000..08b65a302d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-8.js
@@ -0,0 +1,42 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-b-8
+description: >
+ Array.prototype.filter - deleting own property causes index
+ property not to be visited on an Array-like object
+---*/
+
+var accessed = false;
+var obj = {
+ length: 2
+};
+
+function callbackfn(val, idx, o) {
+ accessed = true;
+ return true;
+}
+
+Object.defineProperty(obj, "1", {
+ get: function() {
+ return 6.99;
+ },
+ configurable: true
+});
+
+Object.defineProperty(obj, "0", {
+ get: function() {
+ delete obj[1];
+ return 0;
+ },
+ configurable: true
+});
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 0, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-9.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-9.js
new file mode 100644
index 0000000000..2e88dde503
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-b-9.js
@@ -0,0 +1,37 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-b-9
+description: >
+ Array.prototype.filter - deleting own property causes index
+ property not to be visited on an Array
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+var arr = [1, 2];
+
+Object.defineProperty(arr, "1", {
+ get: function() {
+ return "6.99";
+ },
+ configurable: true
+});
+
+Object.defineProperty(arr, "0", {
+ get: function() {
+ delete arr[1];
+ return 0;
+ },
+ configurable: true
+});
+
+var newArr = arr.filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 0, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-1.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-1.js
new file mode 100644
index 0000000000..8fae59879c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-1.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-c-i-1
+description: >
+ Array.prototype.filter - element to be retrieved is own data
+ property on an Array-like object
+---*/
+
+var kValue = {};
+
+function callbackfn(val, idx, obj) {
+ return (idx === 5) && (val === kValue);
+}
+
+var obj = {
+ 5: kValue,
+ length: 100
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], kValue, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-10.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-10.js
new file mode 100644
index 0000000000..2407566e84
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-10.js
@@ -0,0 +1,29 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-c-i-10
+description: >
+ Array.prototype.filter - element to be retrieved is own accessor
+ property on an Array
+---*/
+
+function callbackfn(val, idx, obj) {
+ return idx === 2 && val === 12;
+}
+
+var arr = [];
+
+Object.defineProperty(arr, "2", {
+ get: function() {
+ return 12;
+ },
+ configurable: true
+});
+var newArr = arr.filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 12, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-11.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-11.js
new file mode 100644
index 0000000000..2d36debda2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-11.js
@@ -0,0 +1,39 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-c-i-11
+description: >
+ Array.prototype.filter - element to be retrieved is own accessor
+ property that overrides an inherited data property on an
+ Array-like object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return idx === 0 && val === 11;
+}
+
+var proto = {
+ 0: 5,
+ 1: 6
+};
+
+var Con = function() {};
+Con.prototype = proto;
+
+var child = new Con();
+child.length = 10;
+
+Object.defineProperty(child, "0", {
+ get: function() {
+ return 11;
+ },
+ configurable: true
+});
+var newArr = Array.prototype.filter.call(child, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-12.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-12.js
new file mode 100644
index 0000000000..b6fcffc65a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-12.js
@@ -0,0 +1,31 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-c-i-12
+description: >
+ Array.prototype.filter - element to be retrieved is own accessor
+ property that overrides an inherited data property on an Array
+---*/
+
+function callbackfn(val, idx, obj) {
+ return val === 111 && idx === 0;
+}
+
+var arr = [];
+
+Array.prototype[0] = 10;
+
+Object.defineProperty(arr, "0", {
+ get: function() {
+ return 111;
+ },
+ configurable: true
+});
+var newArr = arr.filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 111, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-13.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-13.js
new file mode 100644
index 0000000000..ce0d6d9343
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-13.js
@@ -0,0 +1,43 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-c-i-13
+description: >
+ Array.prototype.filter - element to be retrieved is own accessor
+ property that overrides an inherited accessor property on an
+ Array-like object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return idx === 1 && val === 12;
+}
+
+var proto = {};
+
+Object.defineProperty(proto, "1", {
+ get: function() {
+ return 6;
+ },
+ configurable: true
+});
+
+var Con = function() {};
+Con.prototype = proto;
+
+var child = new Con();
+child.length = 10;
+
+Object.defineProperty(child, "1", {
+ get: function() {
+ return 12;
+ },
+ configurable: true
+});
+var newArr = Array.prototype.filter.call(child, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 12, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-14.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-14.js
new file mode 100644
index 0000000000..47fd5d8a2d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-14.js
@@ -0,0 +1,36 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+es5id: 15.4.4.20-9-c-i-14
+description: >
+ Array.prototype.filter - element to be retrieved is own accessor
+ property that overrides an inherited accessor property on an Array
+---*/
+
+function callbackfn(val, idx, obj) {
+ return idx === 0 && val === 11;
+}
+
+var arr = [];
+
+Object.defineProperty(Array.prototype, "0", {
+ get: function() {
+ return 5;
+ },
+ configurable: true
+});
+
+Object.defineProperty(arr, "0", {
+ get: function() {
+ return 11;
+ },
+ configurable: true
+});
+var newArr = arr.filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-15.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-15.js
new file mode 100644
index 0000000000..7f0b850f12
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-15.js
@@ -0,0 +1,34 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - element to be retrieved is inherited
+ accessor property on an Array-like object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return val === 11 && idx === 1;
+}
+
+var proto = {};
+
+Object.defineProperty(proto, "1", {
+ get: function() {
+ return 11;
+ },
+ configurable: true
+});
+
+var Con = function() {};
+Con.prototype = proto;
+
+var child = new Con();
+child.length = 20;
+var newArr = Array.prototype.filter.call(child, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-16.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-16.js
new file mode 100644
index 0000000000..81290ab570
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-16.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - element to be retrieved is inherited
+ accessor property on an Array
+---*/
+
+function callbackfn(val, idx, obj) {
+ return idx === 0 && val === 11;
+}
+
+Object.defineProperty(Array.prototype, "0", {
+ get: function() {
+ return 11;
+ },
+ configurable: true
+});
+var newArr = [, , , ].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-17.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-17.js
new file mode 100644
index 0000000000..2245f7fffb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-17.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - element to be retrieved is own accessor
+ property without a get function on an Array-like object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return undefined === val && idx === 1;
+}
+
+var obj = {
+ length: 2
+};
+Object.defineProperty(obj, "1", {
+ set: function() {},
+ configurable: true
+});
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], undefined, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-18.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-18.js
new file mode 100644
index 0000000000..d874ccc003
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-18.js
@@ -0,0 +1,27 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - element to be retrieved is own accessor
+ property without a get function on an Array
+---*/
+
+function callbackfn(val, idx, obj) {
+ return undefined === val && idx === 0;
+}
+
+var arr = [];
+
+Object.defineProperty(arr, "0", {
+ set: function() {},
+ configurable: true
+});
+
+var newArr = arr.filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], undefined, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-19.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-19.js
new file mode 100644
index 0000000000..3c72bb4730
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-19.js
@@ -0,0 +1,30 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - element to be retrieved is own accessor
+ property without a get function that overrides an inherited
+ accessor property on an Array-like object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return undefined === val && idx === 1;
+}
+
+var obj = {
+ length: 2
+};
+Object.defineProperty(obj, "1", {
+ set: function() {},
+ configurable: true
+});
+
+Object.prototype[1] = 10;
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], undefined, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-2.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-2.js
new file mode 100644
index 0000000000..d1653a9ee5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-2.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - element to be retrieved is own data
+ property on an Array
+---*/
+
+function callbackfn(val, idx, obj) {
+ if (idx === 0) {
+ return val === 11;
+ }
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-20.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-20.js
new file mode 100644
index 0000000000..ed21997766
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-20.js
@@ -0,0 +1,29 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - element to be retrieved is own accessor
+ property without a get function that overrides an inherited
+ accessor property on an Array
+---*/
+
+function callbackfn(val, idx, obj) {
+ return undefined === val && idx === 0;
+}
+
+var arr = [];
+
+Object.defineProperty(arr, "0", {
+ set: function() {},
+ configurable: true
+});
+
+Array.prototype[0] = 100;
+var newArr = arr.filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], undefined, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-21.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-21.js
new file mode 100644
index 0000000000..b666378c92
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-21.js
@@ -0,0 +1,31 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - element to be retrieved is inherited
+ accessor property without a get function on an Array-like object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return val === undefined && idx === 1;
+}
+
+var proto = {};
+Object.defineProperty(proto, "1", {
+ set: function() {},
+ configurable: true
+});
+
+var Con = function() {};
+Con.prototype = proto;
+
+var child = new Con();
+child.length = 2;
+var newArr = Array.prototype.filter.call(child, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], undefined, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-22.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-22.js
new file mode 100644
index 0000000000..e18f313a42
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-22.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - element to be retrieved is inherited
+ accessor property without a get function on an Array
+---*/
+
+function callbackfn(val, idx, obj) {
+ return undefined === val && idx === 0;
+}
+
+Object.defineProperty(Array.prototype, "0", {
+ set: function() {},
+ configurable: true
+});
+var newArr = [, ].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], undefined, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-25.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-25.js
new file mode 100644
index 0000000000..718dfda7fd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-25.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - This object is the Arguments object which
+ implements its own property get method (number of arguments is
+ less than number of parameters)
+---*/
+
+function callbackfn(val, idx, obj) {
+ return val === 11 && idx === 0;
+}
+
+var func = function(a, b) {
+ return Array.prototype.filter.call(arguments, callbackfn);
+};
+
+var newArr = func(11);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-26.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-26.js
new file mode 100644
index 0000000000..e76d51b46d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-26.js
@@ -0,0 +1,31 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - This object is the Arguments object which
+ implements its own property get method (number of arguments equals
+ number of parameters)
+---*/
+
+function callbackfn(val, idx, obj) {
+ if (idx === 0) {
+ return val === 11;
+ } else if (idx === 1) {
+ return val === 9;
+ } else {
+ return false;
+ }
+}
+
+var func = function(a, b) {
+ return Array.prototype.filter.call(arguments, callbackfn);
+};
+var newArr = func(11, 9);
+
+assert.sameValue(newArr.length, 2, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert.sameValue(newArr[1], 9, 'newArr[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-27.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-27.js
new file mode 100644
index 0000000000..5da6560806
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-27.js
@@ -0,0 +1,34 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - This object is the Arguments object which
+ implements its own property get method (number of arguments is
+ greater than number of parameters)
+---*/
+
+function callbackfn(val, idx, obj) {
+ if (idx === 0) {
+ return val === 11;
+ } else if (idx === 1) {
+ return val === 12;
+ } else if (idx === 2) {
+ return val === 9;
+ } else {
+ return false;
+ }
+}
+
+var func = function(a, b) {
+ return Array.prototype.filter.call(arguments, callbackfn);
+};
+var newArr = func(11, 12, 9);
+
+assert.sameValue(newArr.length, 3, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert.sameValue(newArr[1], 12, 'newArr[1]');
+assert.sameValue(newArr[2], 9, 'newArr[2]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-28.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-28.js
new file mode 100644
index 0000000000..03f0b1b1b1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-28.js
@@ -0,0 +1,41 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - element changed by getter on previous
+ iterations is observed on an Array
+---*/
+
+var preIterVisible = false;
+var arr = [];
+
+function callbackfn(val, idx, obj) {
+ return idx === 1 && val === 9;
+}
+
+Object.defineProperty(arr, "0", {
+ get: function() {
+ preIterVisible = true;
+ return 11;
+ },
+ configurable: true
+});
+
+Object.defineProperty(arr, "1", {
+ get: function() {
+ if (preIterVisible) {
+ return 9;
+ } else {
+ return 11;
+ }
+ },
+ configurable: true
+});
+var newArr = arr.filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 9, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-29.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-29.js
new file mode 100644
index 0000000000..9acdb8dae0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-29.js
@@ -0,0 +1,43 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - element changed by getter on previous
+ iterations is observed on an Array-like object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return val === 9 && idx === 1;
+}
+
+var preIterVisible = false;
+var obj = {
+ length: 2
+};
+
+Object.defineProperty(obj, "0", {
+ get: function() {
+ preIterVisible = true;
+ return 11;
+ },
+ configurable: true
+});
+
+Object.defineProperty(obj, "1", {
+ get: function() {
+ if (preIterVisible) {
+ return 9;
+ } else {
+ return 13;
+ }
+ },
+ configurable: true
+});
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 9, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-3.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-3.js
new file mode 100644
index 0000000000..ce8a21e6c7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-3.js
@@ -0,0 +1,33 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - element to be retrieved is own data
+ property that overrides an inherited data property on an
+ Array-like object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return (idx === 5) && (val === "abc");
+}
+
+var proto = {
+ 0: 11,
+ 5: 100
+};
+
+var Con = function() {};
+Con.prototype = proto;
+
+var child = new Con();
+child[5] = "abc";
+child.length = 10;
+
+var newArr = Array.prototype.filter.call(child, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], "abc", 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-30.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-30.js
new file mode 100644
index 0000000000..6e85b19ef7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-30.js
@@ -0,0 +1,37 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - unnhandled exceptions happened in getter
+ terminate iteration on an Array-like object
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ if (idx > 1) {
+ accessed = true;
+ }
+ return true;
+}
+
+var obj = {
+ 0: 11,
+ 5: 10,
+ 10: 8,
+ length: 20
+};
+Object.defineProperty(obj, "1", {
+ get: function() {
+ throw new RangeError("unhandle exception happened in getter");
+ },
+ configurable: true
+});
+assert.throws(RangeError, function() {
+ Array.prototype.filter.call(obj, callbackfn);
+});
+assert.sameValue(accessed, false, 'accessed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-31.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-31.js
new file mode 100644
index 0000000000..d4ca7989db
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-31.js
@@ -0,0 +1,35 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - unnhandled exceptions happened in getter
+ terminate iteration on an Array
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ if (idx > 1) {
+ accessed = true;
+ }
+ return true;
+}
+
+var arr = [];
+arr[5] = 10;
+arr[10] = 100;
+
+Object.defineProperty(arr, "1", {
+ get: function() {
+ throw new RangeError("unhandle exception happened in getter");
+ },
+ configurable: true
+});
+assert.throws(RangeError, function() {
+ arr.filter(callbackfn);
+});
+assert.sameValue(accessed, false, 'accessed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-4.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-4.js
new file mode 100644
index 0000000000..5cf957322c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-4.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - element to be retrieved is own data
+ property that overrides an inherited data property on an Array
+---*/
+
+function callbackfn(val, idx, obj) {
+ return (idx === 0) && (val === 12);
+}
+
+Array.prototype[0] = 11;
+var newArr = [12].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 12, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-5.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-5.js
new file mode 100644
index 0000000000..3bc9704ed2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-5.js
@@ -0,0 +1,41 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - element to be retrieved is own data
+ property that overrides an inherited accessor property on an
+ Array-like object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return idx === 0 && val === 11;
+}
+
+var proto = {};
+
+Object.defineProperty(proto, "0", {
+ get: function() {
+ return 5;
+ },
+ configurable: true
+});
+
+var Con = function() {};
+Con.prototype = proto;
+
+var child = new Con();
+child.length = 2;
+Object.defineProperty(child, "0", {
+ value: 11,
+ configurable: true
+});
+child[1] = 12;
+
+var newArr = Array.prototype.filter.call(child, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-6.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-6.js
new file mode 100644
index 0000000000..b71fded79d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-6.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - element to be retrieved is own data
+ property that overrides an inherited accessor property on an Array
+---*/
+
+function callbackfn(val, idx, obj) {
+ return val === 11;
+}
+
+Object.defineProperty(Array.prototype, "0", {
+ get: function() {
+ return 9;
+ },
+ configurable: true
+});
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-7.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-7.js
new file mode 100644
index 0000000000..b0bcff3e14
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-7.js
@@ -0,0 +1,32 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - element to be retrieved is inherited data
+ property on an Array-like object
+---*/
+
+var kValue = 'abc';
+
+function callbackfn(val, idx, obj) {
+ return (idx === 5) && (val === kValue);
+}
+
+var proto = {
+ 5: kValue
+};
+
+var Con = function() {};
+Con.prototype = proto;
+
+var child = new Con();
+child.length = 10;
+
+var newArr = Array.prototype.filter.call(child, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], kValue, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-8.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-8.js
new file mode 100644
index 0000000000..26edd8cf3f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-8.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - element to be retrieved is inherited data
+ property on an Array
+---*/
+
+function callbackfn(val, idx, obj) {
+ return (idx === 1) && (val === 13);
+}
+
+Array.prototype[1] = 13;
+var newArr = [, , , ].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 13, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-9.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-9.js
new file mode 100644
index 0000000000..33563fe84b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-9.js
@@ -0,0 +1,32 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - element to be retrieved is own accessor
+ property on an Array-like object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return (idx === 0) && (val === 11);
+}
+
+var obj = {
+ 10: 10,
+ length: 20
+};
+
+Object.defineProperty(obj, "0", {
+ get: function() {
+ return 11;
+ },
+ configurable: true
+});
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-1.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-1.js
new file mode 100644
index 0000000000..fe654e1055
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-1.js
@@ -0,0 +1,27 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - callbackfn called with correct parameters
+---*/
+
+var bPar = true;
+var bCalled = false;
+
+function callbackfn(val, idx, obj)
+{
+ bCalled = true;
+ if (obj[idx] !== val)
+ bPar = false;
+}
+
+var srcArr = [0, 1, true, null, new Object(), "five"];
+srcArr[999999] = -6.6;
+var resArr = srcArr.filter(callbackfn);
+
+
+assert.sameValue(bCalled, true, 'bCalled');
+assert.sameValue(bPar, true, 'bPar');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-10.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-10.js
new file mode 100644
index 0000000000..b1256bd8f8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-10.js
@@ -0,0 +1,19 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - callbackfn is called with 1 formal
+ parameter
+---*/
+
+function callbackfn(val) {
+ return val > 10;
+}
+var newArr = [12].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 12, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-11.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-11.js
new file mode 100644
index 0000000000..c698738aa1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-11.js
@@ -0,0 +1,19 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - callbackfn is called with 2 formal
+ parameter
+---*/
+
+function callbackfn(val, idx) {
+ return val > 10 && arguments[2][idx] === val;
+}
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-12.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-12.js
new file mode 100644
index 0000000000..6eab263f20
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-12.js
@@ -0,0 +1,19 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - callbackfn is called with 3 formal
+ parameter
+---*/
+
+function callbackfn(val, idx, obj) {
+ return val > 10 && obj[idx] === val;
+}
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-13.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-13.js
new file mode 100644
index 0000000000..c1c273a5f0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-13.js
@@ -0,0 +1,19 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - callbackfn that uses arguments object to
+ get parameter value
+---*/
+
+function callbackfn() {
+ return arguments[2][arguments[1]] === arguments[0];
+}
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-16.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-16.js
new file mode 100644
index 0000000000..a5037a7db3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-16.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - 'this' of 'callbackfn' is a Boolean
+ object when T is not an object (T is a boolean)
+---*/
+
+function callbackfn(val, idx, obj) {
+ return this.valueOf() === false;
+}
+
+var obj = {
+ 0: 11,
+ length: 2
+};
+var newArr = Array.prototype.filter.call(obj, callbackfn, false);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-17.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-17.js
new file mode 100644
index 0000000000..a31e0c995d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-17.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter -'this' of 'callbackfn' is a Number object
+ when T is not an object (T is a number)
+---*/
+
+function callbackfn(val, idx, o) {
+ return 5 === this.valueOf();
+}
+
+var obj = {
+ 0: 11,
+ length: 2
+};
+var newArr = Array.prototype.filter.call(obj, callbackfn, 5);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-18.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-18.js
new file mode 100644
index 0000000000..c3d0237bf2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-18.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - 'this' of 'callbackfn' is an String
+ object when T is not an object (T is a string)
+---*/
+
+function callbackfn(val, idx, obj) {
+ return 'hello' === this.valueOf();
+}
+
+var obj = {
+ 0: 11,
+ length: 2
+};
+var newArr = Array.prototype.filter.call(obj, callbackfn, "hello");
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-19.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-19.js
new file mode 100644
index 0000000000..caf9d7c13e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-19.js
@@ -0,0 +1,27 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - non-indexed properties are not called
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return val === 8;
+}
+
+var obj = {
+ 0: 11,
+ non_index_property: 8,
+ 2: 5,
+ length: 20
+};
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-2.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-2.js
new file mode 100644
index 0000000000..4165794019
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-2.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - callbackfn takes 3 arguments
+---*/
+
+var parCnt = 3;
+var bCalled = false
+
+function callbackfn(val, idx, obj)
+{
+ bCalled = true;
+ if (arguments.length !== 3)
+ parCnt = arguments.length; //verify if callbackfn was called with 3 parameters
+}
+
+var srcArr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
+var resArr = srcArr.filter(callbackfn);
+
+assert.sameValue(bCalled, true, 'bCalled');
+assert.sameValue(parCnt, 3, 'parCnt');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-20.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-20.js
new file mode 100644
index 0000000000..922371250c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-20.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - callbackfn called with correct parameters
+ (thisArg is correct)
+---*/
+
+var thisArg = {
+ threshold: 10
+};
+
+function callbackfn(val, idx, obj) {
+ return this === thisArg;
+}
+
+var obj = {
+ 0: 11,
+ length: 1
+};
+var newArr = Array.prototype.filter.call(obj, callbackfn, thisArg);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-21.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-21.js
new file mode 100644
index 0000000000..866144fbd2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-21.js
@@ -0,0 +1,34 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - callbackfn called with correct parameters
+ (kValue is correct)
+---*/
+
+function callbackfn(val, idx, obj) {
+ if (idx === 0) {
+ return val === 11;
+ }
+
+ if (idx === 1) {
+ return val === 12;
+ }
+
+ return false;
+}
+
+var obj = {
+ 0: 11,
+ 1: 12,
+ length: 2
+};
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 2, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert.sameValue(newArr[1], 12, 'newArr[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-22.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-22.js
new file mode 100644
index 0000000000..38c78e20af
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-22.js
@@ -0,0 +1,34 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - callbackfn called with correct parameters
+ (the index k is correct)
+---*/
+
+function callbackfn(val, idx, obj) {
+ if (val === 11) {
+ return idx === 0;
+ }
+
+ if (val === 12) {
+ return idx === 1;
+ }
+
+ return false;
+}
+
+var obj = {
+ 0: 11,
+ 1: 12,
+ length: 2
+};
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 2, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+assert.sameValue(newArr[1], 12, 'newArr[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-23.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-23.js
new file mode 100644
index 0000000000..2bc0f778f0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-23.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - callbackfn called with correct parameters
+ (this object O is correct)
+---*/
+
+var obj = {
+ 0: 11,
+ length: 2
+};
+
+function callbackfn(val, idx, o) {
+ return obj === o;
+}
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-4.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-4.js
new file mode 100644
index 0000000000..7244da2879
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-4.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - k values are passed in ascending numeric
+ order
+---*/
+
+var arr = [0, 1, 2, 3, 4, 5];
+var lastIdx = 0;
+var called = 0;
+
+function callbackfn(val, idx, o) {
+ called++;
+ if (lastIdx !== idx) {
+ return false;
+ } else {
+ lastIdx++;
+ return true;
+ }
+}
+var newArr = arr.filter(callbackfn);
+
+assert.sameValue(newArr.length, called, 'newArr.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-5.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-5.js
new file mode 100644
index 0000000000..277c5acf61
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-5.js
@@ -0,0 +1,34 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - k values are accessed during each
+ iteration and not prior to starting the loop on an Array
+---*/
+
+var kIndex = [];
+var called = 0;
+
+//By below way, we could verify that k would be setted as 0, 1, ..., length - 1 in order, and each value will be setted one time.
+function callbackfn(val, idx, obj) {
+ called++;
+ //Each position should be visited one time, which means k is accessed one time during iterations.
+ if (kIndex[idx] === undefined) {
+ //when current position is visited, its previous index should has been visited.
+ if (idx !== 0 && kIndex[idx - 1] === undefined) {
+ return true;
+ }
+ kIndex[idx] = 1;
+ return false;
+ } else {
+ return true;
+ }
+}
+var newArr = [11, 12, 13, 14].filter(callbackfn, undefined);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert.sameValue(called, 4, 'called');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-6.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-6.js
new file mode 100644
index 0000000000..d2df7c598b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-6.js
@@ -0,0 +1,29 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - arguments to callbackfn are self
+ consistent
+---*/
+
+var obj = {
+ 0: 11,
+ length: 1
+};
+var thisArg = {};
+
+function callbackfn() {
+ return this === thisArg &&
+ arguments[0] === 11 &&
+ arguments[1] === 0 &&
+ arguments[2] === obj;
+}
+
+var newArr = Array.prototype.filter.call(obj, callbackfn, thisArg);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-7.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-7.js
new file mode 100644
index 0000000000..825c76941d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-7.js
@@ -0,0 +1,32 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - unhandled exceptions happened in
+ callbackfn terminate iteration
+---*/
+
+var called = 0;
+
+function callbackfn(val, idx, obj) {
+ called++;
+ if (called === 1) {
+ throw new Error("Exception occurred in callbackfn");
+ }
+ return true;
+}
+
+var obj = {
+ 0: 11,
+ 4: 10,
+ 10: 8,
+ length: 20
+};
+assert.throws(Error, function() {
+ Array.prototype.filter.call(obj, callbackfn);
+});
+assert.sameValue(called, 1, 'called');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-8.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-8.js
new file mode 100644
index 0000000000..15741a6d34
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-8.js
@@ -0,0 +1,29 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - element changed by callbackfn on previous
+ iterations is observed
+---*/
+
+var obj = {
+ 0: 11,
+ 1: 12,
+ length: 2
+};
+
+function callbackfn(val, idx, o) {
+ if (idx === 0) {
+ obj[idx + 1] = 8;
+ }
+ return val > 10;
+}
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-9.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-9.js
new file mode 100644
index 0000000000..11c144921f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-9.js
@@ -0,0 +1,19 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - callbackfn is called with 0 formal
+ parameter
+---*/
+
+function callbackfn() {
+ return true;
+}
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-1.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-1.js
new file mode 100644
index 0000000000..a7f966813a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-1.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - value of returned array element equals to
+ 'kValue'
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {
+ 0: 11,
+ 1: 9,
+ length: 2
+};
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr[0], obj[0], 'newArr[0]');
+assert.sameValue(newArr[1], obj[1], 'newArr[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-2.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-2.js
new file mode 100644
index 0000000000..6dfdc285d7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-2.js
@@ -0,0 +1,27 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - value of returned array element can be
+ overwritten
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {
+ 0: 11,
+ 1: 9,
+ length: 2
+};
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+var tempVal = newArr[1];
+newArr[1] += 1;
+
+assert.notSameValue(newArr[1], tempVal, 'newArr[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-3.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-3.js
new file mode 100644
index 0000000000..6b66f5f114
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-3.js
@@ -0,0 +1,33 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - value of returned array element can be
+ enumerated
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {
+ 0: 11,
+ length: 2
+};
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+var prop;
+var enumerable = false;
+for (prop in newArr) {
+ if (newArr.hasOwnProperty(prop)) {
+ if (prop === "0") {
+ enumerable = true;
+ }
+ }
+}
+
+assert(enumerable, 'enumerable !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-4.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-4.js
new file mode 100644
index 0000000000..df599b8bfa
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-4.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - value of returned array element can be
+ changed or deleted
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {
+ 0: 11,
+ 1: 9,
+ length: 2
+};
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+var tempVal = newArr[1];
+delete newArr[1];
+
+assert.notSameValue(tempVal, undefined, 'tempVal');
+assert.sameValue(newArr[1], undefined, 'newArr[1]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-5.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-5.js
new file mode 100644
index 0000000000..3bd6dcc5cb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-5.js
@@ -0,0 +1,29 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - values of 'to' are passed in acending
+ numeric order
+---*/
+
+var arr = [0, 1, 2, 3, 4];
+var lastToIdx = 0;
+var called = 0;
+
+function callbackfn(val, idx, obj) {
+ called++;
+ if (lastToIdx !== idx) {
+ return false;
+ } else {
+ lastToIdx++;
+ return true;
+ }
+}
+var newArr = arr.filter(callbackfn);
+
+assert.sameValue(newArr.length, 5, 'newArr.length');
+assert.sameValue(called, 5, 'called');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-6.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-6.js
new file mode 100644
index 0000000000..1ff610ed7f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1-6.js
@@ -0,0 +1,35 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - values of 'to' are accessed during each
+ iteration when 'selected' is converted to true and not prior to
+ starting the loop
+---*/
+
+var toIndex = [];
+var called = 0;
+
+//By below way, we could verify that 'to' would be setted as 0, 1, ..., length - 1 in order, and each value will be setted one time.
+function callbackfn(val, idx, obj) {
+ called++;
+ //Each position should be visited one time, which means 'to' is accessed one time during iterations.
+ if (toIndex[idx] === undefined) {
+ //when current position is visited, its previous index should has been visited.
+ if (idx !== 0 && toIndex[idx - 1] === undefined) {
+ return false;
+ }
+ toIndex[idx] = 1;
+ return true;
+ } else {
+ return false;
+ }
+}
+var newArr = [11, 12, 13, 14].filter(callbackfn, undefined);
+
+assert.sameValue(newArr.length, 4, 'newArr.length');
+assert.sameValue(called, 4, 'called');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1.js
new file mode 100644
index 0000000000..b50fe6d2f1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-1.js
@@ -0,0 +1,29 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - getOwnPropertyDescriptor(all true) of
+ returned array element
+---*/
+
+function callbackfn(val, idx, obj) {
+ if (val % 2)
+ return true;
+ else
+ return false;
+}
+var srcArr = [0, 1, 2, 3, 4];
+var resArr = srcArr.filter(callbackfn);
+
+assert(resArr.length > 0, 'resArr.length > 0');
+
+var desc = Object.getOwnPropertyDescriptor(resArr, 1);
+
+assert.sameValue(desc.value, 3, 'desc.value'); //srcArr[1] = true
+assert.sameValue(desc.writable, true, 'desc.writable');
+assert.sameValue(desc.enumerable, true, 'desc.enumerable');
+assert.sameValue(desc.configurable, true, 'desc.configurable');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-10.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-10.js
new file mode 100644
index 0000000000..b45947f805
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-10.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter return value of callbackfn is a number
+ (value is negative number)
+---*/
+
+function callbackfn(val, idx, obj) {
+ return -5;
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-11.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-11.js
new file mode 100644
index 0000000000..31c26199c6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-11.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter return value of callbackfn is a number
+ (value is Infinity)
+---*/
+
+function callbackfn(val, idx, obj) {
+ return Infinity;
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-12.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-12.js
new file mode 100644
index 0000000000..8fd6b71d46
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-12.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter return value of callbackfn is a number
+ (value is -Infinity)
+---*/
+
+function callbackfn(val, idx, obj) {
+ return -Infinity;
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-13.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-13.js
new file mode 100644
index 0000000000..93770cfb67
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-13.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter return value of callbackfn is a number
+ (value is NaN)
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return NaN;
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-14.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-14.js
new file mode 100644
index 0000000000..36884f363c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-14.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter return value of callbackfn is an empty
+ string
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return "";
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-15.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-15.js
new file mode 100644
index 0000000000..dd791bbe27
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-15.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter return value of callbackfn is a non-empty
+ string
+---*/
+
+function callbackfn(val, idx, obj) {
+ return "non-empty string";
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-16.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-16.js
new file mode 100644
index 0000000000..cde900a1d0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-16.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter return value of callbackfn is a Function
+ object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return function() {};
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-17.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-17.js
new file mode 100644
index 0000000000..7555efa70c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-17.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter return value of callbackfn is an Array
+ object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return new Array(10);
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-18.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-18.js
new file mode 100644
index 0000000000..8240f69cfc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-18.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter return value of callbackfn is a String
+ object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return new String();
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-19.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-19.js
new file mode 100644
index 0000000000..cb47321ea4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-19.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter return value of callbackfn is a Boolean
+ object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return new Boolean();
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-2.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-2.js
new file mode 100644
index 0000000000..9a6f784bf2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-2.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - return value of callbackfn is undefined
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, o) {
+ accessed = true;
+ return undefined;
+}
+
+var obj = {
+ 0: 11,
+ length: 1
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-20.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-20.js
new file mode 100644
index 0000000000..09a90a5db9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-20.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - return value of callbackfn is a Number
+ object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return new Number();
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-21.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-21.js
new file mode 100644
index 0000000000..222219ecd3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-21.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - return value of callbackfn is the Math
+ object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return Math;
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-22.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-22.js
new file mode 100644
index 0000000000..d935e2d12f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-22.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - return value of callbackfn is a Date
+ object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return new Date();
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-23.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-23.js
new file mode 100644
index 0000000000..7ddcfd05c2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-23.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - return value of callbackfn is a RegExp
+ object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return new RegExp();
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-24.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-24.js
new file mode 100644
index 0000000000..99df34f35a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-24.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - return value of callbackfn is the JSON
+ object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return JSON;
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-25.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-25.js
new file mode 100644
index 0000000000..7d83be14e6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-25.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - return value of callbackfn is an Error
+ object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return new EvalError();
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-26.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-26.js
new file mode 100644
index 0000000000..bcbd116e10
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-26.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - return value of callbackfn is the
+ Arguments object
+---*/
+
+function callbackfn(val, idx, obj) {
+ return arguments;
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-28.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-28.js
new file mode 100644
index 0000000000..990d93dfe2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-28.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - return value of callbackfn is the global
+ object
+---*/
+
+var global = this;
+
+function callbackfn(val, idx, obj) {
+ return global;
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-29.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-29.js
new file mode 100644
index 0000000000..a07954a33f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-29.js
@@ -0,0 +1,30 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - false prevents element added to output
+ Array
+---*/
+
+var called = 0;
+
+function callbackfn(val, idx, obj) {
+ called++;
+ return val > 10;
+}
+
+var obj = {
+ 0: 11,
+ 1: 8,
+ length: 20
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.notSameValue(newArr[0], 8, 'newArr[0]');
+assert.sameValue(called, 2, 'called');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-3.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-3.js
new file mode 100644
index 0000000000..5899132312
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-3.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter - return value of callbackfn is null
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return null;
+}
+
+var obj = {
+ 0: 11,
+ length: 1
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-30.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-30.js
new file mode 100644
index 0000000000..ba0497c761
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-30.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - return value (new Boolean(false)) of
+ callbackfn is treated as true value
+---*/
+
+function callbackfn(val, idx, obj) {
+ return new Boolean(false);
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-4.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-4.js
new file mode 100644
index 0000000000..eaf48e0554
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-4.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - return value of callbackfn is a boolean
+ (value is false)
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return false;
+}
+
+var obj = {
+ 0: 11,
+ length: 1
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-5.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-5.js
new file mode 100644
index 0000000000..e80422ec13
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-5.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - return value of callbackfn is a boolean
+ (value is true)
+---*/
+
+function callbackfn(val, idx, obj) {
+ return true;
+}
+
+var obj = {
+ 0: 11,
+ length: 1
+};
+
+var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-6.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-6.js
new file mode 100644
index 0000000000..47e984643e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-6.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - return value of callbackfn is a number
+ (value is 0)
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return 0;
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-7.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-7.js
new file mode 100644
index 0000000000..c5d81dc4e9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-7.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - return value of callbackfn is a number
+ (value is +0)
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return +0;
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-8.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-8.js
new file mode 100644
index 0000000000..603f47378f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-8.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - return value of callbackfn is a nunmber
+ (value is -0)
+---*/
+
+var accessed = false;
+
+function callbackfn(val, idx, obj) {
+ accessed = true;
+ return -0;
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 0, 'newArr.length');
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-9.js b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-9.js
new file mode 100644
index 0000000000..759f76f46b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/15.4.4.20-9-c-iii-9.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter - return value of callbackfn is a number
+ (value is positive number)
+---*/
+
+function callbackfn(val, idx, obj) {
+ return 5;
+}
+
+var newArr = [11].filter(callbackfn);
+
+assert.sameValue(newArr.length, 1, 'newArr.length');
+assert.sameValue(newArr[0], 11, 'newArr[0]');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/browser.js b/js/src/tests/test262/built-ins/Array/prototype/filter/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/browser.js
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/call-with-boolean.js b/js/src/tests/test262/built-ins/Array/prototype/filter/call-with-boolean.js
new file mode 100644
index 0000000000..cc9590aa33
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/call-with-boolean.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: Array.prototype.filter applied to boolean primitive
+includes: [compareArray.js]
+---*/
+
+assert.compareArray(
+ Array.prototype.filter.call(true, () => {}),
+ [],
+ 'Array.prototype.filter.call(true, () => {}) must return []'
+);
+assert.compareArray(
+ Array.prototype.filter.call(false, () => {}),
+ [],
+ 'Array.prototype.filter.call(false, () => {}) must return []'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/callbackfn-resize-arraybuffer.js b/js/src/tests/test262/built-ins/Array/prototype/filter/callbackfn-resize-arraybuffer.js
new file mode 100644
index 0000000000..ef7612695d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/callbackfn-resize-arraybuffer.js
@@ -0,0 +1,74 @@
+// |reftest| shell-option(--enable-arraybuffer-resizable) skip-if(!ArrayBuffer.prototype.resize||!xulRuntime.shell) -- resizable-arraybuffer is not enabled unconditionally, requires shell-options
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-array.prototype.filter
+description: TypedArray instance buffer can be resized during iteration
+includes: [testTypedArray.js, compareArray.js]
+features: [TypedArray, resizable-arraybuffer]
+---*/
+
+// If the host chooses to throw as allowed by the specification, the observed
+// behavior will be identical to the case where `ArrayBuffer.prototype.resize`
+// has not been implemented. The following assertion prevents this test from
+// passing in runtimes which have not implemented the method.
+assert.sameValue(typeof ArrayBuffer.prototype.resize, 'function');
+
+testWithTypedArrayConstructors(function(TA) {
+ var BPE = TA.BYTES_PER_ELEMENT;
+ var buffer = new ArrayBuffer(BPE * 3, {maxByteLength: BPE * 4});
+ var sample = new TA(buffer);
+ var expectedElements, expectedIndices, expectedArrays;
+ var elements, indices, arrays, result;
+
+ elements = [];
+ indices = [];
+ arrays = [];
+ result = Array.prototype.filter.call(sample, function(element, index, array) {
+ if (elements.length === 0) {
+ try {
+ buffer.resize(2 * BPE);
+ expectedElements = [0, 0];
+ expectedIndices = [0, 1];
+ expectedArrays = [sample, sample];
+ } catch (_) {
+ expectedElements = [0, 0, 0];
+ expectedIndices = [0, 1, 2];
+ expectedArrays = [sample, sample, sample];
+ }
+ }
+
+ elements.push(element);
+ indices.push(index);
+ arrays.push(array);
+ return true;
+ });
+
+ assert.compareArray(elements, expectedElements, 'elements (shrink)');
+ assert.compareArray(indices, expectedIndices, 'indices (shrink)');
+ assert.compareArray(arrays, expectedArrays, 'arrays (shrink)');
+ assert.compareArray(result, expectedElements, 'result (shrink)');
+
+ elements = [];
+ indices = [];
+ arrays = [];
+ result = Array.prototype.filter.call(sample, function(element, index, array) {
+ if (elements.length === 0) {
+ try {
+ buffer.resize(4 * BPE);
+ } catch (_) {}
+ }
+
+ elements.push(element);
+ indices.push(index);
+ arrays.push(array);
+ return true;
+ });
+
+ assert.compareArray(elements, expectedElements, 'elements (grow)');
+ assert.compareArray(indices, expectedIndices, 'indices (grow)');
+ assert.compareArray(arrays, expectedArrays, 'arrays (grow)');
+ assert.compareArray(result, expectedElements, 'result (grow)');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/create-ctor-non-object.js b/js/src/tests/test262/built-ins/Array/prototype/filter/create-ctor-non-object.js
new file mode 100644
index 0000000000..afab7f214f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/create-ctor-non-object.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Behavior when `constructor` property is neither an Object nor undefined
+info: |
+ [...]
+ 5. Let A be ? ArraySpeciesCreate(O, 0).
+ [...]
+
+ 9.4.2.3 ArraySpeciesCreate
+
+ [...]
+ 5. Let C be ? Get(originalArray, "constructor").
+ [...]
+ 9. If IsConstructor(C) is false, throw a TypeError exception.
+---*/
+
+var a = [];
+var callCount = 0;
+var cb = function() {
+ callCount += 0;
+};
+
+a.constructor = null;
+assert.throws(TypeError, function() {
+ a.filter(cb);
+}, 'null value');
+assert.sameValue(callCount, 0, 'callback not invoked (null value)');
+
+a = [];
+a.constructor = 1;
+assert.throws(TypeError, function() {
+ a.filter(cb);
+}, 'number value');
+assert.sameValue(callCount, 0, 'callback not invoked (number value)');
+
+a = [];
+a.constructor = 'string';
+assert.throws(TypeError, function() {
+ a.filter(cb);
+}, 'string value');
+assert.sameValue(callCount, 0, 'callback not invoked (string value)');
+
+a = [];
+a.constructor = true;
+assert.throws(TypeError, function() {
+ a.filter(cb);
+}, 'boolean value');
+assert.sameValue(callCount, 0, 'callback not invoked (boolean value)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/create-ctor-poisoned.js b/js/src/tests/test262/built-ins/Array/prototype/filter/create-ctor-poisoned.js
new file mode 100644
index 0000000000..77290e1cdd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/create-ctor-poisoned.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-array.prototype.filter
+description: Abrupt completion from `constructor` property access
+info: |
+ [...]
+ 5. Let A be ? ArraySpeciesCreate(O, 0).
+ [...]
+
+ 9.4.2.3 ArraySpeciesCreate
+
+ [...]
+ 5. Let C be ? Get(originalArray, "constructor").
+---*/
+
+var a = [];
+var callCount = 0;
+var cb = function() {
+ callCount += 1;
+};
+
+Object.defineProperty(a, 'constructor', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ a.filter(cb);
+});
+assert.sameValue(callCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/create-non-array.js b/js/src/tests/test262/built-ins/Array/prototype/filter/create-non-array.js
new file mode 100644
index 0000000000..1c95704270
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/create-non-array.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-array.prototype.filter
+description: Constructor is ignored for non-Array values
+info: |
+ [...]
+ 5. Let A be ? ArraySpeciesCreate(O, 0).
+ [...]
+
+ 9.4.2.3 ArraySpeciesCreate
+
+ [...]
+ 3. Let isArray be ? IsArray(originalArray).
+ 4. If isArray is false, return ? ArrayCreate(length).
+---*/
+
+var obj = {
+ length: 0
+};
+var callCount = 0;
+var result;
+Object.defineProperty(obj, 'constructor', {
+ get: function() {
+ callCount += 1;
+ }
+});
+
+result = Array.prototype.filter.call(obj, function() {});
+
+assert.sameValue(callCount, 0, '`constructor` property not accessed');
+assert.sameValue(Object.getPrototypeOf(result), Array.prototype);
+assert(Array.isArray(result), 'result is an Array exotic object');
+assert.sameValue(result.length, 0, 'array created with appropriate length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/create-proto-from-ctor-realm-array.js b/js/src/tests/test262/built-ins/Array/prototype/filter/create-proto-from-ctor-realm-array.js
new file mode 100644
index 0000000000..fe8d6ce281
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/create-proto-from-ctor-realm-array.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-array.prototype.filter
+description: Prefer Array constructor of current realm record
+info: |
+ 1. Let O be ? ToObject(this value).
+ [...]
+ 5. Let A be ? ArraySpeciesCreate(O, 0).
+ [...]
+
+ 9.4.2.3 ArraySpeciesCreate
+
+ [...]
+ 5. Let C be ? Get(originalArray, "constructor").
+ 6. If IsConstructor(C) is true, then
+ a. Let thisRealm be the current Realm Record.
+ b. Let realmC be ? GetFunctionRealm(C).
+ c. If thisRealm and realmC are not the same Realm Record, then
+ i. If SameValue(C, realmC.[[Intrinsics]].[[%Array%]]) is true, let C
+ be undefined.
+ [...]
+features: [cross-realm, Symbol.species]
+---*/
+
+var array = [];
+var callCount = 0;
+var OArray = $262.createRealm().global.Array;
+var speciesDesc = {
+ get: function() {
+ callCount += 1;
+ }
+};
+var result;
+array.constructor = OArray;
+
+Object.defineProperty(Array, Symbol.species, speciesDesc);
+Object.defineProperty(OArray, Symbol.species, speciesDesc);
+
+result = array.filter(function() {});
+
+assert.sameValue(Object.getPrototypeOf(result), Array.prototype);
+assert.sameValue(callCount, 0, 'Species constructor is not referenced');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/create-proto-from-ctor-realm-non-array.js b/js/src/tests/test262/built-ins/Array/prototype/filter/create-proto-from-ctor-realm-non-array.js
new file mode 100644
index 0000000000..9909bf2d2f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/create-proto-from-ctor-realm-non-array.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-array.prototype.filter
+description: Accept non-Array constructors from other realms
+info: |
+ 1. Let O be ? ToObject(this value).
+ [...]
+ 5. Let A be ? ArraySpeciesCreate(O, 0).
+ [...]
+
+ 9.4.2.3 ArraySpeciesCreate
+
+ [...]
+ 5. Let C be ? Get(originalArray, "constructor").
+ 6. If IsConstructor(C) is true, then
+ a. Let thisRealm be the current Realm Record.
+ b. Let realmC be ? GetFunctionRealm(C).
+ c. If thisRealm and realmC are not the same Realm Record, then
+ i. If SameValue(C, realmC.[[Intrinsics]].[[%Array%]]) is true, let C
+ be undefined.
+ [...]
+features: [cross-realm, Symbol.species]
+---*/
+
+var array = [];
+var callCount = 0;
+var CustomCtor = function() {};
+var OObject = $262.createRealm().global.Object;
+var speciesDesc = {
+ get: function() {
+ callCount += 1;
+ }
+};
+var result;
+array.constructor = OObject;
+OObject[Symbol.species] = CustomCtor;
+
+Object.defineProperty(Array, Symbol.species, speciesDesc);
+
+result = array.filter(function() {});
+
+assert.sameValue(Object.getPrototypeOf(result), CustomCtor.prototype);
+assert.sameValue(callCount, 0, 'Array species constructor is not referenced');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/create-proxy.js b/js/src/tests/test262/built-ins/Array/prototype/filter/create-proxy.js
new file mode 100644
index 0000000000..53fdf04bc0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/create-proxy.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-array.prototype.filter
+description: Species constructor of a Proxy object whose target is an array
+info: |
+ [...]
+ 5. Let A be ? ArraySpeciesCreate(O, 0).
+ [...]
+ 9. Return A.
+
+ 9.4.2.3 ArraySpeciesCreate
+
+ [...]
+ 3. Let isArray be ? IsArray(originalArray).
+
+ 7.2.2 IsArray
+
+ [...]
+ 3. If argument is a Proxy exotic object, then
+ a. If the value of the [[ProxyHandler]] internal slot of argument is
+ null, throw a TypeError exception.
+ b. Let target be the value of the [[ProxyTarget]] internal slot of
+ argument.
+ c. Return ? IsArray(target).
+features: [Proxy, Symbol.species]
+---*/
+
+var array = [];
+var proxy = new Proxy(new Proxy(array, {}), {});
+var Ctor = function() {};
+var result;
+
+array.constructor = function() {};
+array.constructor[Symbol.species] = Ctor;
+
+result = Array.prototype.filter.call(proxy, function() {});
+
+assert.sameValue(Object.getPrototypeOf(result), Ctor.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/create-revoked-proxy.js b/js/src/tests/test262/built-ins/Array/prototype/filter/create-revoked-proxy.js
new file mode 100644
index 0000000000..e49abe2f44
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/create-revoked-proxy.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-array.prototype.filter
+description: Abrupt completion from constructor that is a revoked Proxy object
+info: |
+ [...]
+ 5. Let A be ? ArraySpeciesCreate(O, 0).
+ [...]
+
+ 9.4.2.3 ArraySpeciesCreate
+
+ [...]
+ 3. Let isArray be ? IsArray(originalArray).
+
+ 7.2.2 IsArray
+
+ [...]
+ 3. If argument is a Proxy exotic object, then
+ a. If the value of the [[ProxyHandler]] internal slot of argument is
+ null, throw a TypeError exception.
+features: [Proxy]
+---*/
+
+var o = Proxy.revocable([], {});
+var ctorCount = 0;
+var cbCount = 0;
+var cb = function() {
+ cbCount += 1;
+};
+
+Object.defineProperty(o.proxy, 'constructor', {
+ get: function() {
+ ctorCount += 1;
+ }
+});
+o.revoke();
+
+assert.throws(TypeError, function() {
+ Array.prototype.filter.call(o.proxy, cb);
+});
+
+assert.sameValue(ctorCount, 0, '`constructor` property not accessed');
+assert.sameValue(cbCount, 0, 'callback not invoked');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/create-species-abrupt.js b/js/src/tests/test262/built-ins/Array/prototype/filter/create-species-abrupt.js
new file mode 100644
index 0000000000..1380003108
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/create-species-abrupt.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-array.prototype.filter
+description: Species constructor returns an abrupt completion
+info: |
+ [...]
+ 5. Let A be ? ArraySpeciesCreate(O, 0).
+ [...]
+
+ 9.4.2.3 ArraySpeciesCreate
+
+ [...]
+ 5. Let C be ? Get(originalArray, "constructor").
+ [...]
+ 7. If Type(C) is Object, then
+ a. Let C be ? Get(C, @@species).
+ b. If C is null, let C be undefined.
+ [...]
+ 10. Return ? Construct(C, « length »).
+features: [Symbol.species]
+---*/
+
+var Ctor = function() {
+ throw new Test262Error();
+};
+var callCount = 0;
+var cb = function() {
+ callCount += 1;
+};
+var a = [];
+a.constructor = {};
+a.constructor[Symbol.species] = Ctor;
+
+assert.throws(Test262Error, function() {
+ a.filter(cb);
+});
+assert.sameValue(callCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/create-species-non-ctor.js b/js/src/tests/test262/built-ins/Array/prototype/filter/create-species-non-ctor.js
new file mode 100644
index 0000000000..fff049a2c6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/create-species-non-ctor.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Behavior when the @@species attribute is a non-constructor object
+info: |
+ [...]
+ 5. Let A be ? ArraySpeciesCreate(O, 0).
+ [...]
+
+ 9.4.2.3 ArraySpeciesCreate
+
+ [...]
+ 5. Let C be ? Get(originalArray, "constructor").
+ [...]
+ 7. If Type(C) is Object, then
+ a. Let C be ? Get(C, @@species).
+ b. If C is null, let C be undefined.
+ [...]
+ 9. If IsConstructor(C) is false, throw a TypeError exception.
+includes: [isConstructor.js]
+features: [Symbol.species, Reflect.construct]
+---*/
+
+assert.sameValue(
+ isConstructor(parseInt),
+ false,
+ 'precondition: isConstructor(parseInt) must return false'
+);
+
+var a = [];
+var callCount = 0;
+var cb = function() {
+ callCount += 1;
+};
+
+a.constructor = {};
+a.constructor[Symbol.species] = parseInt;
+
+assert.throws(TypeError, function() {
+ a.filter(cb);
+}, 'a.filter(cb) throws a TypeError exception');
+assert.sameValue(callCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/create-species-null.js b/js/src/tests/test262/built-ins/Array/prototype/filter/create-species-null.js
new file mode 100644
index 0000000000..a1cf95abff
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/create-species-null.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-array.prototype.filter
+description: >
+ A null value for the @@species constructor is interpreted as `undefined`
+info: |
+ [...]
+ 5. Let A be ? ArraySpeciesCreate(O, 0).
+ [...]
+
+ 9.4.2.3 ArraySpeciesCreate
+
+ [...]
+ 5. Let C be ? Get(originalArray, "constructor").
+ [...]
+ 7. If Type(C) is Object, then
+ a. Let C be ? Get(C, @@species).
+ b. If C is null, let C be undefined.
+ 8. If C is undefined, return ? ArrayCreate(length).
+features: [Symbol.species]
+---*/
+
+var a = [];
+var result;
+
+a.constructor = {};
+a.constructor[Symbol.species] = null;
+
+result = a.filter(function() {});
+
+assert.sameValue(Object.getPrototypeOf(result), Array.prototype);
+assert(Array.isArray(result), 'result is an Array exotic object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/create-species-poisoned.js b/js/src/tests/test262/built-ins/Array/prototype/filter/create-species-poisoned.js
new file mode 100644
index 0000000000..dbab47d6ae
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/create-species-poisoned.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-array.prototype.filter
+description: Abrupt completion from `@@species` property access
+info: |
+ [...]
+ 5. Let A be ? ArraySpeciesCreate(O, 0).
+ [...]
+
+ 9.4.2.3 ArraySpeciesCreate
+
+ [...]
+ 5. Let C be ? Get(originalArray, "constructor").
+ [...]
+ 7. If Type(C) is Object, then
+ a. Let C be ? Get(C, @@species).
+features: [Symbol.species]
+---*/
+
+var a = [];
+var callCount = 0;
+var cb = function() {
+ callCount += 1;
+};
+a.constructor = {};
+
+Object.defineProperty(a.constructor, Symbol.species, {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ a.filter(cb);
+});
+assert.sameValue(callCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/create-species-undef.js b/js/src/tests/test262/built-ins/Array/prototype/filter/create-species-undef.js
new file mode 100644
index 0000000000..ec36822363
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/create-species-undef.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-array.prototype.filter
+description: >
+ An undefined value for the @@species constructor triggers the creation of
+ an Array exotic object
+info: |
+ [...]
+ 5. Let A be ? ArraySpeciesCreate(O, 0).
+ [...]
+
+ 9.4.2.3 ArraySpeciesCreate
+
+ [...]
+ 5. Let C be ? Get(originalArray, "constructor").
+ [...]
+ 7. If Type(C) is Object, then
+ a. Let C be ? Get(C, @@species).
+ b. If C is null, let C be undefined.
+ 8. If C is undefined, return ? ArrayCreate(length).
+features: [Symbol.species]
+---*/
+
+var a = [];
+var result;
+
+a.constructor = {};
+a.constructor[Symbol.species] = undefined;
+
+result = a.filter(function() {});
+
+assert.sameValue(Object.getPrototypeOf(result), Array.prototype);
+assert(Array.isArray(result), 'result is an Array exotic object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/create-species.js b/js/src/tests/test262/built-ins/Array/prototype/filter/create-species.js
new file mode 100644
index 0000000000..82eadd41e9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/create-species.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-array.prototype.filter
+description: Species constructor is used to create a new instance
+info: |
+ [...]
+ 5. Let A be ? ArraySpeciesCreate(O, 0).
+ [...]
+
+ 9.4.2.3 ArraySpeciesCreate
+
+ [...]
+ 5. Let C be ? Get(originalArray, "constructor").
+ [...]
+ 7. If Type(C) is Object, then
+ a. Let C be ? Get(C, @@species).
+ b. If C is null, let C be undefined.
+ [...]
+ 10. Return ? Construct(C, « length »).
+features: [Symbol.species]
+---*/
+
+var thisValue, args, result;
+var callCount = 0;
+var instance = [];
+var Ctor = function() {
+ callCount += 1;
+ thisValue = this;
+ args = arguments;
+ return instance;
+};
+var a = [1, 2, 3, 4, 5, 6, 7];
+a.constructor = {};
+a.constructor[Symbol.species] = Ctor;
+
+result = a.filter(function() {});
+
+assert.sameValue(callCount, 1, 'Constructor invoked exactly once');
+assert.sameValue(Object.getPrototypeOf(thisValue), Ctor.prototype);
+assert.sameValue(args.length, 1, 'Constructor invoked with a single argument');
+assert.sameValue(args[0], 0);
+assert.sameValue(result, instance);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/length.js b/js/src/tests/test262/built-ins/Array/prototype/filter/length.js
new file mode 100644
index 0000000000..06c9cf9762
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/length.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2017 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ The "length" property of Array.prototype.filter
+info: |
+ 22.1.3.7 Array.prototype.filter ( callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects
+
+ Every built-in function object, including constructors, has a length property
+ whose value is an integer. Unless otherwise specified, this value is equal to
+ the largest number of named arguments shown in the subclause headings for the
+ function description. Optional parameters (which are indicated with brackets:
+ [ ]) or rest parameters (which are shown using the form «...name») are not
+ included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in function object
+ has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Array.prototype.filter.length, 1);
+
+verifyNotEnumerable(Array.prototype.filter, 'length');
+verifyNotWritable(Array.prototype.filter, 'length');
+verifyConfigurable(Array.prototype.filter, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/name.js b/js/src/tests/test262/built-ins/Array/prototype/filter/name.js
new file mode 100644
index 0000000000..4fbfcefd92
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/name.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Array.prototype.filter.name is "filter".
+info: |
+ Array.prototype.filter ( callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Array.prototype.filter.name, "filter");
+
+verifyNotEnumerable(Array.prototype.filter, "name");
+verifyNotWritable(Array.prototype.filter, "name");
+verifyConfigurable(Array.prototype.filter, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/not-a-constructor.js b/js/src/tests/test262/built-ins/Array/prototype/filter/not-a-constructor.js
new file mode 100644
index 0000000000..f9b011ced5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/not-a-constructor.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Array.prototype.filter does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, arrow-function]
+---*/
+
+assert.sameValue(
+ isConstructor(Array.prototype.filter),
+ false,
+ 'isConstructor(Array.prototype.filter) must return false'
+);
+
+assert.throws(TypeError, () => {
+ new Array.prototype.filter(() => {});
+}, '`new Array.prototype.filter(() => {})` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/prop-desc.js b/js/src/tests/test262/built-ins/Array/prototype/filter/prop-desc.js
new file mode 100644
index 0000000000..2f7d688805
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/prop-desc.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2017 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ "filter" property of Array.prototype
+info: |
+ 17 ECMAScript Standard Built-in Objects
+
+ Every other data property described in clauses 18 through 26 and in Annex B.2
+ has the attributes { [[Writable]]: true, [[Enumerable]]: false,
+ [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(typeof Array.prototype.filter, 'function', 'typeof');
+
+verifyNotEnumerable(Array.prototype, "filter");
+verifyWritable(Array.prototype, "filter");
+verifyConfigurable(Array.prototype, "filter");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/shell.js b/js/src/tests/test262/built-ins/Array/prototype/filter/shell.js
new file mode 100644
index 0000000000..05fecd6ef1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/shell.js
@@ -0,0 +1,161 @@
+// GENERATED, DO NOT EDIT
+// file: testTypedArray.js
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ Collection of functions used to assert the correctness of TypedArray objects.
+defines:
+ - floatArrayConstructors
+ - nonClampedIntArrayConstructors
+ - intArrayConstructors
+ - typedArrayConstructors
+ - TypedArray
+ - testWithTypedArrayConstructors
+ - nonAtomicsFriendlyTypedArrayConstructors
+ - testWithAtomicsFriendlyTypedArrayConstructors
+ - testWithNonAtomicsFriendlyTypedArrayConstructors
+ - testTypedArrayConversions
+---*/
+
+var floatArrayConstructors = [
+ Float64Array,
+ Float32Array
+];
+
+var nonClampedIntArrayConstructors = [
+ Int32Array,
+ Int16Array,
+ Int8Array,
+ Uint32Array,
+ Uint16Array,
+ Uint8Array
+];
+
+var intArrayConstructors = nonClampedIntArrayConstructors.concat([Uint8ClampedArray]);
+
+// Float16Array is a newer feature
+// adding it to this list unconditionally would cause implementations lacking it to fail every test which uses it
+if (typeof Float16Array !== 'undefined') {
+ floatArrayConstructors.push(Float16Array);
+}
+
+/**
+ * Array containing every non-bigint typed array constructor.
+ */
+
+var typedArrayConstructors = floatArrayConstructors.concat(intArrayConstructors);
+
+/**
+ * The %TypedArray% intrinsic constructor function.
+ */
+var TypedArray = Object.getPrototypeOf(Int8Array);
+
+/**
+ * Callback for testing a typed array constructor.
+ *
+ * @callback typedArrayConstructorCallback
+ * @param {Function} Constructor the constructor object to test with.
+ */
+
+/**
+ * Calls the provided function for every typed array constructor.
+ *
+ * @param {typedArrayConstructorCallback} f - the function to call for each typed array constructor.
+ * @param {Array} selected - An optional Array with filtered typed arrays
+ */
+function testWithTypedArrayConstructors(f, selected) {
+ var constructors = selected || typedArrayConstructors;
+ for (var i = 0; i < constructors.length; ++i) {
+ var constructor = constructors[i];
+ try {
+ f(constructor);
+ } catch (e) {
+ e.message += " (Testing with " + constructor.name + ".)";
+ throw e;
+ }
+ }
+}
+
+var nonAtomicsFriendlyTypedArrayConstructors = floatArrayConstructors.concat([Uint8ClampedArray]);
+/**
+ * Calls the provided function for every non-"Atomics Friendly" typed array constructor.
+ *
+ * @param {typedArrayConstructorCallback} f - the function to call for each typed array constructor.
+ * @param {Array} selected - An optional Array with filtered typed arrays
+ */
+function testWithNonAtomicsFriendlyTypedArrayConstructors(f) {
+ testWithTypedArrayConstructors(f, nonAtomicsFriendlyTypedArrayConstructors);
+}
+
+/**
+ * Calls the provided function for every "Atomics Friendly" typed array constructor.
+ *
+ * @param {typedArrayConstructorCallback} f - the function to call for each typed array constructor.
+ * @param {Array} selected - An optional Array with filtered typed arrays
+ */
+function testWithAtomicsFriendlyTypedArrayConstructors(f) {
+ testWithTypedArrayConstructors(f, [
+ Int32Array,
+ Int16Array,
+ Int8Array,
+ Uint32Array,
+ Uint16Array,
+ Uint8Array,
+ ]);
+}
+
+/**
+ * Helper for conversion operations on TypedArrays, the expected values
+ * properties are indexed in order to match the respective value for each
+ * TypedArray constructor
+ * @param {Function} fn - the function to call for each constructor and value.
+ * will be called with the constructor, value, expected
+ * value, and a initial value that can be used to avoid
+ * a false positive with an equivalent expected value.
+ */
+function testTypedArrayConversions(byteConversionValues, fn) {
+ var values = byteConversionValues.values;
+ var expected = byteConversionValues.expected;
+
+ testWithTypedArrayConstructors(function(TA) {
+ var name = TA.name.slice(0, -5);
+
+ return values.forEach(function(value, index) {
+ var exp = expected[name][index];
+ var initial = 0;
+ if (exp === 0) {
+ initial = 1;
+ }
+ fn(TA, value, exp, initial);
+ });
+ });
+}
+
+/**
+ * Checks if the given argument is one of the float-based TypedArray constructors.
+ *
+ * @param {constructor} ctor - the value to check
+ * @returns {boolean}
+ */
+function isFloatTypedArrayConstructor(arg) {
+ return floatArrayConstructors.indexOf(arg) !== -1;
+}
+
+/**
+ * Determines the precision of the given float-based TypedArray constructor.
+ *
+ * @param {constructor} ctor - the value to check
+ * @returns {string} "half", "single", or "double" for Float16Array, Float32Array, and Float64Array respectively.
+ */
+function floatTypedArrayConstructorPrecision(FA) {
+ if (typeof Float16Array !== "undefined" && FA === Float16Array) {
+ return "half";
+ } else if (FA === Float32Array) {
+ return "single";
+ } else if (FA === Float64Array) {
+ return "double";
+ } else {
+ throw new Error("Malformed test - floatTypedArrayConstructorPrecision called with non-float TypedArray");
+ }
+}
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/target-array-non-extensible.js b/js/src/tests/test262/built-ins/Array/prototype/filter/target-array-non-extensible.js
new file mode 100644
index 0000000000..e7f4d9e56b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/target-array-non-extensible.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ TypeError is thrown if CreateDataProperty fails.
+ (result object is non-extensible)
+info: |
+ Array.prototype.filter ( callbackfn [ , thisArg ] )
+
+ [...]
+ 7. Repeat, while k < len
+ [...]
+ c. If kPresent is true, then
+ [...]
+ iii. If selected is true, then
+ 1. Perform ? CreateDataPropertyOrThrow(A, ! ToString(to), kValue).
+ [...]
+
+ CreateDataPropertyOrThrow ( O, P, V )
+
+ [...]
+ 3. Let success be ? CreateDataProperty(O, P, V).
+ 4. If success is false, throw a TypeError exception.
+features: [Symbol.species]
+---*/
+
+var A = function(_length) {
+ this.length = 0;
+ Object.preventExtensions(this);
+};
+
+var arr = [1];
+arr.constructor = {};
+arr.constructor[Symbol.species] = A;
+
+assert.throws(TypeError, function() {
+ arr.filter(function() {
+ return true;
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/target-array-with-non-configurable-property.js b/js/src/tests/test262/built-ins/Array/prototype/filter/target-array-with-non-configurable-property.js
new file mode 100644
index 0000000000..2ee21a69ab
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/target-array-with-non-configurable-property.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ TypeError is thrown if CreateDataProperty fails.
+ (result object's "0" is non-configurable)
+info: |
+ Array.prototype.filter ( callbackfn [ , thisArg ] )
+
+ [...]
+ 7. Repeat, while k < len
+ [...]
+ c. If kPresent is true, then
+ [...]
+ iii. If selected is true, then
+ 1. Perform ? CreateDataPropertyOrThrow(A, ! ToString(to), kValue).
+ [...]
+
+ CreateDataPropertyOrThrow ( O, P, V )
+
+ [...]
+ 3. Let success be ? CreateDataProperty(O, P, V).
+ 4. If success is false, throw a TypeError exception.
+features: [Symbol.species]
+---*/
+
+var A = function(_length) {
+ Object.defineProperty(this, "0", {
+ writable: true,
+ configurable: false,
+ });
+};
+
+var arr = [1];
+arr.constructor = {};
+arr.constructor[Symbol.species] = A;
+
+assert.throws(TypeError, function() {
+ arr.filter(function() {
+ return true;
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Array/prototype/filter/target-array-with-non-writable-property.js b/js/src/tests/test262/built-ins/Array/prototype/filter/target-array-with-non-writable-property.js
new file mode 100644
index 0000000000..f158da2e74
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/filter/target-array-with-non-writable-property.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-array.prototype.filter
+description: >
+ Non-writable properties are overwritten by CreateDataPropertyOrThrow.
+info: |
+ 22.1.3.7 Array.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ ...
+ iii. If selected is true, then
+ 1. Perform ? CreateDataPropertyOrThrow(A, ! ToString(to), kValue).
+ ...
+features: [Symbol.species]
+includes: [propertyHelper.js]
+---*/
+
+var a = [1];
+a.constructor = {};
+a.constructor[Symbol.species] = function(len) {
+ var q = new Array(0);
+ Object.defineProperty(q, 0, {
+ value: 0, writable: false, configurable: true, enumerable: false,
+ });
+ return q;
+};
+
+var r = a.filter(function(){ return true; });
+
+verifyProperty(r, 0, {
+ value: 1, writable: true, configurable: true, enumerable: true,
+});
+
+reportCompare(0, 0);