tor-browser

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

targetdesc-configurable-desc-not-configurable.js (891B)


      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.6
      5 description: >
      6    Throw a TypeError exception if Desc is not configurable and target property
      7    descriptor is configurable and trap result is true.
      8 info: |
      9    [[DefineOwnProperty]] (P, Desc)
     10 
     11    ...
     12    20. Else targetDesc is not undefined,
     13        b. If settingConfigFalse is true and targetDesc.[[Configurable]] is
     14        true, throw a TypeError exception.
     15    ...
     16 features: [Proxy]
     17 ---*/
     18 
     19 var target = {};
     20 var p = new Proxy(target, {
     21  defineProperty: function(t, prop, desc) {
     22    return true;
     23  }
     24 });
     25 
     26 Object.defineProperty(target, "foo", {
     27  value: 1,
     28  configurable: true
     29 });
     30 
     31 assert.throws(TypeError, function() {
     32  Object.defineProperty(p, "foo", {
     33    value: 1,
     34    configurable: false
     35  });
     36 });
     37 
     38 reportCompare(0, 0);