mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Add cross-realm support to RegExp.prototype (#4567)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
This commit is contained in:
parent
35ecf4c4a3
commit
76a0b18287
@ -744,7 +744,7 @@ ecma_builtin_regexp_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
|
||||
{
|
||||
if (!ecma_object_class_is (obj_p, LIT_MAGIC_STRING_REGEXP_UL))
|
||||
{
|
||||
if (ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_REGEXP_PROTOTYPE))
|
||||
if (obj_p == ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE))
|
||||
{
|
||||
return ecma_make_magic_string_value (LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP);
|
||||
}
|
||||
@ -764,7 +764,7 @@ ecma_builtin_regexp_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
|
||||
{
|
||||
if (!ecma_object_class_is (obj_p, LIT_MAGIC_STRING_REGEXP_UL))
|
||||
{
|
||||
if (ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_REGEXP_PROTOTYPE))
|
||||
if (obj_p == ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE))
|
||||
{
|
||||
return ECMA_VALUE_UNDEFINED;
|
||||
}
|
||||
|
||||
@ -264,38 +264,6 @@ ecma_builtin_get_property_count (ecma_builtin_id_t builtin_id) /**< built-in ID
|
||||
return (size_t) (curr_property_p - property_list_p);
|
||||
} /* ecma_builtin_get_property_count */
|
||||
|
||||
/**
|
||||
* Check if passed object is the instance of specified built-in.
|
||||
*
|
||||
* @return true - if the object is instance of the specified built-in
|
||||
* false - otherwise
|
||||
*/
|
||||
bool
|
||||
ecma_builtin_is (ecma_object_t *object_p, /**< pointer to an object */
|
||||
ecma_builtin_id_t builtin_id) /**< id of built-in to check on */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL && !ecma_is_lexical_environment (object_p));
|
||||
JERRY_ASSERT (builtin_id < ECMA_BUILTIN_ID__COUNT);
|
||||
|
||||
if (!ecma_get_object_is_builtin (object_p))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ECMA_BUILTIN_IS_EXTENDED_BUILT_IN (ecma_get_object_type (object_p)))
|
||||
{
|
||||
ecma_extended_built_in_object_t *extended_built_in_object_p = (ecma_extended_built_in_object_t *) object_p;
|
||||
|
||||
return (extended_built_in_object_p->built_in.id == builtin_id
|
||||
&& extended_built_in_object_p->built_in.routine_id == 0);
|
||||
}
|
||||
|
||||
ecma_extended_object_t *built_in_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
return (built_in_object_p->u.built_in.id == builtin_id
|
||||
&& built_in_object_p->u.built_in.routine_id == 0);
|
||||
} /* ecma_builtin_is */
|
||||
|
||||
/**
|
||||
* Check if passed object is a global built-in.
|
||||
*
|
||||
|
||||
@ -140,8 +140,6 @@ ecma_builtin_list_lazy_property_names (ecma_object_t *object_p,
|
||||
ecma_collection_t *prop_names_p,
|
||||
ecma_property_counter_t *prop_counter_p);
|
||||
bool
|
||||
ecma_builtin_is (ecma_object_t *object_p, ecma_builtin_id_t builtin_id);
|
||||
bool
|
||||
ecma_builtin_is_global (ecma_object_t *object_p);
|
||||
ecma_object_t *
|
||||
ecma_builtin_get (ecma_builtin_id_t builtin_id);
|
||||
|
||||
@ -2605,6 +2605,42 @@ ecma_op_object_enumerate (ecma_object_t *obj_p) /**< object */
|
||||
return return_names_p;
|
||||
} /* ecma_op_object_enumerate */
|
||||
|
||||
#ifndef JERRY_NDEBUG
|
||||
|
||||
/**
|
||||
* Check if passed object is the instance of specified built-in.
|
||||
*
|
||||
* @return true - if the object is instance of the specified built-in
|
||||
* false - otherwise
|
||||
*/
|
||||
static bool
|
||||
ecma_builtin_is (ecma_object_t *object_p, /**< pointer to an object */
|
||||
ecma_builtin_id_t builtin_id) /**< id of built-in to check on */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL && !ecma_is_lexical_environment (object_p));
|
||||
JERRY_ASSERT (builtin_id < ECMA_BUILTIN_ID__COUNT);
|
||||
|
||||
if (!ecma_get_object_is_builtin (object_p))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ECMA_BUILTIN_IS_EXTENDED_BUILT_IN (ecma_get_object_type (object_p)))
|
||||
{
|
||||
ecma_extended_built_in_object_t *extended_built_in_object_p = (ecma_extended_built_in_object_t *) object_p;
|
||||
|
||||
return (extended_built_in_object_p->built_in.id == builtin_id
|
||||
&& extended_built_in_object_p->built_in.routine_id == 0);
|
||||
}
|
||||
|
||||
ecma_extended_object_t *built_in_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
return (built_in_object_p->u.built_in.id == builtin_id
|
||||
&& built_in_object_p->u.built_in.routine_id == 0);
|
||||
} /* ecma_builtin_is */
|
||||
|
||||
#endif /* !JERRY_NDEBUG */
|
||||
|
||||
/**
|
||||
* The function is used in the assert of ecma_object_get_class_name
|
||||
*
|
||||
|
||||
@ -15,7 +15,6 @@
|
||||
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-array-object.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-gc.h"
|
||||
|
||||
@ -8603,13 +8603,6 @@
|
||||
<test id="built-ins/FinalizationRegistry/proto-from-ctor-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/Function/internals/Call/class-ctor-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/NativeErrors/AggregateError/proto-from-ctor-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/RegExp/prototype/dotAll/cross-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/RegExp/prototype/global/cross-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/RegExp/prototype/ignoreCase/cross-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/RegExp/prototype/multiline/cross-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/RegExp/prototype/source/cross-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/RegExp/prototype/sticky/cross-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/RegExp/prototype/unicode/cross-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/SharedArrayBuffer/proto-from-ctor-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/proto-from-ctor-realm-sab.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/ctors/buffer-arg/proto-from-ctor-realm-sab.js"><reason></reason></test>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user