test262/harness/proxyTrapsHelper.js
jugglinmike 330733eaf3 Correct licensing (#1608)
In order to satisfy the project's formatting rules, license information
was inserted into a number of files where it had been mistakenly omitted
by the original contributors [1]. In many cases, the license information
did not accurately describe the contributor or the time of contribution.
Update the information according to the information provided by the
contributors at the time each file was authored:

- atomicsHelper.js - a72ee6d91275aa6524e84a9b7070103411ef2689
- detachArrayBuffer.js - 70c7375be83137015da2c5d6d29a3c40ad3cb5b1
- nans.js - b17ffc029850e3c32d51c68e0281ab7b1a4c193b
- nativeFunctionMatcher.js - 6b7cbb50350e478a543da40d02492aa8f45a792d
- proxyTrapsHelper.js d530c87b41584d47d95bb78dccf592c9c5c8f7b1
- regexpUtils.js - 44b40e083ec851cd8448d5fe4755bdfc9f0dc14c
- tcoHelper.js - 4dc81d37886f49512eb60dafe13b794af5ffeb29

[1] 4ea2931f169d4a4b5a9a4a7c731cc92bf7b3e13c
2018-06-25 10:30:11 -04:00

31 lines
1.7 KiB
JavaScript

// Copyright (C) 2016 Jordan Harband. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Used to assert the correctness of object behavior in the presence
and context of Proxy objects.
---*/
function allowProxyTraps(overrides) {
function throwTest262Error(msg) {
return function () { throw new Test262Error(msg); };
}
if (!overrides) { overrides = {}; }
return {
getPrototypeOf: overrides.getPrototypeOf || throwTest262Error('[[GetPrototypeOf]] trap called'),
setPrototypeOf: overrides.setPrototypeOf || throwTest262Error('[[SetPrototypeOf]] trap called'),
isExtensible: overrides.isExtensible || throwTest262Error('[[IsExtensible]] trap called'),
preventExtensions: overrides.preventExtensions || throwTest262Error('[[PreventExtensions]] trap called'),
getOwnPropertyDescriptor: overrides.getOwnPropertyDescriptor || throwTest262Error('[[GetOwnProperty]] trap called'),
has: overrides.has || throwTest262Error('[[HasProperty]] trap called'),
get: overrides.get || throwTest262Error('[[Get]] trap called'),
set: overrides.set || throwTest262Error('[[Set]] trap called'),
deleteProperty: overrides.deleteProperty || throwTest262Error('[[Delete]] trap called'),
defineProperty: overrides.defineProperty || throwTest262Error('[[DefineOwnProperty]] trap called'),
enumerate: throwTest262Error('[[Enumerate]] trap called: this trap has been removed'),
ownKeys: overrides.ownKeys || throwTest262Error('[[OwnPropertyKeys]] trap called'),
apply: overrides.apply || throwTest262Error('[[Call]] trap called'),
construct: overrides.construct || throwTest262Error('[[Construct]] trap called')
};
}