tor-browser

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

cause-property.js (1133B)


      1 // Copyright (C) 2021 Chengzhong Wu. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-aggregate-error
      6 description: >
      7  AggregateError constructor creates own cause property
      8 info: |
      9  AggregateError ( errors, message[ , options ] )
     10 
     11  ...
     12  4. Perform ? InstallErrorCause(O, options).
     13  ...
     14 
     15  InstallErrorCause ( O, options )
     16 
     17  1. If Type(options) is Object and ? HasProperty(options, "cause") is true, then
     18    a. Let cause be ? Get(options, "cause").
     19    b. Perform ! CreateNonEnumerableDataPropertyOrThrow(O, "cause", cause).
     20  ...
     21 
     22 features: [AggregateError, error-cause]
     23 includes: [propertyHelper.js]
     24 ---*/
     25 
     26 var errors = [];
     27 var message = "my-message";
     28 var cause = { message: "my-cause" };
     29 var error = new AggregateError(errors, message, { cause });
     30 
     31 verifyProperty(error, "cause", {
     32  configurable: true,
     33  enumerable: false,
     34  writable: true,
     35  value: cause,
     36 });
     37 
     38 verifyProperty(new AggregateError(errors, message), "cause", undefined);
     39 verifyProperty(new AggregateError(errors, message, { cause: undefined }), "cause", { value: undefined });
     40 
     41 reportCompare(0, 0);