Debian Codegraph @

js/src/tests/test262/harness/proxytrapshelper-default.js

raw
1 // Copyright (C) 2016 Jordan Harband. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 description: allowProxyTraps helper should default throw on all the proxy trap named methods being invoked
6 esid: pending
7 author: Jordan Harband
8 includes: [proxyTrapsHelper.js]
9 ---*/
10
11 var traps = allowProxyTraps();
12
13 function assertTrapThrows(trap) {
14 if (typeof traps[trap] !== 'function') {
15 throw new Test262Error('trap ' + trap + ' is not a function');
16 }
17 var failedToThrow = false;
18 try {
19 traps[trap]();
20 failedToThrow = true;
21 } catch (e) {}
22 if (failedToThrow) {
23 throw new Test262Error('trap ' + trap + ' did not throw an error');
24 }
25 }
26
27 assertTrapThrows('getPrototypeOf');
28 assertTrapThrows('setPrototypeOf');
29 assertTrapThrows('isExtensible');
30 assertTrapThrows('preventExtensions');
31 assertTrapThrows('getOwnPropertyDescriptor');
32 assertTrapThrows('has');
33 assertTrapThrows('get');
34 assertTrapThrows('set');
35 assertTrapThrows('deleteProperty');
36 assertTrapThrows('defineProperty');
37 assertTrapThrows('enumerate');
38 assertTrapThrows('ownKeys');
39 assertTrapThrows('apply');
40 assertTrapThrows('construct');
41
42 reportCompare(0, 0);