summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/statements/class/subclass
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/language/statements/class/subclass')
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/binding.js54
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-multiple-arguments.js28
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-single-argument.js27
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/length.js38
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/regular-subclassing.js35
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/super-must-be-called.js34
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/regular-subclassing.js28
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/super-must-be-called.js35
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/regular-subclassing.js25
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/super-must-be-called.js33
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/regular-subclassing.js30
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/super-must-be-called.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/regular-subclassing.js39
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/super-must-be-called.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/message-property-assignment.js38
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/regular-subclassing.js24
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/super-must-be-called.js25
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/instance-length.js29
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/instance-name.js41
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/regular-subclassing.js22
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/super-must-be-called.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-length.js33
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-name.js48
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-prototype.js40
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/regular-subclassing.js31
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/super-must-be-called.js40
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/regular-subclassing.js28
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/super-must-be-called.js34
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-message.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-name.js20
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-super.js25
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-message.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-name.js20
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-super.js25
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-message.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-name.js20
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-super.js25
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-message.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-name.js20
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-super.js25
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-message.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-name.js20
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-super.js25
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-message.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-name.js20
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-super.js25
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/regular-subclassing.js25
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/super-must-be-called.js34
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/constructor-return-undefined-throws.js47
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/constructor-returns-non-object.js42
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/regular-subclassing.js22
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/replacing-prototype.js23
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/regular-subclassing.js38
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/super-must-be-called.js35
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/no-prototype-throws.js34
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/lastIndex.js28
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/regular-subclassing.js25
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/super-must-be-called.js34
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/regular-subclassing.js28
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/super-must-be-called.js34
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/length.js32
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/regular-subclassing.js24
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/super-must-be-called.js33
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/new-symbol-with-super-throws.js38
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/symbol-valid-as-extends-value.js19
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/regular-subclassing.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/super-must-be-called.js47
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/regular-subclassing.js31
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/super-must-be-called.js36
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/regular-subclassing.js30
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/super-must-be-called.js36
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtins.js32
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/class-definition-evaluation-empty-constructor-heritage-present.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-contains-return-override.js35
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-missing-return-override.js41
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-super.js54
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-this.js41
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto.js31
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/class-definition-parent-proto-null.js26
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/default-constructor-2.js65
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/default-constructor-spread-override.js27
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/default-constructor.js22
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-finally-arrow.js29
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-finally.js26
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-super-arrow.js27
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-super.js24
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch.js26
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-finally-super-arrow.js27
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-finally-super.js24
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-for-of-arrow.js40
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-for-of.js39
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-boolean.js32
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-empty.js42
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-null.js32
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-number.js32
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-object.js42
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-string.js32
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-symbol.js33
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-this.js43
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-undefined.js43
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/superclass-arrow-function.js53
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/superclass-async-function.js53
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/superclass-async-generator-function.js44
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/superclass-bound-function.js27
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/superclass-generator-function.js44
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/superclass-prototype-setter-constructor.js20
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/superclass-prototype-setter-method-override.js24
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/superclass-static-method-override.js23
154 files changed, 3546 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/class/subclass/binding.js b/js/src/tests/test262/language/statements/class/subclass/binding.js
new file mode 100644
index 0000000000..cd22c23d35
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/binding.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class subclass binding
+---*/
+class Base {
+ constructor(x, y) {
+ this.x = x;
+ this.y = y;
+ }
+}
+
+var obj = {};
+class Subclass extends Base {
+ constructor(x, y) {
+ super(x,y);
+ assert.sameValue(this !== obj, true, "The result of `this !== obj` is `true`");
+ }
+}
+
+var f = Subclass.bind(obj);
+assert.throws(TypeError, function () { f(1, 2); });
+var s = new f(1, 2);
+assert.sameValue(s.x, 1, "The value of `s.x` is `1`");
+assert.sameValue(s.y, 2, "The value of `s.y` is `2`");
+assert.sameValue(
+ Object.getPrototypeOf(s),
+ Subclass.prototype,
+ "`Object.getPrototypeOf(s)` returns `Subclass.prototype`"
+);
+
+var s1 = new f(1);
+assert.sameValue(s1.x, 1, "The value of `s1.x` is `1`");
+assert.sameValue(s1.y, undefined, "The value of `s1.y` is `undefined`");
+assert.sameValue(
+ Object.getPrototypeOf(s1),
+ Subclass.prototype,
+ "`Object.getPrototypeOf(s1)` returns `Subclass.prototype`"
+);
+
+var g = Subclass.bind(obj, 1);
+assert.throws(TypeError, function () { g(8); });
+var s2 = new g(8);
+assert.sameValue(s2.x, 1, "The value of `s2.x` is `1`");
+assert.sameValue(s2.y, 8, "The value of `s2.y` is `8`");
+assert.sameValue(
+ Object.getPrototypeOf(s),
+ Subclass.prototype,
+ "`Object.getPrototypeOf(s)` returns `Subclass.prototype`"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/browser.js b/js/src/tests/test262/language/statements/class/subclass/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-multiple-arguments.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-multiple-arguments.js
new file mode 100644
index 0000000000..e1d285b914
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-multiple-arguments.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 22.1.1
+description: >
+ Constructor calling super() with 2+ arguments creates an Array object
+info: |
+ 22.1.1 The Array Constructor
+
+ The Array constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the exotic Array behaviour must include a super call to the
+ Array constructor to initialize subclass instances that are exotic Array
+ objects.
+includes: [compareArray.js]
+---*/
+
+class Sub extends Array {
+ constructor(a, b) {
+ super(a, b);
+ }
+}
+
+var sub = new Sub(42, 'foo');
+
+assert.compareArray(sub, [42, 'foo']);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-single-argument.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-single-argument.js
new file mode 100644
index 0000000000..9311d7f278
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-single-argument.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 22.1.1
+description: >
+ Constructor calling super() with a single argument creates an Array object
+info: |
+ 22.1.1 The Array Constructor
+
+ The Array constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the exotic Array behaviour must include a super call to the
+ Array constructor to initialize subclass instances that are exotic Array
+ objects.
+---*/
+
+class Sub extends Array {
+ constructor(a) {
+ super(a);
+ }
+}
+
+var sub = new Sub(42);
+
+assert.sameValue(sub.length, 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/length.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/length.js
new file mode 100644
index 0000000000..e19bc322a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/length.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 22.1.4.1
+description: >
+ Instances has the own property length
+info: |
+ 22.1.4.1 length
+
+ The length property of an Array instance is a data property whose value is
+ always numerically greater than the name of every configurable own property
+ whose name is an array index.
+
+ The length property initially has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: false }.
+---*/
+
+class Ar extends Array {}
+
+var arr = new Ar('foo', 'bar');
+
+assert.sameValue(arr[0], 'foo');
+assert.sameValue(arr[1], 'bar');
+
+var arrDesc = Object.getOwnPropertyDescriptor(arr, 'length');
+
+assert.sameValue(arrDesc.writable, true);
+assert.sameValue(arrDesc.enumerable, false);
+assert.sameValue(arrDesc.configurable, false);
+
+assert.sameValue(arr[1], 'bar');
+
+arr.length = 1;
+
+assert.sameValue(arr[0], 'foo');
+assert.sameValue(arr[1], undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/regular-subclassing.js
new file mode 100644
index 0000000000..3b5df29719
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/regular-subclassing.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.
+/*---
+es6id: 22.1.1
+description: Subclassing Array
+info: |
+ 22.1.1 The Array Constructor
+
+ The Array constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. (...)
+includes: [compareArray.js]
+---*/
+
+class Sub extends Array {}
+
+var a1 = new Sub(42, 'foo');
+
+assert.sameValue(a1.length, 2);
+assert.sameValue(a1[0], 42);
+assert.sameValue(a1[1], 'foo');
+
+a1.push(true);
+assert.sameValue(a1.length, 3, 'Array#push updates the length property');
+assert.sameValue(a1[0], 42);
+assert.sameValue(a1[1], 'foo');
+assert.sameValue(a1[2], true, 'Adds new item');
+
+var a2 = new Sub(7);
+assert.sameValue(a2.length, 7);
+
+var a3 = new Sub();
+assert.compareArray(a3, []);
+assert.sameValue(a3.length, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/super-must-be-called.js
new file mode 100644
index 0000000000..134c3a7702
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/super-must-be-called.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.
+/*---
+es6id: 22.1.1
+description: Super need to be called to initialize internals
+info: |
+ 22.1.1 The Array Constructor
+
+ ...
+
+ The Array constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the exotic Array behaviour must include a super call to the
+ Array constructor to initialize subclass instances that are exotic Array
+ objects.
+---*/
+
+class A extends Array {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new A();
+});
+
+class A2 extends Array {
+ constructor() {
+ super();
+ }
+}
+
+new A2();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/regular-subclassing.js
new file mode 100644
index 0000000000..d2b319173a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/regular-subclassing.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 24.1.2
+description: Subclassing the ArrayBuffer object
+info: |
+ 24.1.2 The ArrayBuffer Constructor
+
+ ...
+
+ The ArrayBuffer constructor is designed to be subclassable. It may be used as
+ the value of an extends clause of a class definition. Subclass constructors
+ that intend to inherit the specified ArrayBuffer behaviour must include a
+ super call to the ArrayBuffer constructor to create and initialize subclass
+ instances with the internal state necessary to support the
+ ArrayBuffer.prototype built-in methods.
+---*/
+
+class AB extends ArrayBuffer {}
+
+var ab = new AB(4);
+
+var sliced = ab.slice(0, 1);
+
+assert(sliced instanceof AB);
+assert(sliced instanceof ArrayBuffer);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/super-must-be-called.js
new file mode 100644
index 0000000000..232c344cee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/super-must-be-called.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.
+/*---
+es6id: 24.1.2
+description: Super need to be called to initialize internals
+info: |
+ 24.1.2 The ArrayBuffer Constructor
+
+ ...
+
+ The ArrayBuffer constructor is designed to be subclassable. It may be used as
+ the value of an extends clause of a class definition. Subclass constructors
+ that intend to inherit the specified ArrayBuffer behaviour must include a
+ super call to the ArrayBuffer constructor to create and initialize subclass
+ instances with the internal state necessary to support the
+ ArrayBuffer.prototype built-in methods.
+---*/
+
+class AB1 extends ArrayBuffer {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new AB1(1);
+});
+
+class AB2 extends ArrayBuffer {
+ constructor(length) {
+ super(length);
+ }
+}
+
+new AB2(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/regular-subclassing.js
new file mode 100644
index 0000000000..e296c1d4e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/regular-subclassing.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.3.1
+description: Subclassing Function
+info: |
+ 19.3.1 The Boolean Constructor
+
+ The Boolean constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition.
+ ...
+---*/
+
+class Bln extends Boolean {}
+
+var b1 = new Bln(1);
+
+assert.notSameValue(b1, true, 'b1 is an Boolean object');
+assert.sameValue(b1.valueOf(), true);
+
+var b2 = new Bln(0);
+assert.notSameValue(b2, false, 'bln is an Boolean object');
+assert.sameValue(b2.valueOf(), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/super-must-be-called.js
new file mode 100644
index 0000000000..fde940702f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/super-must-be-called.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.3.1
+description: Super need to be called to initialize Boolean internals
+info: |
+ 19.3.1 The Boolean Constructor
+
+ ...
+ Subclass constructors that intend to inherit the specified Boolean behaviour
+ must include a super call to the Boolean constructor to create and initialize
+ the subclass instance with a [[BooleanData]] internal slot.
+---*/
+
+class Bln extends Boolean {
+ constructor() {}
+}
+
+// Boolean internals are not initialized
+assert.throws(ReferenceError, function() {
+ new Bln(1);
+});
+
+class Bln2 extends Boolean {
+ constructor() {
+ super();
+ }
+}
+
+var b = new Bln2(1);
+assert(b instanceof Boolean);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/regular-subclassing.js
new file mode 100644
index 0000000000..fe91d32a2b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/regular-subclassing.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 24.2.2
+description: Subclassing the DataView object
+info: |
+ 24.2.2 The DataView Constructor
+
+ ...
+
+ The DataView constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified DataView behaviour must include a super call
+ to the DataView constructor to create and initialize subclass instances with
+ the internal state necessary to support the DataView.prototype built-in
+ methods.
+---*/
+
+class DV extends DataView {}
+
+var buffer = new ArrayBuffer(1);
+
+var dv = new DV(buffer);
+assert.sameValue(dv.buffer, buffer);
+
+assert.throws(TypeError, function() {
+ new DV();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/super-must-be-called.js
new file mode 100644
index 0000000000..9693b9a205
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/super-must-be-called.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 24.2.2
+description: Super need to be called to initialize internals
+info: |
+ 24.2.2 The DataView Constructor
+
+ ...
+
+ The DataView constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified DataView behaviour must include a super call
+ to the DataView constructor to create and initialize subclass instances with
+ the internal state necessary to support the DataView.prototype built-in
+ methods.
+---*/
+
+class DV1 extends DataView {
+ constructor() {}
+}
+
+var buffer = new ArrayBuffer(1);
+
+assert.throws(ReferenceError, function() {
+ new DV1(buffer);
+});
+
+class DV2 extends DataView {
+ constructor(length) {
+ super(length);
+ }
+}
+
+new DV2(buffer);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/regular-subclassing.js
new file mode 100644
index 0000000000..41619f26b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/regular-subclassing.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.
+/*---
+es6id: 20.3.2
+description: Subclassing the String object
+info: |
+ 20.3.2 The Date Constructor
+
+ ...
+
+ The Date constructor is a single function whose behaviour is overloaded based
+ upon the number and types of its arguments.
+
+ The Date constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Date behaviour must include a super call to
+ the Date constructor to create and initialize the subclass instance with a
+ [[DateValue]] internal slot.
+---*/
+
+class D extends Date {}
+
+var d1 = new D(1859, '10', 24, 11);
+assert.sameValue(d1.getFullYear(), 1859);
+assert.sameValue(d1.getMonth(), 10);
+assert.sameValue(d1.getDate(), 24);
+
+var d2 = new D(-3474558000000);
+assert.sameValue(d2.getUTCFullYear(), 1859);
+assert.sameValue(d2.getUTCMonth(), 10);
+assert.sameValue(d2.getUTCDate(), 24);
+
+var d3 = new D();
+var d4 = new Date();
+assert.sameValue(d3.getFullYear(), d4.getFullYear());
+assert.sameValue(d3.getMonth(), d4.getMonth());
+assert.sameValue(d3.getDate(), d4.getDate());
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/super-must-be-called.js
new file mode 100644
index 0000000000..8099ac871f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/super-must-be-called.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 20.3.2
+description: Super need to be called to initialize internals
+info: |
+ 20.3.2 The Date Constructor
+
+ ...
+
+ The Date constructor is a single function whose behaviour is overloaded based
+ upon the number and types of its arguments.
+
+ The Date constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Date behaviour must include a super call to
+ the Date constructor to create and initialize the subclass instance with a
+ [[DateValue]] internal slot.
+---*/
+
+class D extends Date {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new D();
+});
+
+class D2 extends Date {
+ constructor() {
+ super();
+ }
+}
+
+new D2();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/message-property-assignment.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/message-property-assignment.js
new file mode 100644
index 0000000000..afa9b7e924
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/message-property-assignment.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.1.1
+description: >
+ A new instance has the message property if created with a parameter
+info: |
+ 19.5.1.1 Error ( message )
+
+ ...
+ 4. If message is not undefined, then
+ a. Let msg be ToString(message).
+ b. ReturnIfAbrupt(msg).
+ c. Let msgDesc be the PropertyDescriptor{[[Value]]: msg, [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true}.
+ d. Let status be DefinePropertyOrThrow(O, "message", msgDesc).
+ ...
+includes: [propertyHelper.js]
+
+---*/
+
+class Err extends Error {}
+
+Err.prototype.message = 'custom-error';
+
+var err1 = new Err('foo 42');
+assert.sameValue(err1.message, 'foo 42');
+assert(err1.hasOwnProperty('message'));
+
+verifyWritable(err1, 'message');
+verifyNotEnumerable(err1, 'message');
+verifyConfigurable(err1, 'message');
+
+var err2 = new Err();
+assert.sameValue(err2.hasOwnProperty('message'), false);
+assert.sameValue(err2.message, 'custom-error');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/regular-subclassing.js
new file mode 100644
index 0000000000..d34c85cb3c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/regular-subclassing.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.1
+description: Subclassing the Error object
+info: |
+ 19.5.1 The Error Constructor
+
+ ...
+ The Error constructor is designed to be subclassable. It may be used as the
+ alue of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Error behaviour must include a super call to
+ the Error constructor to create and initialize subclass instances with a
+ [[ErrorData]] internal slot.
+---*/
+
+class CustomError extends Error {}
+
+var err = new CustomError('foo 42');
+
+assert.sameValue(err.message, 'foo 42');
+assert.sameValue(err.name, 'Error');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/super-must-be-called.js
new file mode 100644
index 0000000000..8d7dcae53e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/super-must-be-called.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.1
+description: Super need to be called to initialize internals
+info: |
+ 19.5.1 The Error Constructor
+
+ ...
+ The Error constructor is designed to be subclassable. It may be used as the
+ alue of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Error behaviour must include a super call to
+ the Error constructor to create and initialize subclass instances with a
+ [[ErrorData]] internal slot.
+---*/
+
+class CustomError extends Error {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new CustomError('foo');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/instance-length.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/instance-length.js
new file mode 100644
index 0000000000..d14cd344d4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/instance-length.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.2.4.1
+description: Subclassed Function instances has length and name properties
+info: |
+ 19.2.4.1 length
+
+ The value of the length property is an integer that indicates the typical
+ number of arguments expected by the function. However, the language permits
+ the function to be invoked with some other number of arguments. The behaviour
+ of a function when invoked on a number of arguments other than the number
+ specified by its length property depends on the function. This property has
+ the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+class Fn extends Function {}
+
+var fn = new Fn('a', 'b', 'return a + b');
+
+assert.sameValue(fn.length, 2);
+
+verifyNotEnumerable(fn, 'length');
+verifyNotWritable(fn, 'length');
+verifyConfigurable(fn, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/instance-name.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/instance-name.js
new file mode 100644
index 0000000000..6648909da4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/instance-name.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.
+/*---
+es6id: 19.2.4.2
+description: Subclassed Function instances has length and name properties
+info: |
+ 19.2.4.2 name
+
+ The value of the name property is an String that is descriptive of the
+ function. The name has no semantic significance but is typically a variable or
+ property name that is used to refer to the function at its point of definition
+ in ECMAScript code. This property has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+
+ Anonymous functions objects that do not have a contextual name associated with
+ them by this specification do not have a name own property but inherit the
+ name property of %FunctionPrototype%.
+
+ 19.2.1.1.1 RuntimeSemantics: CreateDynamicFunction(constructor, newTarget,
+ kind, args)
+
+ ...
+ 29. Perform SetFunctionName(F, "anonymous").
+ ...
+includes: [propertyHelper.js]
+---*/
+
+class Fn extends Function {}
+
+var fn = new Fn('a', 'b', 'return a + b');
+
+assert.sameValue(
+ fn.name, 'anonymous',
+ 'Dynamic Functions are called anonymous'
+);
+
+verifyNotEnumerable(fn, 'name');
+verifyNotWritable(fn, 'name');
+verifyConfigurable(fn, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/regular-subclassing.js
new file mode 100644
index 0000000000..d68fb28206
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/regular-subclassing.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.2.1
+description: Subclassing Function
+info: |
+ 19.2.1 The Function Constructor
+
+ ...
+
+ The Function constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition.
+ ...
+---*/
+
+class Fn extends Function {}
+
+var fn = new Fn('a', 'return a * 2');
+
+assert.sameValue(fn(42), 84);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/super-must-be-called.js
new file mode 100644
index 0000000000..9d8fc30c0c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/super-must-be-called.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.2.1
+description: >
+ super must be called to initialize Function internal slots
+info: |
+ 19.2.1 The Function Constructor
+
+ ...
+
+ The Function constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Function behaviour must include a super call
+ to the Function constructor to create and initialize a subclass instances with
+ the internal slots necessary for built-in function behaviour.
+ ...
+---*/
+
+class Fn extends Function {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new Fn();
+});
+
+class Fn2 extends Function {
+ constructor() {
+ super();
+ }
+}
+
+var fn = new Fn2();
+assert(fn instanceof Function);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-length.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-length.js
new file mode 100644
index 0000000000..f5d17fe131
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-length.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 25.2.4.1
+description: >
+ Subclassed GeneratorFunction instances `length` property
+info: |
+ 25.2.4.1 length
+
+ The value of the length property is an integer that indicates the typical
+ number of arguments expected by the GeneratorFunction. However, the language
+ permits the function to be invoked with some other number of arguments. The
+ behaviour of a GeneratorFunction when invoked on a number of arguments other
+ than the number specified by its length property depends on the function.
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor;
+
+class GFn extends GeneratorFunction {}
+
+var gfn = new GFn('a', 'b', 'return a + b');
+
+assert.sameValue(gfn.length, 2);
+
+verifyNotEnumerable(gfn, 'length');
+verifyNotWritable(gfn, 'length');
+verifyConfigurable(gfn, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-name.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-name.js
new file mode 100644
index 0000000000..69be80c2e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-name.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 25.2.4.2
+description: Subclassed GeneratorFunction instances `name` property
+info: |
+ 25.2.4.2 name
+
+ The specification for the name property of Function instances given in
+ 19.2.4.2 also applies to GeneratorFunction instances.
+
+ 19.2.4.2 name
+
+ The value of the name property is an String that is descriptive of the
+ function. The name has no semantic significance but is typically a variable or
+ property name that is used to refer to the function at its point of definition
+ in ECMAScript code. This property has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+
+ Anonymous functions objects that do not have a contextual name associated with
+ them by this specification do not have a name own property but inherit the
+ name property of %FunctionPrototype%.
+
+ 19.2.1.1.1 RuntimeSemantics: CreateDynamicFunction(constructor, newTarget,
+ kind, args)
+
+ ...
+ 29. Perform SetFunctionName(F, "anonymous").
+ ...
+includes: [propertyHelper.js]
+---*/
+
+var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor;
+
+class GFn extends GeneratorFunction {}
+
+var gfn = new GFn('a', 'b', 'return a + b');
+
+assert.sameValue(
+ gfn.name, 'anonymous',
+ 'Dynamic Functions are called anonymous'
+);
+
+verifyNotEnumerable(gfn, 'name');
+verifyNotWritable(gfn, 'name');
+verifyConfigurable(gfn, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-prototype.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-prototype.js
new file mode 100644
index 0000000000..3b4029adcd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-prototype.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.
+/*---
+es6id: 25.2.4.3
+description: >
+ Subclassed GeneratorFunction instances `prototype` property
+info: |
+ 25.2.4.3 prototype
+
+ Whenever a GeneratorFunction instance is created another ordinary object is
+ also created and is the initial value of the generator function’s prototype
+ property. The value of the prototype property is used to initialize the
+ [[Prototype]] internal slot of a newly created Generator object when the
+ generator function object is invoked using either [[Call]] or [[Construct]].
+
+ This property has the attributes { [[Writable]]: true, [[Enumerable]]: false,
+ [[Configurable]]: false }.
+includes: [propertyHelper.js]
+---*/
+
+var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor;
+
+class GFn extends GeneratorFunction {}
+
+var gfn = new GFn(';');
+
+assert.sameValue(
+ Object.keys(gfn.prototype).length, 0,
+ 'prototype is a new ordinary object'
+);
+assert.sameValue(
+ gfn.prototype.hasOwnProperty('constructor'), false,
+ 'prototype has no constructor reference'
+);
+
+verifyNotEnumerable(gfn, 'prototype');
+verifyWritable(gfn, 'prototype');
+verifyNotConfigurable(gfn, 'prototype');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/regular-subclassing.js
new file mode 100644
index 0000000000..55a8c2ded5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/regular-subclassing.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 25.2.1
+description: Subclassing GeneratorFunction
+info: |
+ 25.2.1 The GeneratorFunction Constructor
+
+ ...
+
+ GeneratorFunction is designed to be subclassable. It may be used as the value
+ of an extends clause of a class definition. Subclass constructors that intend
+ to inherit the specified GeneratorFunction behaviour must include a super call
+ to the GeneratorFunction constructor to create and initialize subclass
+ instances with the internal slots necessary for built-in GeneratorFunction
+ behaviour.
+ ...
+---*/
+
+var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor;
+
+class Gfn extends GeneratorFunction {}
+
+var gfn = new Gfn('a', 'yield a; yield a * 2;');
+
+var iter = gfn(42);
+
+assert.sameValue(iter.next().value, 42);
+assert.sameValue(iter.next().value, 84);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/super-must-be-called.js
new file mode 100644
index 0000000000..6d3aa6004d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/super-must-be-called.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.
+/*---
+es6id: 25.2.1
+description: >
+ super must be called to initialize GeneratorFunction internal slots
+info: |
+ 25.2.1 The GeneratorFunction Constructor
+
+ ...
+
+ GeneratorFunction is designed to be subclassable. It may be used as the value
+ of an extends clause of a class definition. Subclass constructors that intend
+ to inherit the specified GeneratorFunction behaviour must include a super call
+ to the GeneratorFunction constructor to create and initialize subclass
+ instances with the internal slots necessary for built-in GeneratorFunction
+ behaviour.
+ ...
+---*/
+
+var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor;
+
+class GFn1 extends GeneratorFunction {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new GFn1();
+});
+
+class GFn2 extends GeneratorFunction {
+ constructor() {
+ super();
+ }
+}
+
+var fn = new GFn2();
+assert(fn instanceof GeneratorFunction);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/regular-subclassing.js
new file mode 100644
index 0000000000..755b2b1faa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/regular-subclassing.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1
+description: Subclassing the Map object
+info: |
+ 23.1.1 The Map Constructor
+
+ ...
+
+ The Map constructor is designed to be subclassable. It may be used as the
+ value in an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Map behaviour must include a super call to the
+ Map constructor to create and initialize the subclass instance with the
+ internal state necessary to support the Map.prototype built-in methods.
+---*/
+
+class M extends Map {}
+
+var map = new M([{ 'foo': 'bar' }]);
+
+assert.sameValue(map.size, 1);
+
+map.set('bar', 'baz');
+
+assert.sameValue(map.size, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/super-must-be-called.js
new file mode 100644
index 0000000000..23d3e8dbf8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/super-must-be-called.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.
+/*---
+es6id: 23.1.1
+description: Super need to be called to initialize internals
+info: |
+ 23.1.1 The Map Constructor
+
+ ...
+
+ The Map constructor is designed to be subclassable. It may be used as the
+ value in an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Map behaviour must include a super call to the
+ Map constructor to create and initialize the subclass instance with the
+ internal state necessary to support the Map.prototype built-in methods.
+---*/
+
+class M1 extends Map {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new M1();
+});
+
+class M2 extends Map {
+ constructor() {
+ super();
+ }
+}
+
+new M2();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-message.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-message.js
new file mode 100644
index 0000000000..6d911069bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-message.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ A new instance has the message property if created with a parameter
+info: |
+ 19.5.6.1.1 NativeError ( message )
+
+ ...
+ 4. If message is not undefined, then
+ a. Let msg be ToString(message).
+ b. Let msgDesc be the PropertyDescriptor{[[Value]]: msg, [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true}.
+ c. Let status be DefinePropertyOrThrow(O, "message", msgDesc).
+ ...
+includes: [propertyHelper.js]
+
+---*/
+
+class Err extends EvalError {}
+
+Err.prototype.message = 'custom-eval-error';
+
+var err1 = new Err('foo 42');
+assert.sameValue(err1.message, 'foo 42');
+assert(err1.hasOwnProperty('message'));
+
+verifyWritable(err1, 'message');
+verifyNotEnumerable(err1, 'message');
+verifyConfigurable(err1, 'message');
+
+var err2 = new Err();
+assert.sameValue(err2.hasOwnProperty('message'), false);
+assert.sameValue(err2.message, 'custom-eval-error');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-name.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-name.js
new file mode 100644
index 0000000000..9f4c87eeb5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-name.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ The name property on a new instance
+info: |
+ 19.5.6.3.3 NativeError.prototype.name
+
+ The initial value of the name property of the prototype for a given
+ NativeError constructor is a string consisting of the name of the constructor
+ (the name used instead of NativeError).
+---*/
+
+class Err extends EvalError {}
+
+var err1 = new Err();
+assert.sameValue(err1.name, 'EvalError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-super.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-super.js
new file mode 100644
index 0000000000..3e7055bcc0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-super.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1
+description: Super need to be called to initialize internals
+info: |
+ 19.5.6.1 NativeError Constructors
+
+ ...
+ Each NativeError constructor is designed to be subclassable. It may be used as
+ the value of an extends clause of a class definition. Subclass constructors
+ that intend to inherit the specified NativeError behaviour must include a
+ super call to the NativeError constructor to create and initialize subclass
+ instances with a [[ErrorData]] internal slot.
+---*/
+
+class CustomError extends EvalError {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new CustomError();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-message.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-message.js
new file mode 100644
index 0000000000..28931bfcd5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-message.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ A new instance has the message property if created with a parameter
+info: |
+ 19.5.6.1.1 NativeError ( message )
+
+ ...
+ 4. If message is not undefined, then
+ a. Let msg be ToString(message).
+ b. Let msgDesc be the PropertyDescriptor{[[Value]]: msg, [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true}.
+ c. Let status be DefinePropertyOrThrow(O, "message", msgDesc).
+ ...
+includes: [propertyHelper.js]
+
+---*/
+
+class Err extends RangeError {}
+
+Err.prototype.message = 'custom-range-error';
+
+var err1 = new Err('foo 42');
+assert.sameValue(err1.message, 'foo 42');
+assert(err1.hasOwnProperty('message'));
+
+verifyWritable(err1, 'message');
+verifyNotEnumerable(err1, 'message');
+verifyConfigurable(err1, 'message');
+
+var err2 = new Err();
+assert.sameValue(err2.hasOwnProperty('message'), false);
+assert.sameValue(err2.message, 'custom-range-error');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-name.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-name.js
new file mode 100644
index 0000000000..49a05b2ab0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-name.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ The name property on a new instance
+info: |
+ 19.5.6.3.3 NativeError.prototype.name
+
+ The initial value of the name property of the prototype for a given
+ NativeError constructor is a string consisting of the name of the constructor
+ (the name used instead of NativeError).
+---*/
+
+class Err extends RangeError {}
+
+var err1 = new Err();
+assert.sameValue(err1.name, 'RangeError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-super.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-super.js
new file mode 100644
index 0000000000..af5a17d16e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-super.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1
+description: Super need to be called to initialize internals
+info: |
+ 19.5.6.1 NativeError Constructors
+
+ ...
+ Each NativeError constructor is designed to be subclassable. It may be used as
+ the value of an extends clause of a class definition. Subclass constructors
+ that intend to inherit the specified NativeError behaviour must include a
+ super call to the NativeError constructor to create and initialize subclass
+ instances with a [[ErrorData]] internal slot.
+---*/
+
+class CustomError extends RangeError {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new CustomError();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-message.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-message.js
new file mode 100644
index 0000000000..cb5626c984
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-message.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ A new instance has the message property if created with a parameter
+info: |
+ 19.5.6.1.1 NativeError ( message )
+
+ ...
+ 4. If message is not undefined, then
+ a. Let msg be ToString(message).
+ b. Let msgDesc be the PropertyDescriptor{[[Value]]: msg, [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true}.
+ c. Let status be DefinePropertyOrThrow(O, "message", msgDesc).
+ ...
+includes: [propertyHelper.js]
+
+---*/
+
+class Err extends ReferenceError {}
+
+Err.prototype.message = 'custom-reference-error';
+
+var err1 = new Err('foo 42');
+assert.sameValue(err1.message, 'foo 42');
+assert(err1.hasOwnProperty('message'));
+
+verifyWritable(err1, 'message');
+verifyNotEnumerable(err1, 'message');
+verifyConfigurable(err1, 'message');
+
+var err2 = new Err();
+assert.sameValue(err2.hasOwnProperty('message'), false);
+assert.sameValue(err2.message, 'custom-reference-error');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-name.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-name.js
new file mode 100644
index 0000000000..8898f2e7b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-name.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ The name property on a new instance
+info: |
+ 19.5.6.3.3 NativeError.prototype.name
+
+ The initial value of the name property of the prototype for a given
+ NativeError constructor is a string consisting of the name of the constructor
+ (the name used instead of NativeError).
+---*/
+
+class Err extends ReferenceError {}
+
+var err1 = new Err();
+assert.sameValue(err1.name, 'ReferenceError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-super.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-super.js
new file mode 100644
index 0000000000..b8517e4e25
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-super.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1
+description: Super need to be called to initialize internals
+info: |
+ 19.5.6.1 NativeError Constructors
+
+ ...
+ Each NativeError constructor is designed to be subclassable. It may be used as
+ the value of an extends clause of a class definition. Subclass constructors
+ that intend to inherit the specified NativeError behaviour must include a
+ super call to the NativeError constructor to create and initialize subclass
+ instances with a [[ErrorData]] internal slot.
+---*/
+
+class CustomError extends ReferenceError {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new CustomError();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-message.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-message.js
new file mode 100644
index 0000000000..c5460959d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-message.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ A new instance has the message property if created with a parameter
+info: |
+ 19.5.6.1.1 NativeError ( message )
+
+ ...
+ 4. If message is not undefined, then
+ a. Let msg be ToString(message).
+ b. Let msgDesc be the PropertyDescriptor{[[Value]]: msg, [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true}.
+ c. Let status be DefinePropertyOrThrow(O, "message", msgDesc).
+ ...
+includes: [propertyHelper.js]
+
+---*/
+
+class Err extends SyntaxError {}
+
+Err.prototype.message = 'custom-syntax-error';
+
+var err1 = new Err('foo 42');
+assert.sameValue(err1.message, 'foo 42');
+assert(err1.hasOwnProperty('message'));
+
+verifyWritable(err1, 'message');
+verifyNotEnumerable(err1, 'message');
+verifyConfigurable(err1, 'message');
+
+var err2 = new Err();
+assert.sameValue(err2.hasOwnProperty('message'), false);
+assert.sameValue(err2.message, 'custom-syntax-error');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-name.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-name.js
new file mode 100644
index 0000000000..19719c503c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-name.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ The name property on a new instance
+info: |
+ 19.5.6.3.3 NativeError.prototype.name
+
+ The initial value of the name property of the prototype for a given
+ NativeError constructor is a string consisting of the name of the constructor
+ (the name used instead of NativeError).
+---*/
+
+class Err extends SyntaxError {}
+
+var err1 = new Err();
+assert.sameValue(err1.name, 'SyntaxError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-super.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-super.js
new file mode 100644
index 0000000000..00c4865cab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-super.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1
+description: Super need to be called to initialize internals
+info: |
+ 19.5.6.1 NativeError Constructors
+
+ ...
+ Each NativeError constructor is designed to be subclassable. It may be used as
+ the value of an extends clause of a class definition. Subclass constructors
+ that intend to inherit the specified NativeError behaviour must include a
+ super call to the NativeError constructor to create and initialize subclass
+ instances with a [[ErrorData]] internal slot.
+---*/
+
+class CustomError extends SyntaxError {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new CustomError();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-message.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-message.js
new file mode 100644
index 0000000000..855e3ad1a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-message.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ A new instance has the message property if created with a parameter
+info: |
+ 19.5.6.1.1 NativeError ( message )
+
+ ...
+ 4. If message is not undefined, then
+ a. Let msg be ToString(message).
+ b. Let msgDesc be the PropertyDescriptor{[[Value]]: msg, [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true}.
+ c. Let status be DefinePropertyOrThrow(O, "message", msgDesc).
+ ...
+includes: [propertyHelper.js]
+
+---*/
+
+class Err extends TypeError {}
+
+Err.prototype.message = 'custom-type-error';
+
+var err1 = new Err('foo 42');
+assert.sameValue(err1.message, 'foo 42');
+assert(err1.hasOwnProperty('message'));
+
+verifyWritable(err1, 'message');
+verifyNotEnumerable(err1, 'message');
+verifyConfigurable(err1, 'message');
+
+var err2 = new Err();
+assert.sameValue(err2.hasOwnProperty('message'), false);
+assert.sameValue(err2.message, 'custom-type-error');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-name.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-name.js
new file mode 100644
index 0000000000..ca1cb0995a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-name.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ The name property on a new instance
+info: |
+ 19.5.6.3.3 NativeError.prototype.name
+
+ The initial value of the name property of the prototype for a given
+ NativeError constructor is a string consisting of the name of the constructor
+ (the name used instead of NativeError).
+---*/
+
+class Err extends TypeError {}
+
+var err1 = new Err();
+assert.sameValue(err1.name, 'TypeError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-super.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-super.js
new file mode 100644
index 0000000000..80fcbf935a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-super.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1
+description: Super need to be called to initialize internals
+info: |
+ 19.5.6.1 NativeError Constructors
+
+ ...
+ Each NativeError constructor is designed to be subclassable. It may be used as
+ the value of an extends clause of a class definition. Subclass constructors
+ that intend to inherit the specified NativeError behaviour must include a
+ super call to the NativeError constructor to create and initialize subclass
+ instances with a [[ErrorData]] internal slot.
+---*/
+
+class CustomError extends TypeError {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new CustomError();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-message.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-message.js
new file mode 100644
index 0000000000..1131b75185
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-message.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ A new instance has the message property if created with a parameter
+info: |
+ 19.5.6.1.1 NativeError ( message )
+
+ ...
+ 4. If message is not undefined, then
+ a. Let msg be ToString(message).
+ b. Let msgDesc be the PropertyDescriptor{[[Value]]: msg, [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true}.
+ c. Let status be DefinePropertyOrThrow(O, "message", msgDesc).
+ ...
+includes: [propertyHelper.js]
+
+---*/
+
+class Err extends URIError {}
+
+Err.prototype.message = 'custom-uri-error';
+
+var err1 = new Err('foo 42');
+assert.sameValue(err1.message, 'foo 42');
+assert(err1.hasOwnProperty('message'));
+
+verifyWritable(err1, 'message');
+verifyNotEnumerable(err1, 'message');
+verifyConfigurable(err1, 'message');
+
+var err2 = new Err();
+assert.sameValue(err2.hasOwnProperty('message'), false);
+assert.sameValue(err2.message, 'custom-uri-error');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-name.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-name.js
new file mode 100644
index 0000000000..83d8d8f5e8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-name.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ The name property on a new instance
+info: |
+ 19.5.6.3.3 NativeError.prototype.name
+
+ The initial value of the name property of the prototype for a given
+ NativeError constructor is a string consisting of the name of the constructor
+ (the name used instead of NativeError).
+---*/
+
+class Err extends URIError {}
+
+var err1 = new Err();
+assert.sameValue(err1.name, 'URIError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-super.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-super.js
new file mode 100644
index 0000000000..3714a11749
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-super.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1
+description: Super need to be called to initialize internals
+info: |
+ 19.5.6.1 NativeError Constructors
+
+ ...
+ Each NativeError constructor is designed to be subclassable. It may be used as
+ the value of an extends clause of a class definition. Subclass constructors
+ that intend to inherit the specified NativeError behaviour must include a
+ super call to the NativeError constructor to create and initialize subclass
+ instances with a [[ErrorData]] internal slot.
+---*/
+
+class CustomError extends URIError {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new CustomError();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/regular-subclassing.js
new file mode 100644
index 0000000000..f5764f046f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/regular-subclassing.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 20.1.1
+description: Subclassing the Number object
+info: |
+ 20.1.1 The Number Constructor
+
+ ...
+
+ The Number constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Number behaviour must include a super call to
+ the Number constructor to create and initialize the subclass instance with a
+ [[NumberData]] internal slot.
+---*/
+
+class N extends Number {}
+
+var n = new N(42);
+
+assert.sameValue(n.toFixed(2), '42.00');
+assert.sameValue(n.toExponential(2), '4.20e+1');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/super-must-be-called.js
new file mode 100644
index 0000000000..fb37ca829c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/super-must-be-called.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.
+/*---
+es6id: 20.1.1
+description: Super need to be called to initialize internals
+info: |
+ 20.1.1 The Number Constructor
+
+ ...
+
+ The Number constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Number behaviour must include a super call to
+ the Number constructor to create and initialize the subclass instance with a
+ [[NumberData]] internal slot.
+---*/
+
+class N extends Number {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new N();
+});
+
+class N2 extends Number {
+ constructor() {
+ super();
+ }
+}
+
+new N2();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/constructor-return-undefined-throws.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/constructor-return-undefined-throws.js
new file mode 100644
index 0000000000..ddf4ec4795
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/constructor-return-undefined-throws.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: Throws a ReferenceError if constructor result is undefined
+info: |
+ 9.2.2 [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 11. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ ...
+ 13. If result.[[type]] is return, then
+ a. If Type(result.[[value]]) is Object, return
+ NormalCompletion(result.[[value]]).
+ ...
+ c. If result.[[value]] is not undefined, throw a TypeError exception.
+ ...
+ 15. Return envRec.GetThisBinding().
+
+ 8.1.1.3.4 GetThisBinding ()
+
+ ...
+ 3. If envRec.[[thisBindingStatus]] is "uninitialized", throw a ReferenceError
+ exception.
+ ...
+
+---*/
+
+class Obj extends Object {
+ constructor() {
+ return undefined;
+ }
+}
+
+class Obj2 extends Object {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new Obj();
+});
+
+assert.throws(ReferenceError, function() {
+ new Obj2();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/constructor-returns-non-object.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/constructor-returns-non-object.js
new file mode 100644
index 0000000000..6f266cc1e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/constructor-returns-non-object.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: The Type of the return value must be an Object
+info: |
+ 9.2.2 [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 11. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ ...
+ 13. If result.[[type]] is return, then
+ a. If Type(result.[[value]]) is Object, return
+ NormalCompletion(result.[[value]]).
+ ...
+ c. If result.[[value]] is not undefined, throw a TypeError exception.
+ ...
+
+ 6.1.7.2 Object Internal Methods and Internal Slots
+
+ ...
+ If any specified use of an internal method of an exotic object is not
+ supported by an implementation, that usage must throw a TypeError exception
+ when attempted.
+
+ 6.1.7.3 Invariants of the Essential Internal Methods
+
+ [[Construct]] ( )
+ - The Type of the return value must be Object.
+---*/
+
+class Obj extends Object {
+ constructor() {
+ return 42;
+ }
+}
+
+assert.throws(TypeError, function() {
+ var obj = new Obj();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/regular-subclassing.js
new file mode 100644
index 0000000000..59b6afd6a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/regular-subclassing.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.1.1
+description: Subclassing Object
+info: |
+ 19.1.1 The Object Constructor
+
+ The Object constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition.
+---*/
+
+class Obj extends Object {}
+
+var obj = new Obj();
+
+assert.notSameValue(
+ Object.getPrototypeOf(obj), Object.prototype,
+ 'returns the class prototype'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/replacing-prototype.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/replacing-prototype.js
new file mode 100644
index 0000000000..dd6e7d5635
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/replacing-prototype.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.1.1
+description: Subclassing Object replacing a prototype method
+info: |
+ 19.1.1 The Object Constructor
+
+ The Object constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition.
+---*/
+
+class Obj extends Object {
+ valueOf() {
+ return 42;
+ }
+}
+
+var obj = new Obj();
+
+assert.sameValue(obj.valueOf(), 42, 'Replaces prototype');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/regular-subclassing.js
new file mode 100644
index 0000000000..397e452cf0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/regular-subclassing.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 25.4.3
+description: Subclassing the Promise object
+info: |
+ 25.4.3 The Promise Constructor
+
+ ...
+
+ The Promise constructor is designed to be subclassable. It may be used as the
+ value in an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Promise behaviour must include a super call
+ to the Promise constructor to create and initialize the subclass instance with
+ the internal state necessary to support the Promise and Promise.prototype
+ built-in methods.
+---*/
+
+class Prom extends Promise {}
+
+assert.throws(TypeError, function() {
+ new Prom();
+});
+
+var calledExecutor = false;
+var executorArguments;
+
+var prom1 = new Prom(function() {
+ calledExecutor = true;
+ executorArguments = arguments;
+});
+
+assert(calledExecutor);
+assert.sameValue(executorArguments.length, 2);
+assert.sameValue(typeof executorArguments[0], "function");
+assert.sameValue(typeof executorArguments[1], "function");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/super-must-be-called.js
new file mode 100644
index 0000000000..8ed2fb3f63
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/super-must-be-called.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.
+/*---
+es6id: 25.4.3
+description: Super need to be called to initialize internals
+info: |
+ 25.4.3 The Promise Constructor
+
+ ...
+
+ The Promise constructor is designed to be subclassable. It may be used as the
+ value in an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Promise behaviour must include a super call
+ to the Promise constructor to create and initialize the subclass instance with
+ the internal state necessary to support the Promise and Promise.prototype
+ built-in methods.
+---*/
+
+class Prom1 extends Promise {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new Prom1();
+});
+
+class Prom2 extends Promise {
+ constructor(exec) {
+ super(exec);
+ }
+}
+
+new Prom2(function() {});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/no-prototype-throws.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/no-prototype-throws.js
new file mode 100644
index 0000000000..c61848395c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/no-prototype-throws.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.
+/*---
+es6id: 14.5.14
+description: The Proxy Object is not subclasseable without a prototype
+info: |
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 5. If ClassHeritageopt is not present, then
+ ...
+ 6. Else
+ ...
+ e. If superclass is null, then
+ ...
+ f. Else if IsConstructor(superclass) is false, throw a TypeError exception.
+ g. Else
+ ...
+ ii. Let protoParent be Get(superclass, "prototype").
+ iii. ReturnIfAbrupt(protoParent).
+ iv. If Type(protoParent) is neither Object nor Null, throw a TypeError exception.
+
+ 26.2.1 The Proxy Constructor
+
+ The Proxy constructor is the %Proxy% intrinsic object and the initial value of
+ the Proxy property of the global object. When called as a constructor it
+ creates and initializes a new proxy exotic object. Proxy is not intended to be
+ called as a function and will throw an exception when called in that manner.
+---*/
+
+assert.throws(TypeError, function() {
+ class P extends Proxy {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/lastIndex.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/lastIndex.js
new file mode 100644
index 0000000000..bf0726227b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/lastIndex.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 21.2.6.1
+description: Instances has the own property lastIndex
+info: |
+ 21.2.6.1 lastIndex
+
+ The value of the lastIndex property specifies the String index at which to
+ start the next match. It is coerced to an integer when used (see 21.2.5.2.2).
+ This property shall have the attributes { [[Writable]]: true, [[Enumerable]]:
+ false, [[Configurable]]: false }.
+includes: [propertyHelper.js]
+---*/
+
+class RE extends RegExp {}
+
+var re = new RE('39?');
+
+re.exec('TC39');
+
+assert.sameValue(re.lastIndex, 0);
+
+verifyWritable(re, 'lastIndex');
+verifyNotEnumerable(re, 'lastIndex');
+verifyNotConfigurable(re, 'lastIndex');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/regular-subclassing.js
new file mode 100644
index 0000000000..3dab8a3ee6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/regular-subclassing.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 21.2.3
+description: Subclassing the RegExp object
+info: |
+ 21.2.3 The RegExp Constructor
+
+ ...
+
+ The RegExp constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified RegExp behaviour must include a super call to
+ the RegExp constructor to create and initialize subclass instances with the
+ necessary internal slots.
+---*/
+
+class RE extends RegExp {}
+
+var re = new RE(39);
+
+assert.sameValue(re.test('TC39'), true);
+assert.sameValue(re.test('42'), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/super-must-be-called.js
new file mode 100644
index 0000000000..8d617a15ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/super-must-be-called.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.
+/*---
+es6id: 21.2.3
+description: Super need to be called to initialize internals
+info: |
+ 21.2.3 The RegExp Constructor
+
+ ...
+
+ The RegExp constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified RegExp behaviour must include a super call to
+ the RegExp constructor to create and initialize subclass instances with the
+ necessary internal slots.
+---*/
+
+class RE1 extends RegExp {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new RE1();
+});
+
+class RE2 extends RegExp {
+ constructor() {
+ super();
+ }
+}
+
+new RE2();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/regular-subclassing.js
new file mode 100644
index 0000000000..43a92d8a69
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/regular-subclassing.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.2.1
+description: Subclassing the Set object
+info: |
+ 23.2.1 The Set Constructor
+
+ ...
+
+ The Set constructor is designed to be subclassable. It may be used as the
+ value in an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Set behaviour must include a super call to the
+ Set constructor to create and initialize the subclass instance with the
+ internal state necessary to support the Set.prototype built-in methods.
+---*/
+
+class S extends Set {}
+
+var set = new S([{}, {}]);
+
+assert.sameValue(set.size, 2);
+
+set.add({});
+
+assert.sameValue(set.size, 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/super-must-be-called.js
new file mode 100644
index 0000000000..1b5e23cd08
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/super-must-be-called.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.
+/*---
+es6id: 23.2.1
+description: Super need to be called to initialize internals
+info: |
+ 23.2.1 The Set Constructor
+
+ ...
+
+ The Set constructor is designed to be subclassable. It may be used as the
+ value in an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Set behaviour must include a super call to the
+ Set constructor to create and initialize the subclass instance with the
+ internal state necessary to support the Set.prototype built-in methods.
+---*/
+
+class S1 extends Set {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new S1();
+});
+
+class S2 extends Set {
+ constructor() {
+ super();
+ }
+}
+
+new S2();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/length.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/length.js
new file mode 100644
index 0000000000..0d1f33ef7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/length.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 21.1.4
+description: Instances has the own property length
+info: |
+ 21.1.4 Properties of String Instances
+
+ ...
+
+ String instances have a length property, and a set of enumerable properties
+ with integer indexed names.
+includes: [propertyHelper.js]
+---*/
+
+class S extends String {}
+
+var s1 = new S();
+assert.sameValue(s1.length, 0);
+
+verifyNotWritable(s1, 'length');
+verifyNotEnumerable(s1, 'length');
+verifyNotConfigurable(s1, 'length');
+
+var s2 = new S('test262');
+assert.sameValue(s2.length, 7);
+
+verifyNotWritable(s2, 'length');
+verifyNotEnumerable(s2, 'length');
+verifyNotConfigurable(s2, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/regular-subclassing.js
new file mode 100644
index 0000000000..b5c2ac34be
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/regular-subclassing.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 21.1.1
+description: Subclassing the String object
+info: |
+ 21.1.1 The String Constructor
+
+ ...
+ The String constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified String behaviour must include a super call to
+ the String constructor to create and initialize the subclass instance with a
+ [[StringData]] internal slot.
+---*/
+
+class S extends String {}
+
+var s = new S(' test262 ');
+
+assert.sameValue(s.trim(), 'test262');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/super-must-be-called.js
new file mode 100644
index 0000000000..0c247e62db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/super-must-be-called.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 21.1.1
+description: Super need to be called to initialize internals
+info: |
+ 21.1.1 The String Constructor
+
+ ...
+ The String constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified String behaviour must include a super call to
+ the String constructor to create and initialize the subclass instance with a
+ [[StringData]] internal slot.
+---*/
+
+class S1 extends String {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new S1();
+});
+
+class S2 extends String {
+ constructor() {
+ super();
+ }
+}
+
+new S2();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/new-symbol-with-super-throws.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/new-symbol-with-super-throws.js
new file mode 100644
index 0000000000..70cdae8717
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/new-symbol-with-super-throws.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.4.1
+description: Symbol subclass called with the new operator throws on super()
+info: |
+ 19.4.1 The Symbol Constructor
+
+ ...
+ The Symbol constructor is not intended to be used with the new operator or to
+ be subclassed. It may be used as the value of an extends clause of a class
+ definition but a super call to the Symbol constructor will cause an exception.
+
+ 19.4.1.1 Symbol ( [ description ] )
+
+ ...
+ 1. If NewTarget is not undefined, throw a TypeError exception.
+features: [Symbol]
+---*/
+
+class S1 extends Symbol {}
+
+assert.throws(TypeError, function() {
+ new S1();
+});
+
+class S2 extends Symbol {
+ constructor() {
+ super();
+ }
+}
+
+assert.throws(TypeError, function() {
+ new S2();
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/symbol-valid-as-extends-value.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/symbol-valid-as-extends-value.js
new file mode 100644
index 0000000000..2ba5f953e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/symbol-valid-as-extends-value.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.4.1
+description: Symbol can be used as the value of an extends
+info: |
+ 19.4.1 The Symbol Constructor
+
+ ...
+ The Symbol constructor is not intended to be used with the new operator or to
+ be subclassed. It may be used as the value of an extends clause of a class
+ definition but a super call to the Symbol constructor will cause an exception.
+ ...
+features: [Symbol]
+---*/
+
+class S extends Symbol {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/regular-subclassing.js
new file mode 100644
index 0000000000..abc83cdf31
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/regular-subclassing.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 22.2.4
+description: Subclassing TypedArrays
+info: |
+ 22.2.4 The TypedArray Constructors
+
+ ...
+
+ The TypedArray constructors are designed to be subclassable. They may be used
+ as the value of an extends clause of a class definition. Subclass constructors
+ that intend to inherit the specified TypedArray behaviour must include a super
+ call to the TypedArray constructor to create and initialize the subclass
+ instance with the internal state necessary to support the
+ %TypedArray%.prototype built-in methods.
+---*/
+
+[
+ Int8Array,
+ Uint8Array,
+ Uint8ClampedArray,
+ Int16Array,
+ Uint16Array,
+ Int32Array,
+ Uint32Array,
+ Float32Array,
+ Float64Array
+].forEach(function(Constructor) {
+ class Typed extends Constructor {}
+
+ var arr = new Typed(2);
+
+ assert.sameValue(arr.length, 2);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/super-must-be-called.js
new file mode 100644
index 0000000000..5a8ae56122
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/super-must-be-called.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 22.2.4
+description: Super need to be called to initialize internals
+info: |
+ 22.2.4 The TypedArray Constructors
+
+ ...
+
+ The TypedArray constructors are designed to be subclassable. They may be used
+ as the value of an extends clause of a class definition. Subclass constructors
+ that intend to inherit the specified TypedArray behaviour must include a super
+ call to the TypedArray constructor to create and initialize the subclass
+ instance with the internal state necessary to support the
+ %TypedArray%.prototype built-in methods.
+---*/
+
+[
+ Int8Array,
+ Uint8Array,
+ Uint8ClampedArray,
+ Int16Array,
+ Uint16Array,
+ Int32Array,
+ Uint32Array,
+ Float32Array,
+ Float64Array
+].forEach(function(Constructor) {
+ class Typed extends Constructor {
+ constructor() {}
+ }
+
+ assert.throws(ReferenceError, function() {
+ new Typed();
+ });
+
+ class TypedWithSuper extends Constructor {
+ constructor() {
+ super();
+ }
+ }
+
+ new TypedWithSuper();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/regular-subclassing.js
new file mode 100644
index 0000000000..04e2258258
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/regular-subclassing.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.3.1
+description: Subclassing the WeakMap object
+info: |
+ 23.3.1 The WeakMap Constructor
+
+ ...
+
+ The WeakMap constructor is designed to be subclassable. It may be used as the
+ value in an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified WeakMap behaviour must include a super call to
+ the WeakMap constructor to create and initialize the subclass instance with
+ the internal state necessary to support the WeakMap.prototype built-in
+ methods.
+features: [WeakMap]
+---*/
+
+class WM extends WeakMap {}
+
+var map = new WM();
+var obj = {};
+
+assert.sameValue(map.has(obj), false);
+
+map.set(obj, 42);
+assert.sameValue(map.has(obj), true);
+assert.sameValue(map.get(obj), 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/super-must-be-called.js
new file mode 100644
index 0000000000..ae4c4acf2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/super-must-be-called.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.
+/*---
+es6id: 23.3.1
+description: Super need to be called to initialize internals
+info: |
+ 23.3.1 The WeakMap Constructor
+
+ ...
+
+ The WeakMap constructor is designed to be subclassable. It may be used as the
+ value in an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified WeakMap behaviour must include a super call to
+ the WeakMap constructor to create and initialize the subclass instance with
+ the internal state necessary to support the WeakMap.prototype built-in
+ methods.
+features: [WeakMap]
+---*/
+
+class M1 extends WeakMap {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new M1();
+});
+
+class M2 extends WeakMap {
+ constructor() {
+ super();
+ }
+}
+
+new M2();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/regular-subclassing.js
new file mode 100644
index 0000000000..9f8aa73318
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/regular-subclassing.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.4.1
+description: Subclassing the WeakSet object
+info: |
+ 23.4.1 The WeakSet Constructor
+
+ ...
+
+ The WeakSet constructor is designed to be subclassable. It may be used as the
+ value in an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified WeakSet behaviour must include a super call to
+ the WeakSet constructor to create and initialize the subclass instance with
+ the internal state necessary to support the WeakSet.prototype built-in
+ methods.
+features: [WeakSet]
+---*/
+
+class WS extends WeakSet {}
+
+var set = new WS();
+var obj = {};
+
+assert.sameValue(set.has(obj), false);
+
+set.add(obj);
+assert.sameValue(set.has(obj), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/super-must-be-called.js
new file mode 100644
index 0000000000..473bbf7c5e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/super-must-be-called.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.
+/*---
+es6id: 23.4.1
+description: Super need to be called to initialize internals
+info: |
+ 23.4.1 The WeakSet Constructor
+
+ ...
+
+ The WeakSet constructor is designed to be subclassable. It may be used as the
+ value in an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified WeakSet behaviour must include a super call to
+ the WeakSet constructor to create and initialize the subclass instance with
+ the internal state necessary to support the WeakSet.prototype built-in
+ methods.
+features: [WeakSet]
+---*/
+
+class WS1 extends WeakSet {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new WS1();
+});
+
+class WS2 extends WeakSet {
+ constructor() {
+ super();
+ }
+}
+
+new WS2();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtins.js b/js/src/tests/test262/language/statements/class/subclass/builtins.js
new file mode 100644
index 0000000000..dc95f7827a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtins.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class sublclassing builtins
+---*/
+class ExtendedUint8Array extends Uint8Array {
+ constructor() {
+ super(10);
+ this[0] = 255;
+ this[1] = 0xFFA;
+ }
+}
+
+var eua = new ExtendedUint8Array();
+assert.sameValue(eua.length, 10, "The value of `eua.length` is `10`");
+assert.sameValue(eua.byteLength, 10, "The value of `eua.byteLength` is `10`");
+assert.sameValue(eua[0], 0xFF, "The value of `eua[0]` is `0xFF`");
+assert.sameValue(eua[1], 0xFA, "The value of `eua[1]` is `0xFA`");
+assert.sameValue(
+ Object.getPrototypeOf(eua),
+ ExtendedUint8Array.prototype,
+ "`Object.getPrototypeOf(eua)` returns `ExtendedUint8Array.prototype`"
+);
+assert.sameValue(
+ Object.prototype.toString.call(eua),
+ "[object Uint8Array]",
+ "`Object.prototype.toString.call(eua)` returns `\"[object Uint8Array]\"`"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/class-definition-evaluation-empty-constructor-heritage-present.js b/js/src/tests/test262/language/statements/class/subclass/class-definition-evaluation-empty-constructor-heritage-present.js
new file mode 100644
index 0000000000..2039140be5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/class-definition-evaluation-empty-constructor-heritage-present.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5.14
+description: >
+ 10. If constructor is empty, then,
+ a. If ClassHeritageopt is present, then
+ i. Let constructor be the result of parsing the String "constructor(... args){ super (...args);}" using the syntactic grammar with the goal symbol MethodDefinition.
+---*/
+var args;
+
+class A {
+ constructor() {
+ args = arguments;
+ }
+}
+
+class B extends A {
+ /*
+ The missing constructor is created by the runtime:
+
+ constructor(...args) {
+ super(...args);
+ }
+
+ */
+}
+
+new B(0, 1, 2);
+
+
+assert.sameValue(args[0], 0);
+assert.sameValue(args[1], 1);
+assert.sameValue(args[2], 2);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-contains-return-override.js b/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-contains-return-override.js
new file mode 100644
index 0000000000..5fc6aa0c29
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-contains-return-override.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+es6id: 14.5.14
+description: >
+ The constructor of a null-extending class can contain an explicit return value.
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ [...]
+ 15. If ClassHeritageopt is present, then set F's [[ConstructorKind]] internal slot to "derived".
+ [...]
+
+ 9.2.2 [[Construct]]
+
+ [...]
+ 13. If result.[[Type]] is return, then
+ a. If Type(result.[[Value]]) is Object, return NormalCompletion(result.[[Value]]).
+ [...]
+---*/
+var obj;
+
+class Foo extends null {
+ constructor() {
+ return obj = {};
+ }
+}
+
+var f = new Foo();
+
+assert.sameValue(f, obj);
+assert.sameValue(Object.getPrototypeOf(f), Object.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-missing-return-override.js b/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-missing-return-override.js
new file mode 100644
index 0000000000..efdb8d3299
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-missing-return-override.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ The `this` value of a null-extending class isn't automatically initialized,
+ which makes it necessary to have an explicit return value in the constructor.
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ [...]
+ 5. If ClassHeritageopt is not present, then
+ [...]
+ 6. Else,
+ [...]
+ b. Let superclass be the result of evaluating ClassHeritage.
+ [...]
+ 15. If ClassHeritageopt is present, then set F's [[ConstructorKind]] internal slot to "derived".
+ [...]
+
+ 9.2.2 [[Construct]]
+
+ [...]
+ 15. Return ? envRec.GetThisBinding().
+
+ 8.1.1.3.4 GetThisBinding ( )
+ [...]
+ 3. If envRec.[[ThisBindingStatus]] is "uninitialized", throw a ReferenceError exception.
+ [...]
+---*/
+
+class Foo extends null {
+ constructor() {
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ new C();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-super.js b/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-super.js
new file mode 100644
index 0000000000..5270bb8c72
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-super.js
@@ -0,0 +1,54 @@
+// 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-runtime-semantics-classdefinitionevaluation
+description: >
+ Attempting to call `super()` in a null-extending class throws a TypeError,
+ because %FunctionPrototype% cannot be called as constructor function.
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ [...]
+ 5. If ClassHeritageopt is not present, then
+ [...]
+ 6. Else,
+ [...]
+ b. Let superclass be the result of evaluating ClassHeritage.
+ [...]
+ e. If superclass is null, then
+ [...]
+ ii. Let constructorParent be the intrinsic object %FunctionPrototype%.
+ [...]
+ 15. Let constructorInfo be the result of performing DefineMethod for constructor with arguments proto and constructorParent as the optional functionPrototype argument.
+ [...]
+
+ 12.3.5.1 Runtime Semantics: Evaluation
+
+ SuperCall : super Arguments
+
+ [...]
+ 3. Let func be ! GetSuperConstructor().
+ 4. Let argList be ? ArgumentListEvaluation of Arguments.
+ 5. If IsConstructor(func) is false, throw a TypeError exception.
+ [...]
+---*/
+
+var unreachable = 0;
+var reachable = 0;
+
+class C extends null {
+ constructor() {
+ reachable += 1;
+ super();
+ unreachable += 1;
+ }
+}
+
+assert.throws(TypeError, function() {
+ new C();
+});
+
+assert.sameValue(reachable, 1);
+assert.sameValue(unreachable, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-this.js b/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-this.js
new file mode 100644
index 0000000000..e4d4b6a917
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-this.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ The `this` value of a null-extending class isn't automatically initialized
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ [...]
+ 15. If ClassHeritageopt is present, then set F's [[ConstructorKind]] internal slot to "derived".
+ [...]
+
+ 12.2.2.1 Runtime Semantics: Evaluation
+ PrimaryExpression : this
+ 1. Return ? ResolveThisBinding( ).
+
+ 8.3.4 ResolveThisBinding ( )
+ [...]
+ 2. Return ? envRec.GetThisBinding().
+
+ 8.1.1.3.4 GetThisBinding ( )
+ [...]
+ 3. If envRec.[[ThisBindingStatus]] is "uninitialized", throw a ReferenceError exception.
+ [...]
+---*/
+
+class C extends null {
+ constructor() {
+ // Use an arrow function to access the `this` binding of the class constructor.
+ assert.throws(ReferenceError, () => {
+ this;
+ });
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ new C();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto.js b/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto.js
new file mode 100644
index 0000000000..da766ba6ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto.js
@@ -0,0 +1,31 @@
+// 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-runtime-semantics-classdefinitionevaluation
+es6id: 14.5.14
+description: >
+ The prototype of a null-extending class is %FunctionPrototype%, the prototype of
+ its "prototype" property is `null`.
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ [...]
+ 5. If ClassHeritageopt is not present, then
+ [...]
+ 6. Else,
+ [...]
+ b. Let superclass be the result of evaluating ClassHeritage.
+ [...]
+ e. If superclass is null, then
+ i. Let protoParent be null.
+ ii. Let constructorParent be the intrinsic object %FunctionPrototype%.
+ [...]
+---*/
+
+class Foo extends null {}
+
+assert.sameValue(Object.getPrototypeOf(Foo.prototype), null);
+assert.sameValue(Object.getPrototypeOf(Foo.prototype.constructor), Function.prototype);
+assert.sameValue(Foo, Foo.prototype.constructor);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/class-definition-parent-proto-null.js b/js/src/tests/test262/language/statements/class/subclass/class-definition-parent-proto-null.js
new file mode 100644
index 0000000000..951b569c66
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/class-definition-parent-proto-null.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2016 Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: A class which extends a constructor with null .prototype is a derived class.
+---*/
+
+var invoked = false;
+var instance, savedArg;
+
+function A(arg) {
+ invoked = true;
+ savedArg = arg;
+ this.prop = 0;
+}
+A.prototype = null;
+
+class C extends A {}
+
+instance = new C(1);
+
+assert.sameValue(invoked, true);
+assert.sameValue(savedArg, 1);
+assert.sameValue(instance.prop, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/default-constructor-2.js b/js/src/tests/test262/language/statements/class/subclass/default-constructor-2.js
new file mode 100644
index 0000000000..e5a984401d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/default-constructor-2.js
@@ -0,0 +1,65 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class default constructor 2
+---*/
+class Base1 { }
+assert.throws(TypeError, function() { Base1(); });
+
+class Subclass1 extends Base1 { }
+
+assert.throws(TypeError, function() { Subclass1(); });
+
+var s1 = new Subclass1();
+assert.sameValue(
+ Subclass1.prototype,
+ Object.getPrototypeOf(s1),
+ "The value of `Subclass1.prototype` is `Object.getPrototypeOf(s1)`, after executing `var s1 = new Subclass1();`"
+);
+
+class Base2 {
+ constructor(x, y) {
+ this.x = x;
+ this.y = y;
+ }
+}
+
+class Subclass2 extends Base2 {};
+
+var s2 = new Subclass2(1, 2);
+
+assert.sameValue(
+ Subclass2.prototype,
+ Object.getPrototypeOf(s2),
+ "The value of `Subclass2.prototype` is `Object.getPrototypeOf(s2)`, after executing `var s2 = new Subclass2(1, 2);`"
+);
+assert.sameValue(s2.x, 1, "The value of `s2.x` is `1`");
+assert.sameValue(s2.y, 2, "The value of `s2.y` is `2`");
+
+var f = Subclass2.bind({}, 3, 4);
+var s2prime = new f();
+assert.sameValue(
+ Subclass2.prototype,
+ Object.getPrototypeOf(s2prime),
+ "The value of `Subclass2.prototype` is `Object.getPrototypeOf(s2prime)`"
+);
+assert.sameValue(s2prime.x, 3, "The value of `s2prime.x` is `3`");
+assert.sameValue(s2prime.y, 4, "The value of `s2prime.y` is `4`");
+
+
+var obj = {};
+class Base3 {
+ constructor() {
+ return obj;
+ }
+}
+
+class Subclass3 extends Base3 {};
+
+var s3 = new Subclass3();
+assert.sameValue(s3, obj, "The value of `s3` is `obj`");
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/default-constructor-spread-override.js b/js/src/tests/test262/language/statements/class/subclass/default-constructor-spread-override.js
new file mode 100644
index 0000000000..72d76c00a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/default-constructor-spread-override.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ Default class constructor does not use argument evaluation.
+features: [Symbol.iterator]
+---*/
+
+Array.prototype[Symbol.iterator] = function() {
+ throw new Test262Error('@@iterator invoked');
+};
+
+class Base {
+ constructor(value) {
+ this.value = value;
+ }
+}
+
+class Derived extends Base {}
+
+const instance = new Derived(5);
+
+assert.sameValue(instance.value, 5);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/default-constructor.js b/js/src/tests/test262/language/statements/class/subclass/default-constructor.js
new file mode 100644
index 0000000000..5976b13a8b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/default-constructor.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class default constructor
+---*/
+var calls = 0;
+class Base {
+ constructor() {
+ calls++;
+ }
+}
+class Derived extends Base {}
+var object = new Derived();
+assert.sameValue(calls, 1, "The value of `calls` is `1`");
+
+calls = 0;
+assert.throws(TypeError, function() { Derived(); });
+assert.sameValue(calls, 0, "The value of `calls` is `0`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-finally-arrow.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-finally-arrow.js
new file mode 100644
index 0000000000..f2bebd31f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-finally-arrow.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+description: >
+ `super()` in finally block is executed before checking for missing `super()`
+ call when `return` is in a catch block. The `super()` call is performed
+ through an arrow function.
+---*/
+
+class C extends class {} {
+ constructor() {
+ var f = () => super();
+
+ try {
+ throw null;
+ } catch(e) {
+ return;
+ } finally {
+ f();
+ }
+ }
+}
+
+var o = new C();
+assert.sameValue(typeof o, "object");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-finally.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-finally.js
new file mode 100644
index 0000000000..e296a4642b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-finally.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+description: >
+ `super()` in finally block is executed before checking for missing `super()`
+ call when `return` is in a catch block.
+---*/
+
+class C extends class {} {
+ constructor() {
+ try {
+ throw null;
+ } catch(e) {
+ return;
+ } finally {
+ super();
+ }
+ }
+}
+
+var o = new C();
+assert.sameValue(typeof o, "object");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-super-arrow.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-super-arrow.js
new file mode 100644
index 0000000000..d7f4a4ef1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-super-arrow.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+description: >
+ TypeError from `return 0` is not catchable with `super` called in catch block
+ from an arrow function.
+---*/
+
+class C extends class {} {
+ constructor() {
+ var f = () => super();
+
+ try {
+ return 0;
+ } catch(e) {
+ f();
+ }
+ }
+}
+
+assert.throws(TypeError, function() {
+ new C();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-super.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-super.js
new file mode 100644
index 0000000000..6497f86914
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-super.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+description: >
+ TypeError from `return 0` is not catchable with `super` in catch block.
+---*/
+
+class C extends class {} {
+ constructor() {
+ try {
+ return 0;
+ } catch(e) {
+ super();
+ }
+ }
+}
+
+assert.throws(TypeError, function() {
+ new C();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch.js
new file mode 100644
index 0000000000..253cc850e8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+description: >
+ TypeError from `return 0` is not catchable.
+---*/
+
+class C extends class {} {
+ constructor() {
+ super();
+
+ try {
+ return 0;
+ } catch(e) {
+ return;
+ }
+ }
+}
+
+assert.throws(TypeError, function() {
+ new C();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-finally-super-arrow.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-finally-super-arrow.js
new file mode 100644
index 0000000000..b0b7246055
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-finally-super-arrow.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+description: >
+ `super()` in finally block is executed before checking for missing `super()`
+ call when `return` is in a try block. The `super()` call is performed
+ through an arrow function.
+---*/
+
+class C extends class {} {
+ constructor() {
+ var f = () => super();
+
+ try {
+ return;
+ } finally {
+ f();
+ }
+ }
+}
+
+var o = new C();
+assert.sameValue(typeof o, "object");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-finally-super.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-finally-super.js
new file mode 100644
index 0000000000..5b7f585b62
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-finally-super.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+description: >
+ `super()` in finally block is executed before checking for missing `super()`
+ call when `return` is in a try block.
+---*/
+
+class C extends class {} {
+ constructor() {
+ try {
+ return;
+ } finally {
+ super();
+ }
+ }
+}
+
+var o = new C();
+assert.sameValue(typeof o, "object");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-for-of-arrow.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-for-of-arrow.js
new file mode 100644
index 0000000000..020dcbb6d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-for-of-arrow.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+description: >
+ ReferenceError when returning from a derived class constructor without calling
+ `super()` is thrown after the function body has been left, so an iterator
+ return handler can still call `super()`.
+---*/
+
+var iter = {
+ [Symbol.iterator]() {
+ return this;
+ },
+ next() {
+ return {done: false};
+ },
+ return() {
+ // Calls |super()|.
+ this.f();
+
+ return {done: true};
+ },
+};
+
+class C extends class {} {
+ constructor() {
+ iter.f = () => super();
+
+ for (var k of iter) {
+ return;
+ }
+ }
+}
+
+var o = new C();
+assert.sameValue(typeof o, "object");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-for-of.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-for-of.js
new file mode 100644
index 0000000000..c0bc4e153d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-for-of.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+description: >
+ TypeError from `return 0` is thrown after the function body has been left, so
+ an error thrown from an iterator has precedence.
+---*/
+
+var error = new Test262Error();
+
+var iter = {
+ [Symbol.iterator]() {
+ return this;
+ },
+ next() {
+ return {done: false};
+ },
+ return() {
+ throw error;
+ },
+};
+
+class C extends class {} {
+ constructor() {
+ super();
+
+ for (var k of iter) {
+ return 0;
+ }
+ }
+}
+
+assert.throws(Test262Error, function() {
+ new C();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-boolean.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-boolean.js
new file mode 100644
index 0000000000..5e62e661da
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-boolean.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: >
+ [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 13. If result.[[type]] is return, then
+ ...
+ c. If result.[[value]] is not undefined, throw a TypeError exception.
+ ...
+
+ `return true;`
+
+---*/
+class Base {
+ constructor() {}
+}
+class Derived extends Base {
+ constructor() {
+ super();
+
+ return true;
+ }
+}
+
+assert.throws(TypeError, function() {
+ new Derived();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-empty.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-empty.js
new file mode 100644
index 0000000000..28bb88ecee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-empty.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: >
+ [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 13. If result.[[type]] is return, then
+ ...
+ c. If result.[[value]] is not undefined, ...
+ 14. Else, ReturnIfAbrupt(result).
+ 15. Return envRec.GetThisBinding().
+
+ `return (empty);` Should be the same as `return undefined;`
+---*/
+var calls = 0;
+class Base {
+ constructor() {
+ this.prop = 1;
+ calls++;
+ }
+}
+class Derived extends Base {
+ constructor() {
+ super();
+
+ return;
+ }
+}
+
+var object = new Derived();
+
+// super is called
+assert.sameValue(calls, 1, "The value of `calls` is `1`, because `super()`");
+
+// undefined was returned
+assert.sameValue(object.prop, 1);
+assert.sameValue(object instanceof Derived, true);
+assert.sameValue(object instanceof Base, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-null.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-null.js
new file mode 100644
index 0000000000..9d1c0660d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-null.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: >
+ [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 13. If result.[[type]] is return, then
+ ...
+ c. If result.[[value]] is not undefined, throw a TypeError exception.
+ ...
+
+ `return null;`
+
+---*/
+class Base {
+ constructor() {}
+}
+class Derived extends Base {
+ constructor() {
+ super();
+
+ return null;
+ }
+}
+
+assert.throws(TypeError, function() {
+ new Derived();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-number.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-number.js
new file mode 100644
index 0000000000..7dbb94394f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-number.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: >
+ [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 13. If result.[[type]] is return, then
+ ...
+ c. If result.[[value]] is not undefined, throw a TypeError exception.
+ ...
+
+ `return 0;`
+
+---*/
+class Base {
+ constructor() {}
+}
+class Derived extends Base {
+ constructor() {
+ super();
+
+ return 0;
+ }
+}
+
+assert.throws(TypeError, function() {
+ new Derived();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-object.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-object.js
new file mode 100644
index 0000000000..a1581be078
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-object.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: >
+ [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 13. If result.[[type]] is return, then
+ a. If Type(result.[[value]]) is Object, return NormalCompletion(result.[[value]]).
+ ...
+ ...
+
+ `return {};`
+
+---*/
+var calls = 0;
+class Base {
+ constructor() {
+ this.prop = 1;
+ calls++;
+ }
+}
+class Derived extends Base {
+ constructor() {
+ super();
+
+ return {};
+ }
+}
+
+var object = new Derived();
+
+// super is called
+assert.sameValue(calls, 1, "The value of `calls` is `1`, because `super()`");
+
+// But the this object was discarded.
+assert.sameValue(typeof object.prop, "undefined");
+assert.sameValue(object instanceof Derived, false);
+assert.sameValue(object instanceof Base, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-string.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-string.js
new file mode 100644
index 0000000000..c670fae177
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-string.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: >
+ [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 13. If result.[[type]] is return, then
+ ...
+ c. If result.[[value]] is not undefined, throw a TypeError exception.
+ ...
+
+ `return "";`
+
+---*/
+class Base {
+ constructor() {}
+}
+class Derived extends Base {
+ constructor() {
+ super();
+
+ return "";
+ }
+}
+
+assert.throws(TypeError, function() {
+ new Derived();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-symbol.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-symbol.js
new file mode 100644
index 0000000000..d4b3315212
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-symbol.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: >
+ [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 13. If result.[[type]] is return, then
+ ...
+ c. If result.[[value]] is not undefined, throw a TypeError exception.
+ ...
+
+ `return Symbol();`
+
+features: [Symbol]
+---*/
+class Base {
+ constructor() {}
+}
+class Derived extends Base {
+ constructor() {
+ super();
+
+ return Symbol();
+ }
+}
+
+assert.throws(TypeError, function() {
+ new Derived();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-this.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-this.js
new file mode 100644
index 0000000000..49cf683e04
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-this.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: >
+ [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 13. If result.[[type]] is return, then
+ ...
+ b. If kind is "base", return NormalCompletion(thisArgument).
+ ...
+ ...
+
+ `return this;`
+
+---*/
+var calls = 0;
+class Base {
+ constructor() {
+ this.prop = 1;
+ calls++;
+ }
+}
+class Derived extends Base {
+ constructor() {
+ super();
+
+ return this;
+ }
+}
+
+var object = new Derived();
+
+// super is called
+assert.sameValue(calls, 1, "The value of `calls` is `1`, because `super()`");
+
+// The this object was returned.
+assert.sameValue(object.prop, 1);
+assert.sameValue(object instanceof Derived, true);
+assert.sameValue(object instanceof Base, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-undefined.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-undefined.js
new file mode 100644
index 0000000000..882889c9b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-undefined.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: >
+ [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 13. If result.[[type]] is return, then
+ ...
+ c. If result.[[value]] is not undefined, ...
+ 14. Else, ReturnIfAbrupt(result).
+ 15. Return envRec.GetThisBinding().
+
+ `return undefined;`
+
+---*/
+var calls = 0;
+class Base {
+ constructor() {
+ this.prop = 1;
+ calls++;
+ }
+}
+class Derived extends Base {
+ constructor() {
+ super();
+
+ return undefined;
+ }
+}
+
+var object = new Derived();
+
+// super is called
+assert.sameValue(calls, 1, "The value of `calls` is `1`, because `super()`");
+
+// undefined was returned
+assert.sameValue(object.prop, 1);
+assert.sameValue(object instanceof Derived, true);
+assert.sameValue(object instanceof Base, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/shell.js b/js/src/tests/test262/language/statements/class/subclass/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/superclass-arrow-function.js b/js/src/tests/test262/language/statements/class/subclass/superclass-arrow-function.js
new file mode 100644
index 0000000000..be59091134
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/superclass-arrow-function.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ IsConstructor check is performed before "prototype" lookup.
+ Arrow functions are not constructors (MakeConstructor is not called on them).
+info: |
+ ClassDefinitionEvaluation
+
+ [...]
+ 5. Else,
+ [...]
+ d. Let superclass be ? GetValue(superclassRef).
+ e. If superclass is null, then
+ [...]
+ f. Else if IsConstructor(superclass) is false, throw a TypeError exception.
+features: [arrow-function, class, Proxy]
+---*/
+
+var fn = () => {};
+Object.defineProperty(fn, "prototype", {
+ get: function() {
+ throw new Test262Error("`superclass.prototype` is unreachable");
+ },
+});
+
+assert.throws(TypeError, function() {
+ class A extends fn {}
+});
+
+var bound = (() => {}).bind();
+Object.defineProperty(bound, "prototype", {
+ get: function() {
+ throw new Test262Error("`superclass.prototype` is unreachable");
+ },
+});
+
+assert.throws(TypeError, function() {
+ class C extends bound {}
+});
+
+var proxy = new Proxy(() => {}, {
+ get: function() {
+ throw new Test262Error("`superclass.prototype` is unreachable");
+ },
+});
+
+assert.throws(TypeError, function() {
+ class C extends proxy {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/superclass-async-function.js b/js/src/tests/test262/language/statements/class/subclass/superclass-async-function.js
new file mode 100644
index 0000000000..b9e71515ac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/superclass-async-function.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ IsConstructor check is performed before "prototype" lookup.
+ Async functions are not constructors (MakeConstructor is not called on them).
+info: |
+ ClassDefinitionEvaluation
+
+ [...]
+ 5. Else,
+ [...]
+ d. Let superclass be ? GetValue(superclassRef).
+ e. If superclass is null, then
+ [...]
+ f. Else if IsConstructor(superclass) is false, throw a TypeError exception.
+features: [async-functions, class, Proxy]
+---*/
+
+async function fn() {}
+Object.defineProperty(fn, "prototype", {
+ get: function() {
+ throw new Test262Error("`superclass.prototype` is unreachable");
+ },
+});
+
+assert.throws(TypeError, function() {
+ class A extends fn {}
+});
+
+var bound = (async function() {}).bind();
+Object.defineProperty(bound, "prototype", {
+ get: function() {
+ throw new Test262Error("`superclass.prototype` is unreachable");
+ },
+});
+
+assert.throws(TypeError, function() {
+ class C extends bound {}
+});
+
+var proxy = new Proxy(async function() {}, {
+ get: function() {
+ throw new Test262Error("`superclass.prototype` is unreachable");
+ },
+});
+
+assert.throws(TypeError, function() {
+ class C extends proxy {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/superclass-async-generator-function.js b/js/src/tests/test262/language/statements/class/subclass/superclass-async-generator-function.js
new file mode 100644
index 0000000000..d77acb6c90
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/superclass-async-generator-function.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-runtime-semantics-classdefinitionevaluation
+description: >
+ IsConstructor check is performed before "prototype" lookup.
+ Async generator functions are not constructors (MakeConstructor is not called on them).
+info: |
+ ClassDefinitionEvaluation
+
+ [...]
+ 5. Else,
+ [...]
+ d. Let superclass be ? GetValue(superclassRef).
+ e. If superclass is null, then
+ [...]
+ f. Else if IsConstructor(superclass) is false, throw a TypeError exception.
+features: [async-iteration, class, Proxy]
+---*/
+
+async function* fn() {}
+
+assert.throws(TypeError, function() {
+ class A extends fn {}
+});
+
+var bound = (async function* () {}).bind();
+Object.defineProperty(bound, "prototype", {
+ get: function() {
+ throw new Test262Error("`superclass.prototype` is unreachable");
+ },
+});
+
+assert.throws(TypeError, function() {
+ class C extends bound {}
+});
+
+var proxy = new Proxy(async function* () {}, {});
+
+assert.throws(TypeError, function() {
+ class C extends proxy {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/superclass-bound-function.js b/js/src/tests/test262/language/statements/class/subclass/superclass-bound-function.js
new file mode 100644
index 0000000000..2f95cc1ccf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/superclass-bound-function.js
@@ -0,0 +1,27 @@
+// 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-runtime-semantics-classdefinitionevaluation
+description: SuperClass may be a bound function object
+info: |
+ ClassDefinitionEvaluation
+
+ [...]
+ 5. Else,
+ [...]
+ f. Else if IsConstructor(superclass) is false, throw a TypeError exception.
+ g. Else,
+ i. Let protoParent be ? Get(superclass, "prototype").
+ ii. If Type(protoParent) is neither Object nor Null, throw a TypeError exception.
+ iii. Let constructorParent be superclass.
+features: [class]
+---*/
+
+var bound = function() {}.bind();
+bound.prototype = {};
+
+class C extends bound {}
+
+assert.sameValue(Object.getPrototypeOf(new C()), C.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/superclass-generator-function.js b/js/src/tests/test262/language/statements/class/subclass/superclass-generator-function.js
new file mode 100644
index 0000000000..c49a6be82a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/superclass-generator-function.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ IsConstructor check is performed before "prototype" lookup.
+ Generator functions are not constructors (MakeConstructor is not called on them).
+info: |
+ ClassDefinitionEvaluation
+
+ [...]
+ 5. Else,
+ [...]
+ d. Let superclass be ? GetValue(superclassRef).
+ e. If superclass is null, then
+ [...]
+ f. Else if IsConstructor(superclass) is false, throw a TypeError exception.
+features: [generators, class, Proxy]
+---*/
+
+function* fn() {}
+
+assert.throws(TypeError, function() {
+ class A extends fn {}
+});
+
+var bound = (function* () {}).bind();
+Object.defineProperty(bound, "prototype", {
+ get: function() {
+ throw new Test262Error("`superclass.prototype` is unreachable");
+ },
+});
+
+assert.throws(TypeError, function() {
+ class C extends bound {}
+});
+
+var proxy = new Proxy(function* () {}, {});
+
+assert.throws(TypeError, function() {
+ class C extends proxy {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/superclass-prototype-setter-constructor.js b/js/src/tests/test262/language/statements/class/subclass/superclass-prototype-setter-constructor.js
new file mode 100644
index 0000000000..04f3f34ced
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/superclass-prototype-setter-constructor.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ superclass setter "constructor" override
+---*/
+function Base() {}
+
+Base.prototype = {
+ set constructor(_) {
+ throw new Test262Error("`Base.prototype.constructor` is unreachable.");
+ }
+};
+
+class C extends Base {}
+
+new C();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/superclass-prototype-setter-method-override.js b/js/src/tests/test262/language/statements/class/subclass/superclass-prototype-setter-method-override.js
new file mode 100644
index 0000000000..f137ad2140
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/superclass-prototype-setter-method-override.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ superclass prototype override
+---*/
+function Base() {}
+
+Base.prototype = {
+ set m(_) {
+ throw new Test262Error("`Base.prototype.m` is unreachable.");
+ }
+};
+
+class C extends Base {
+ m() {
+ return 1;
+ }
+}
+
+assert.sameValue(new C().m(), 1, "`new C().m()` returns `1`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/superclass-static-method-override.js b/js/src/tests/test262/language/statements/class/subclass/superclass-static-method-override.js
new file mode 100644
index 0000000000..bd3d17d807
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/superclass-static-method-override.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ Static method override
+---*/
+function Base() {}
+Object.defineProperty(Base, 'staticM', {
+ set: function() {
+ throw new Test262Error("`Base.staticM` is unreachable.");
+ }
+});
+
+class C extends Base {
+ static staticM() {
+ return 1;
+ }
+}
+
+assert.sameValue(C.staticM(), 1, "`C.staticM()` returns `1`");
+
+reportCompare(0, 0);