Add test that a Proxy instance with getPrototypeOf trap use instanceof operator on a function (#2107)

This commit is contained in:
ta7sudan 2019-04-04 02:14:51 +08:00 committed by Leo Balter
parent 324f2916d3
commit 4bacf25f0d
1 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,19 @@
// Copyright (C) 2019 ta7sudan. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-proxy-object-internal-methods-and-internal-slots-getprototypeof
description: >
instanceof operator will return true if trap result is the prototype of
the function.
features: [Proxy]
---*/
function CustomClass() {}
var p = new Proxy({}, {
getPrototypeOf: function() {
return CustomClass.prototype;
}
});
assert(p instanceof CustomClass, 'Expected p to be the instance of CustomClass, but was not.');