tor-browser

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

symbol-data-property-default-strict-strict.js (1128B)


      1 'use strict';
      2 // Copyright (C) 2013 the V8 project authors. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 /*---
      5 es6id: 19.1.2.4
      6 description: >
      7    Symbol used as property for default data property definition
      8 flags: [onlyStrict]
      9 features: [Symbol]
     10 includes: [propertyHelper.js]
     11 ---*/
     12 var sym = Symbol();
     13 var obj = {};
     14 
     15 
     16 Object.defineProperty(obj, sym, {
     17  value: 1,
     18 });
     19 
     20 assert.sameValue(sym in obj, true, "The result of `sym in obj` is `true`");
     21 verifyProperty(obj, sym, {
     22  value: 1,
     23  configurable: false,
     24  writable: false,
     25  enumerable: false,
     26 });
     27 
     28 assert.sameValue(
     29  Object.prototype.propertyIsEnumerable.call(obj, sym),
     30  false,
     31  "`Object.prototype.propertyIsEnumerable.call(obj, sym)` returns `false`"
     32 );
     33 
     34 assert.throws(TypeError, function() {
     35  delete obj[sym];
     36 });
     37 
     38 assert.notSameValue(
     39  Object.getOwnPropertyDescriptor(obj, sym),
     40  undefined,
     41  "`Object.getOwnPropertyDescriptor(obj, sym)` does not return `undefined`"
     42 );
     43 
     44 assert.throws(TypeError, function() {
     45  obj[sym] = 2;
     46 });
     47 
     48 assert.sameValue(obj[sym], 1, "The value of `obj[sym]` is `1`");
     49 
     50 reportCompare(0, 0);