Skip to content
Snippets Groups Projects
Commit a392f6ce authored by Sathya Gunasekaran's avatar Sathya Gunasekaran
Browse files

Promise.p.finally: test SpeciesConstructor and Symbol.species lookup

parent f8456c6d
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