test262-automation e9a5a7f918 [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time) (#1620)
* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
2018-07-03 15:59:58 -04:00

36 lines
852 B
JavaScript

// This file tests subclassing arrays.
class A extends Array { }
class B extends A { get 1() { return 1; } }
class C extends B { }
function test() {
a = new A();
b = new B();
c = new C();
if (!Array.isArray(a) || !Array.isArray(b) || !Array.isArray(c))
throw "subclasses are not arrays";
if (!(a instanceof Array && a instanceof A))
throw "b has incorrect prototype chain";
if (!(b instanceof Array && b instanceof A && b instanceof B))
throw "b has incorrect prototype chain";
if (!(c instanceof Array && c instanceof A && c instanceof B && c instanceof C))
throw "c has incorrect prototype chain";
a[1] = 2;
b[1] = 2;
c[1] = 2;
if (a[1] !== 2 || b[1] !== 1 || c[1] !== 1)
throw "bad indexing type";
}
noInline(test);
for(i = 0; i < 10000; i++)
test();