Fix the length values of Promise built-in functions (#4041)

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
This commit is contained in:
Dániel Bátyai 2020-07-27 11:07:25 +02:00 committed by GitHub
parent 11c2ae30d1
commit 3f0f9589c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 10 deletions

View File

@ -1621,16 +1621,21 @@ ecma_op_external_function_try_to_lazy_instantiate_property (ecma_object_t *objec
if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_LENGTH))
{
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;
ecma_external_handler_t handler = ext_obj_p->u.external_handler_cb;
if (ext_obj_p->u.external_handler_cb == ecma_promise_then_finally_cb
|| ext_obj_p->u.external_handler_cb == ecma_promise_catch_finally_cb)
if (handler == ecma_promise_then_finally_cb
|| handler == ecma_promise_catch_finally_cb
|| handler == ecma_promise_resolve_handler
|| handler == ecma_promise_reject_handler
|| handler == ecma_promise_all_handler_cb
|| handler == ecma_op_get_capabilities_executor_cb)
{
ecma_property_t *value_prop_p;
ecma_property_value_t *value_p = ecma_create_named_data_property (object_p,
property_name_p,
ECMA_PROPERTY_FLAG_CONFIGURABLE,
&value_prop_p);
value_p->value = ecma_make_uint32_value (1);
value_p->value = ecma_make_uint32_value (handler == ecma_op_get_capabilities_executor_cb ? 2 : 1);
return value_prop_p;
}
}

View File

@ -297,7 +297,7 @@ ecma_fulfill_promise (ecma_value_t promise, /**< promise */
*
* @return ecma value of undefined.
*/
static ecma_value_t
ecma_value_t
ecma_promise_reject_handler (const ecma_value_t function, /**< the function itself */
const ecma_value_t this, /**< this_arg of the function */
const ecma_value_t argv[], /**< argument list */
@ -334,7 +334,7 @@ ecma_promise_reject_handler (const ecma_value_t function, /**< the function itse
*
* @return ecma value of undefined.
*/
static ecma_value_t
ecma_value_t
ecma_promise_resolve_handler (const ecma_value_t function, /**< the function itself */
const ecma_value_t this, /**< this_arg of the function */
const ecma_value_t argv[], /**< argument list */

View File

@ -125,6 +125,17 @@ ecma_value_t ecma_promise_catch_finally_cb (const ecma_value_t function_obj,
const ecma_value_t this_val,
const ecma_value_t args_p[],
const uint32_t args_count);
ecma_value_t
ecma_promise_reject_handler (const ecma_value_t function,
const ecma_value_t this,
const ecma_value_t argv[],
const uint32_t argc);
ecma_value_t
ecma_promise_resolve_handler (const ecma_value_t function,
const ecma_value_t this,
const ecma_value_t argv[],
const uint32_t argc);
ecma_value_t ecma_promise_finally (ecma_value_t promise, ecma_value_t on_finally);
void ecma_promise_async_then (ecma_value_t promise, ecma_value_t executable_object);
ecma_value_t ecma_promise_async_await (ecma_extended_object_t *async_generator_object_p, ecma_value_t value);

View File

@ -60,12 +60,7 @@
<test id="built-ins/decodeURIComponent/S15.1.3.2_A2.5_T1.js"><reason></reason></test>
<test id="built-ins/decodeURI/S15.1.3.1_A2.5_T1.js"><reason></reason></test>
<test id="built-ins/GeneratorPrototype/next/context-constructor-invocation.js"><reason></reason></test>
<test id="built-ins/Promise/all/invoke-then.js"><reason></reason></test>
<test id="built-ins/Promise/all/species-get-error.js"><reason></reason></test>
<test id="built-ins/Promise/exec-args.js"><reason></reason></test>
<test id="built-ins/Promise/prototype/then/ctor-custom.js"><reason></reason></test>
<test id="built-ins/Promise/prototype/then/on-fulfilled-return-thenable.js"><reason></reason></test>
<test id="built-ins/Promise/race/invoke-then.js"><reason></reason></test>
<test id="built-ins/Promise/race/species-get-error.js"><reason></reason></test>
<test id="built-ins/Proxy/enumerate/call-parameters.js"><reason></reason></test>
<test id="built-ins/Proxy/enumerate/return-is-abrupt.js"><reason></reason></test>