From 4bacf25f0dfc25bc075604964517b8d8404fc812 Mon Sep 17 00:00:00 2001 From: ta7sudan Date: Thu, 4 Apr 2019 02:14:51 +0800 Subject: [PATCH] Add test that a Proxy instance with getPrototypeOf trap use instanceof operator on a function (#2107) --- .../getPrototypeOf/instanceof-return-true.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/built-ins/Proxy/getPrototypeOf/instanceof-return-true.js diff --git a/test/built-ins/Proxy/getPrototypeOf/instanceof-return-true.js b/test/built-ins/Proxy/getPrototypeOf/instanceof-return-true.js new file mode 100644 index 0000000000..8ef1e2458f --- /dev/null +++ b/test/built-ins/Proxy/getPrototypeOf/instanceof-return-true.js @@ -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.');