Skip to content
Snippets Groups Projects
Unverified Commit 2659c888 authored by Rick Waldron's avatar Rick Waldron Committed by GitHub
Browse files

Merge pull request #1329 from gsathya/promise-finally-species-constructor

Promise.p.finally: test SpeciesConstructor and Symbol.species lookup
parents 350d2c70 a392f6ce
No related branches found
No related tags found
No related merge requests found
// Copyright (C) 2017 V8. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
author: Sathya Gunasekaran
description: finally calls the SpeciesConstructor
esid: sec-promise.prototype.finally
features: [Promise.prototype.finally]
flags: [async]
---*/
var count = 0;
class FooPromise extends Promise {
constructor(resolve, reject) {
count++;
return super(resolve, reject);
}
}
new FooPromise(r => r())
.finally(() => {})
.then(() => {
assert.sameValue(count, 6, "6 new promises were created");
$DONE();
});
// Copyright (C) 2017 V8. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
author: Sathya Gunasekaran
description: finally calls the SpeciesConstructor
esid: sec-promise.prototype.finally
features: [Promise.prototype.finally]
---*/
class MyPromise extends Promise {
static get [Symbol.species]() { return Promise; }
}
var p = Promise
.resolve()
.finally(() => MyPromise.resolve());
assert.sameValue(true, p instanceof Promise);
assert.sameValue(false, p instanceof MyPromise);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment