Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Promise/resolve/arg-uniq-ctor.js

raw
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);