tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

trap-is-not-callable.js (882B)


      1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 es6id: 9.5.5
      5 description: >
      6    Throws a TypeError exception if trap is not callable.
      7 info: |
      8    [[GetOwnProperty]] (P)
      9 
     10    ...
     11    2. Let handler be the value of the [[ProxyHandler]] internal slot of O.
     12    ...
     13    5. Let target be the value of the [[ProxyTarget]] internal slot of O.
     14    6. Let trap be GetMethod(handler, "getOwnPropertyDescriptor").
     15    ...
     16        7.3.9 GetMethod (O, P)
     17        ...
     18        2. Let func be GetV(O, P).
     19        5. If IsCallable(func) is false, throw a TypeError exception.
     20        ...
     21 features: [Proxy]
     22 ---*/
     23 
     24 var target = {};
     25 var p = new Proxy(target, {
     26  getOwnPropertyDescriptor: {}
     27 });
     28 
     29 assert.throws(TypeError, function() {
     30  Object.getOwnPropertyDescriptor(p, "foo");
     31 });
     32 
     33 reportCompare(0, 0);