mirror of
https://github.com/tc39/test262.git
synced 2025-05-03 14:30:27 +02:00
* [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)
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
A = class extends String { }
|
|
B = class extends A { get 4() { return 1; } }
|
|
C = class extends B { }
|
|
|
|
A.prototype[3] = 1;
|
|
|
|
function test() {
|
|
let a = new A("foo");
|
|
let b = new B("baz");
|
|
let c = new C("bar");
|
|
|
|
// String objects have a non-writable length property
|
|
a.length = 1;
|
|
b.length = 1;
|
|
c.length = 1;
|
|
|
|
if (a.length !== 3 || b.length !== 3 || c.length !== 3)
|
|
throw "not string objects";
|
|
|
|
if (!(a instanceof A && a instanceof String))
|
|
throw "a has incorrect prototype chain";
|
|
|
|
if (!(b instanceof B && b instanceof A && b instanceof String))
|
|
throw "b has incorrect prototype chain";
|
|
|
|
if (!(c instanceof C && c instanceof B && c instanceof A && c instanceof String))
|
|
throw "c has incorrect prototype chain";
|
|
|
|
if (a[4] !== undefined || b[4] !== 1 || c[4] !== 1)
|
|
throw "bad indexing type with accessors on chain";
|
|
|
|
if (a[3] !== 1 || b[3] !== 1 || c[3] !== 1)
|
|
throw "bad indexing type with values on chain";
|
|
}
|
|
noInline(test);
|
|
|
|
for (i = 0; i < 10000; i++)
|
|
test();
|