Skip to content

Use const object parameters in getter API functions #1047

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

LaszloLango
Copy link
Contributor

Related issue: #668

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com

@LaszloLango LaszloLango added enhancement An improvement minor api Related to the public API style Related to coding style labels May 10, 2016
@@ -392,7 +392,7 @@ ecma_op_function_object_get_own_property (ecma_object_t *obj_p, /**< the functio
}
else if (!ecma_get_object_is_builtin (obj_p))
{
prop_p = ecma_op_function_try_lazy_instantiate_property (obj_p, property_name_p);
prop_p = ecma_op_function_try_lazy_instantiate_property ((ecma_object_t *) obj_p, property_name_p);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, this cast makes the patch ugly and non-secure. Any suggestion to avoid this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot avoid this, since reading a property (length for example) might also trigger its construction. Hence the object is extended, and an out-of-memory error can stop the engine.

@LaszloLango
Copy link
Contributor Author

LaszloLango commented May 10, 2016

This is a WIP patch. There are few const to non-const cast in the code that shouldn't be there.

@LaszloLango LaszloLango force-pushed the use-const-in-api-getters branch 2 times, most recently from dfdda5f to f63c3f2 Compare May 30, 2016 13:21
@zherczeg
Copy link
Member

What is the plan with this patch? Shall we move the property hash map creation into some other place? Or make it error tolerant?

@LaszloLango
Copy link
Contributor Author

@zherczeg, good question. :) I think the API change is still needed and the referred issue is valid and open in a long time, so we should do something with it. Moving the property hash map creation sounds good to me, but currently no idea how to do it. Any specific idea?

@zherczeg
Copy link
Member

zherczeg commented Jun 2, 2016

Perhaps we can move it when a property is assigned. But that does not easy either.

@LaszloLango LaszloLango force-pushed the use-const-in-api-getters branch from f63c3f2 to 56dd68c Compare June 2, 2016 12:23
Related issue: jerryscript-project#668

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
@LaszloLango LaszloLango force-pushed the use-const-in-api-getters branch from 56dd68c to 6471e03 Compare June 16, 2016 12:46
@LaszloLango LaszloLango added this to the Release v1.0 milestone Jun 16, 2016
@LaszloLango LaszloLango removed minor style Related to coding style labels Jun 16, 2016
@LaszloLango LaszloLango mentioned this pull request Jun 16, 2016
13 tasks
@LaszloLango
Copy link
Contributor Author

Won't fix.

@LaszloLango LaszloLango deleted the use-const-in-api-getters branch July 12, 2016 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Related to the public API enhancement An improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants