tor-browser

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

symbol-data-property-default-non-strict.js (1082B)


      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 property definition
      7 flags: [noStrict]
      8 features: [Symbol]
      9 includes: [propertyHelper.js]
     10 ---*/
     11 var sym = Symbol();
     12 var obj = {};
     13 
     14 
     15 Object.defineProperty(obj, sym, {
     16  value: 1,
     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: false,
     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 assert.sameValue(delete obj[sym], false, "The result of `delete obj[sym]` is `false`");
     34 
     35 assert.notSameValue(
     36  Object.getOwnPropertyDescriptor(obj, sym),
     37  undefined,
     38  "`Object.getOwnPropertyDescriptor(obj, sym)` does not return `undefined`"
     39 );
     40 
     41 obj[sym] = 2;
     42 
     43 assert.sameValue(obj[sym], 1, "The value of `obj[sym]` is `1`");
     44 
     45 reportCompare(0, 0);