blob: a438be9f05c6103c377792075be40b73c9661125 [file] [log] [blame]
joepeck@webkit.org094223d52017-09-21 03:23:17 +00001// Copyright (C) 2017 Ecma International. All rights reserved.
2// This code is governed by the BSD license found in the LICENSE file.
3/*---
4description: |
5 Used to assert the correctness of object behavior in the presence
6 and context of Proxy objects.
7---*/
8
keith_miller@apple.combcc77f22016-07-15 06:03:25 +00009function allowProxyTraps(overrides) {
joepeck@webkit.org094223d52017-09-21 03:23:17 +000010 function throwTest262Error(msg) {
11 return function () { throw new Test262Error(msg); };
12 }
13 if (!overrides) { overrides = {}; }
14 return {
15 getPrototypeOf: overrides.getPrototypeOf || throwTest262Error('[[GetPrototypeOf]] trap called'),
16 setPrototypeOf: overrides.setPrototypeOf || throwTest262Error('[[SetPrototypeOf]] trap called'),
17 isExtensible: overrides.isExtensible || throwTest262Error('[[IsExtensible]] trap called'),
18 preventExtensions: overrides.preventExtensions || throwTest262Error('[[PreventExtensions]] trap called'),
19 getOwnPropertyDescriptor: overrides.getOwnPropertyDescriptor || throwTest262Error('[[GetOwnProperty]] trap called'),
20 has: overrides.has || throwTest262Error('[[HasProperty]] trap called'),
21 get: overrides.get || throwTest262Error('[[Get]] trap called'),
22 set: overrides.set || throwTest262Error('[[Set]] trap called'),
23 deleteProperty: overrides.deleteProperty || throwTest262Error('[[Delete]] trap called'),
24 defineProperty: overrides.defineProperty || throwTest262Error('[[DefineOwnProperty]] trap called'),
25 enumerate: throwTest262Error('[[Enumerate]] trap called: this trap has been removed'),
26 ownKeys: overrides.ownKeys || throwTest262Error('[[OwnPropertyKeys]] trap called'),
27 apply: overrides.apply || throwTest262Error('[[Call]] trap called'),
28 construct: overrides.construct || throwTest262Error('[[Construct]] trap called')
29 };
keith_miller@apple.combcc77f22016-07-15 06:03:25 +000030}