tor-browser

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

arg-uniq-ctor.js (797B)


      1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 description: >
      6    `Promise.resolve` invoked with a Promise with a unique constructor
      7 es6id: 25.4.4.5
      8 info: |
      9    1. Let C be the this value.
     10    [...]
     11    3. If IsPromise(x) is true,
     12       a. Let xConstructor be Get(x, "constructor").
     13       b. ReturnIfAbrupt(xConstructor).
     14       c. If SameValue(xConstructor, C) is true, return x.
     15    4. Let promiseCapability be NewPromiseCapability(C).
     16    [...]
     17    8. Return promiseCapability.[[Promise]].
     18 ---*/
     19 
     20 var promise1 = new Promise(function() {});
     21 var promise2;
     22 
     23 promise1.constructor = null;
     24 
     25 promise2 = Promise.resolve(promise1);
     26 
     27 assert.sameValue(promise1 === promise2, false);
     28 
     29 reportCompare(0, 0);