tor-browser

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

verifyProperty-undefined-desc.js (669B)


      1 // Copyright (C) 2017 Leo Balter. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 description: >
      6  Verify an undefined descriptor
      7 includes: [propertyHelper.js]
      8 ---*/
      9 var sample = {
     10  bar: undefined,
     11  get baz() {}
     12 };
     13 
     14 assert.sameValue(
     15  verifyProperty(sample, "foo", undefined),
     16  true,
     17  "returns true if desc and property descriptor are both undefined"
     18 );
     19 
     20 assert.throws(Test262Error, () => {
     21  verifyProperty(sample, 'bar', undefined);
     22 }, "dataDescriptor value is undefined");
     23 
     24 assert.throws(Test262Error, () => {
     25  verifyProperty(sample, 'baz', undefined);
     26 }, "accessor returns undefined");
     27 
     28 reportCompare(0, 0);