tor-browser

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

setter-prop-desc.js (1349B)


      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-object-initializer-runtime-semantics-evaluation
      5 es6id: 12.2.6.8
      6 description: Property descriptor of "set" accessor methods
      7 info: |
      8  ObjectLiteral:
      9    { PropertyDefinitionList }
     10    { PropertyDefinitionList , }
     11 
     12  1. Let obj be ObjectCreate(%ObjectPrototype%).
     13  2. Let status be the result of performing PropertyDefinitionEvaluation of
     14     PropertyDefinitionList with arguments obj and true.
     15  3. ReturnIfAbrupt(status).
     16  4. Return obj. 
     17 
     18  14.3.8 Runtime Semantics: PropertyDefinitionEvaluation
     19 
     20  MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
     21 
     22  [...]
     23  8. Let desc be the PropertyDescriptor{[[Set]]: closure, [[Enumerable]]:
     24     enumerable, [[Configurable]]: true}.
     25  [...]
     26 includes: [propertyHelper.js]
     27 ---*/
     28 
     29 var obj = { set m(x) { return x; } };
     30 var desc = Object.getOwnPropertyDescriptor(obj, 'm');
     31 
     32 verifyProperty(obj, 'm', {
     33  enumerable: true,
     34  configurable: true,
     35 });
     36 
     37 assert.sameValue(desc.value, undefined, '`value` field');
     38 assert.sameValue(desc.get, undefined, '`get` field');
     39 assert.sameValue(typeof desc.set, 'function', 'type of `set` field');
     40 assert.sameValue(desc.set(436), 436, '`set` function return value');
     41 
     42 reportCompare(0, 0);