tor-browser

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

trap-is-not-callable-realm.js (864B)


      1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc
      5 description: >
      6  Throws if trap is not callable (honoring the Realm of the current execution
      7  context)
      8 info: |
      9    [[DefineOwnProperty]] (P, Desc)
     10 
     11    ...
     12    6. Let trap be GetMethod(handler, "defineProperty").
     13    ...
     14        7.3.9 GetMethod (O, P)
     15        ...
     16        2. Let func be GetV(O, P).
     17        5. If IsCallable(func) is false, throw a TypeError exception.
     18        ...
     19 features: [cross-realm, Proxy]
     20 ---*/
     21 
     22 var OProxy = $262.createRealm().global.Proxy;
     23 var p = new OProxy({}, {
     24  defineProperty: {}
     25 });
     26 
     27 assert.throws(TypeError, function() {
     28  Object.defineProperty(p, "foo", {
     29    value: 1
     30  });
     31 });
     32 
     33 reportCompare(0, 0);