tor-browser

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

target-property-is-accessor-not-configurable-set-is-undefined.js (931B)


      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.9
      5 description: >
      6    [[Set]] ( P, V, Receiver)
      7 
      8    Throws a TypeError when target property is an accessor not configurable and
      9    and set is undefined.
     10 info: |
     11    14. If targetDesc is not undefined, then
     12        b. If IsAccessorDescriptor(targetDesc) and targetDesc.[[Configurable]] is false, then
     13            i. If targetDesc.[[Set]] is undefined, throw a TypeError exception.
     14 
     15 features: [Proxy]
     16 ---*/
     17 
     18 var target = {};
     19 var handler = {
     20  set: function(t, prop, value, receiver) {
     21    return true;
     22  }
     23 };
     24 var p = new Proxy(target, handler);
     25 
     26 Object.defineProperty(target, 'attr', {
     27  configurable: false,
     28  set: undefined
     29 });
     30 
     31 assert.throws(TypeError, function() {
     32  p.attr = 'bar';
     33 });
     34 
     35 assert.throws(TypeError, function() {
     36  p['attr'] = 'bar';
     37 });
     38 
     39 reportCompare(0, 0);