tor-browser

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

symbol-data-property-writable.js (846B)


      1 // Copyright (C) 2013 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 es6id: 19.1.2.4
      5 description: >
      6    Symbol used as property for writable data property definition
      7 features: [Symbol]
      8 includes: [propertyHelper.js]
      9 ---*/
     10 var sym = Symbol();
     11 var obj = {};
     12 
     13 
     14 Object.defineProperty(obj, sym, {
     15  value: 1,
     16  writable: true
     17 });
     18 
     19 assert.sameValue(sym in obj, true, "The result of `sym in obj` is `true`");
     20 verifyProperty(obj, sym, {
     21  value: 1,
     22  configurable: false,
     23  writable: true,
     24  enumerable: false,
     25 });
     26 
     27 assert.sameValue(
     28  Object.prototype.propertyIsEnumerable.call(obj, sym),
     29  false,
     30  "`Object.prototype.propertyIsEnumerable.call(obj, sym)` returns `false`"
     31 );
     32 
     33 obj[sym] = 2;
     34 
     35 assert.sameValue(obj[sym], 2, "The value of `obj[sym]` is `2`");
     36 
     37 reportCompare(0, 0);