Chromium Code Reviews| Index: test/mjsunit/harmony/instanceof-es6.js |
| diff --git a/test/mjsunit/harmony/instanceof-es6.js b/test/mjsunit/harmony/instanceof-es6.js |
| index 60e7ee2c394f88b79c494e6f69b70a947677f7fb..0fda817658143fd8b678ef86fc3b06340bbbae25 100644 |
| --- a/test/mjsunit/harmony/instanceof-es6.js |
| +++ b/test/mjsunit/harmony/instanceof-es6.js |
| @@ -48,3 +48,20 @@ assertEquals(Function.prototype[Symbol.hasInstance].call({}, {}), false); |
| // OrdinaryHasInstance passed a non-object argument returns false. |
| assertEquals(Function.prototype[Symbol.hasInstance].call(Array, 0), false); |
| + |
| +// Cannot assign to @@hasInstance with %FunctionPrototype%. |
| +(function() { |
| + "use strict"; |
| + function F() {} |
| + assertThrows(function() { F[Symbol.hasInstance] = (v) => v }, TypeError); |
| +})(); |
| + |
| +// Check correct invocation of @@hasInstance handler on function instance. |
| +(function() { |
| + function F() {} |
| + var proto = Object.getPrototypeOf(F); |
| + Object.setPrototypeOf(F, null); |
| + F[Symbol.hasInstance] = function(v) { return true }; |
|
Igor Sheludko
2016/05/17 08:40:32
How about increasing hasInstance invocation counte
Benedikt Meurer
2016/05/17 10:23:21
Done.
|
| + Object.setPrototypeOf(F, proto); |
| + assertTrue(1 instanceof F); |
| +})(); |