2020-01-15 17:48:04 +01:00
|
|
|
// Copyright (C) 2019 Alexey Shvayka. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/*---
|
|
|
|
esid: sec-createresolvingfunctions
|
|
|
|
description: >
|
|
|
|
reject is anonymous built-in function with length of 1.
|
|
|
|
info: |
|
|
|
|
CreateResolvingFunctions ( promise )
|
|
|
|
|
|
|
|
...
|
|
|
|
7. Let reject be ! CreateBuiltinFunction(stepsReject, « [[Promise]], [[AlreadyResolved]] »).
|
2020-10-02 16:46:09 +02:00
|
|
|
features: [Reflect.construct, arrow-function]
|
2020-01-15 17:48:04 +01:00
|
|
|
includes: [isConstructor.js]
|
|
|
|
flags: [async]
|
|
|
|
---*/
|
|
|
|
|
|
|
|
Promise.resolve(1).then(function() {
|
2020-01-16 07:55:08 +01:00
|
|
|
return Promise.resolve();
|
|
|
|
}).then($DONE, $DONE);
|
2020-01-15 17:48:04 +01:00
|
|
|
|
2020-01-16 07:55:08 +01:00
|
|
|
var then = Promise.prototype.then;
|
|
|
|
Promise.prototype.then = function(resolve, reject) {
|
2020-10-02 16:46:09 +02:00
|
|
|
assert.sameValue(isConstructor(reject), false, 'isConstructor(reject) must return false');
|
|
|
|
assert.throws(TypeError, () => {
|
|
|
|
new reject();
|
2024-03-23 02:28:44 +01:00
|
|
|
});
|
2020-10-02 16:46:09 +02:00
|
|
|
|
|
|
|
assert.sameValue(reject.length, 1, 'The value of reject.length is 1');
|
|
|
|
assert.sameValue(reject.name, '', 'The value of reject.name is ""');
|
2020-01-15 17:48:04 +01:00
|
|
|
|
2020-01-16 07:55:08 +01:00
|
|
|
return then.call(this, resolve, reject);
|
2020-01-15 17:48:04 +01:00
|
|
|
};
|