| 1 |
// GENERATED, DO NOT EDIT |
| 2 |
// file: proxyTrapsHelper.js |
| 3 |
// Copyright (C) 2016 Jordan Harband. All rights reserved. |
| 4 |
// This code is governed by the BSD license found in the LICENSE file. |
| 5 |
/*--- |
| 6 |
description: | |
| 7 |
Used to assert the correctness of object behavior in the presence |
| 8 |
and context of Proxy objects. |
| 9 |
defines: [allowProxyTraps] |
| 10 |
---*/ |
| 11 |
|
| 12 |
function allowProxyTraps(overrides) { |
| 13 |
function throwTest262Error(msg) { |
| 14 |
return function () { throw new Test262Error(msg); }; |
| 15 |
} |
| 16 |
if (!overrides) { overrides = {}; } |
| 17 |
return { |
| 18 |
getPrototypeOf: overrides.getPrototypeOf || throwTest262Error('[[GetPrototypeOf]] trap called'), |
| 19 |
setPrototypeOf: overrides.setPrototypeOf || throwTest262Error('[[SetPrototypeOf]] trap called'), |
| 20 |
isExtensible: overrides.isExtensible || throwTest262Error('[[IsExtensible]] trap called'), |
| 21 |
preventExtensions: overrides.preventExtensions || throwTest262Error('[[PreventExtensions]] trap called'), |
| 22 |
getOwnPropertyDescriptor: overrides.getOwnPropertyDescriptor || throwTest262Error('[[GetOwnProperty]] trap called'), |
| 23 |
has: overrides.has || throwTest262Error('[[HasProperty]] trap called'), |
| 24 |
get: overrides.get || throwTest262Error('[[Get]] trap called'), |
| 25 |
set: overrides.set || throwTest262Error('[[Set]] trap called'), |
| 26 |
deleteProperty: overrides.deleteProperty || throwTest262Error('[[Delete]] trap called'), |
| 27 |
defineProperty: overrides.defineProperty || throwTest262Error('[[DefineOwnProperty]] trap called'), |
| 28 |
enumerate: throwTest262Error('[[Enumerate]] trap called: this trap has been removed'), |
| 29 |
ownKeys: overrides.ownKeys || throwTest262Error('[[OwnPropertyKeys]] trap called'), |
| 30 |
apply: overrides.apply || throwTest262Error('[[Call]] trap called'), |
| 31 |
construct: overrides.construct || throwTest262Error('[[Construct]] trap called') |
| 32 |
}; |
| 33 |
} |