-
Notifications
You must be signed in to change notification settings - Fork 688
Remove bad assertion in ecma_builtin_json_str_helper #2521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| @@ -0,0 +1,2 @@ | |||
| Object.defineProperty(Object.prototype, "", {}); | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a license header.
| JERRY_ASSERT (ecma_is_value_true (put_comp_val)); | ||
| if (!ecma_is_value_true (put_comp_val)) | ||
| { | ||
| ecma_deref_object (obj_wrapper_p); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this enough? Some lines below, the normal code path frees put_comp_val, empty_str_p, and obj_wrapper_p before returning. I think the error handling code path should also do proper cleanup. Perhaps
if (ecma_is_value_true (put_comp_val))
{
ECMA_TRY_CATCH (str_val,
ecma_builtin_json_str (empty_str_p, obj_wrapper_p, &context),
ret_value);
ret_value = ecma_copy_value (str_val);
ECMA_FINALIZE (str_val);
}
else
{
ret_value = ECMA_VALUE_UNDEFINED;
}might work better.
Note: the normal code path mysteriously frees put_comp_val twice. That could be fixed now, I think.
|
Thanks for the review @akosthekiss , I have updated accordingly. |
akosthekiss
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
|
||
| if (ecma_is_value_true (put_comp_val)) | ||
| { | ||
| ECMA_TRY_CATCH (str_val, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified. ECMA_TRY_CATCH is unnecessary, the following code is equal:
{
ret_value = ecma_builtin_json_str (empty_str_p, obj_wrapper_p, &context);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the ecma_copy_value not needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ecma_copy_value was needed because of the ECMA_FINALIZE. Without the ECMA_TRY_CATCH and ECMA_FINALIZE it is not needed anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. That makes everything a lot simpler.
Fixes #2494 JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
|
Thanks @LaszloLango , I have updated the PR. |
LaszloLango
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…nternal method This patch fixes jerryscript-project#2652 and fixes jerryscript-project#2653 as well, also reverts jerryscript-project#2521. Related part of the standard ECMAScript v5.1 15.12.3.10. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
Fixes #2494
JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu