tor-browser

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

targetdesc-not-compatible-descriptor-not-configurable-target-realm.js (1021B)


      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    Throw a TypeError exception if Desc and target property descriptor are not
      7    compatible and trap result is true.
      8 info: |
      9    [[DefineOwnProperty]] (P, Desc)
     10 
     11    ...
     12    20. Else targetDesc is not undefined,
     13        a. If IsCompatiblePropertyDescriptor(extensibleTarget, Desc ,
     14        targetDesc) is false, throw a TypeError exception.
     15    ...
     16 features: [cross-realm, Proxy]
     17 ---*/
     18 
     19 var OProxy = $262.createRealm().global.Proxy;
     20 var target = Object.create(null);
     21 var p = new OProxy(target, {
     22  defineProperty: function() {
     23    return true;
     24  }
     25 });
     26 
     27 Object.defineProperty(target, 'prop', {
     28  value: 1,
     29  configurable: false
     30 });
     31 
     32 assert.throws(TypeError, function() {
     33  Object.defineProperty(p, 'prop', {
     34    value: 1,
     35    configurable: true
     36  });
     37 });
     38 
     39 reportCompare(0, 0);