Chromium Code Reviews| Index: test/mjsunit/harmony/super.js |
| diff --git a/test/mjsunit/harmony/super.js b/test/mjsunit/harmony/super.js |
| index 130c010a4db65f7e9d70e063c133317c55df72f4..97f6116cdca501425b5353ab00181bd15fc82fad 100644 |
| --- a/test/mjsunit/harmony/super.js |
| +++ b/test/mjsunit/harmony/super.js |
| @@ -1192,11 +1192,15 @@ |
| (function TestSuperCall() { |
| function Subclass(base, constructor) { |
| - var homeObject = { __proto__ : base.prototype }; |
| - var result = constructor.toMethod(homeObject); |
| - homeObject.constructor = result; |
| - result.prototype = homeObject; |
| - return result; |
| + var homeObject = { |
| + __proto__: base.prototype, |
| + constructor: constructor |
| + }; |
| + constructor.__proto__ = base; |
| + constructor.prototype = homeObject; |
| + // not doing toMethod: home object is not required for |
| + // super constructor calls. |
| + return constructor; |
| } |
| var baseCalled = 0; |
| @@ -1245,6 +1249,26 @@ |
| var d = new Derived2("base", "derived"); |
| assertEquals("base", d.fromBase); |
| assertEquals("derived", d.fromDerived); |
| + |
| + function ImplicitSubclassOfObject() { |
| + super(); |
|
arv (Not doing code reviews)
2014/10/15 14:47:18
Just to be clear that I understand this. This one
Dmitry Lomov (no reviews)
2014/10/15 17:22:57
You are right, this has to be called ImplicitSubcl
|
| + this.x = 123; |
| + } |
| + |
| + var o = new ImplicitSubclassOfObject(); |
| + assertEquals(123, o.x); |
| +}()); |
| + |
| + |
| +(function TestSuperCallErrorCases() { |
| + function T() { |
| + super(); |
| + } |
| + T.__proto__ = null; |
| + // Spec says ReferenceError here, but for other IsCallable failures |
| + // we throw TypeError. |
|
arv (Not doing code reviews)
2014/10/15 14:47:18
Completely agree. I was reading up on the changes
|
| + // Filed https://bugs.ecmascript.org/show_bug.cgi?id=3282 |
| + assertThrows(function() { new T(); }, TypeError); |
| }()); |
|
arv (Not doing code reviews)
2014/10/15 14:49:54
maybe add a test that mutates __proto__ and then u
Dmitry Lomov (no reviews)
2014/10/15 17:22:57
Done.
|