diff --git a/jerry-core/ecma/operations/ecma-function-object.c b/jerry-core/ecma/operations/ecma-function-object.c index 13da08639..864ed56da 100644 --- a/jerry-core/ecma/operations/ecma-function-object.c +++ b/jerry-core/ecma/operations/ecma-function-object.c @@ -1600,8 +1600,10 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**< return ecma_op_lazy_instantiate_prototype_object (object_p); } - if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_CALLER) - || ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_ARGUMENTS)) + const bool is_arguments = ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_ARGUMENTS); + + if (is_arguments + || ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_CALLER)) { const ecma_compiled_code_t *bytecode_data_p; bytecode_data_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p); @@ -1616,7 +1618,7 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**< property_name_p, ECMA_PROPERTY_FIXED, &value_prop_p); - value_p->value = ECMA_VALUE_NULL; + value_p->value = is_arguments ? ECMA_VALUE_NULL : ECMA_VALUE_UNDEFINED; return value_prop_p; } #else /* !ENABLED (JERRY_ESNEXT) */ diff --git a/tests/jerry/es.next/function-arguments-caller.js b/tests/jerry/es.next/function-arguments-caller.js index 3eb2b9582..64826c03e 100644 --- a/tests/jerry/es.next/function-arguments-caller.js +++ b/tests/jerry/es.next/function-arguments-caller.js @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -var props = ['arguments', 'caller']; - function f_simple () { } @@ -21,27 +19,48 @@ function f_strict () { "use strict"; } -for (let prop of props) { - try { - Function.prototype[prop]; - assert(false); - } catch (e) { - assert(e instanceof TypeError); - } - - assert(f_simple[prop] === null); - - try { - f_strict[prop]; - assert(false); - } catch (e) { - assert(e instanceof TypeError); - } - - let desc = Object.getOwnPropertyDescriptor(f_simple, prop); - assert(desc.value === null); - assert(desc.writable === false); - assert(desc.enumerable === false); - assert(desc.configurable === false); - assert(Object.getOwnPropertyDescriptor(f_strict, prop) === undefined); +try { + Function.prototype["arguments"]; + assert(false); +} catch (e) { + assert(e instanceof TypeError); } + +assert(f_simple["arguments"] === null); + +try { + f_strict["arguments"]; + assert(false); +} catch (e) { + assert(e instanceof TypeError); +} + +let desc = Object.getOwnPropertyDescriptor(f_simple, "arguments"); +assert(desc.value === null); +assert(desc.writable === false); +assert(desc.enumerable === false); +assert(desc.configurable === false); +assert(Object.getOwnPropertyDescriptor(f_strict, "arguments") === undefined); + +try { + Function.prototype["caller"]; + assert(false); +} catch (e) { + assert(e instanceof TypeError); +} + +assert(f_simple["caller"] === undefined); + +try { + f_strict["caller"]; + assert(false); +} catch (e) { + assert(e instanceof TypeError); +} + +desc = Object.getOwnPropertyDescriptor(f_simple, "caller"); +assert(desc.value === undefined); +assert(desc.writable === false); +assert(desc.enumerable === false); +assert(desc.configurable === false); +assert(Object.getOwnPropertyDescriptor(f_strict, "arguments") === undefined); diff --git a/tests/test262-es6-excludelist.xml b/tests/test262-es6-excludelist.xml index 1ea4f7d10..e30e36846 100644 --- a/tests/test262-es6-excludelist.xml +++ b/tests/test262-es6-excludelist.xml @@ -241,8 +241,6 @@ - - No longer a SyntaxError in ES11 diff --git a/tests/test262-esnext-excludelist.xml b/tests/test262-esnext-excludelist.xml index b28c699c7..5e5942066 100644 --- a/tests/test262-esnext-excludelist.xml +++ b/tests/test262-esnext-excludelist.xml @@ -2864,8 +2864,6 @@ - -