diff options
author | Mike Blumenkrantz <zmike@samsung.com> | 2014-04-21 10:29:53 -0400 |
---|---|---|
committer | Mike Blumenkrantz <zmike@samsung.com> | 2014-04-25 10:52:15 -0400 |
commit | 939f2eea7f8318864c85010c704a6045d2e77b51 (patch) | |
tree | 9dcc2c0e95e19cb808d305d4efc12d12a3a301a5 /src | |
parent | c5b1598e6e21fb11e7a0672e14077f61181b510b (diff) |
edje now has the group.script_recursion flag for permitting unsafe embryo recursion
this is enabled for all scripts within a group, and it should only be used if you:
1) know what you are doing
2) know why this is unsafe (T905)
@feature
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/edje/edje_cc_handlers.c | 28 | ||||
-rw-r--r-- | src/lib/edje/edje_data.c | 1 | ||||
-rw-r--r-- | src/lib/edje/edje_embryo.c | 2 | ||||
-rw-r--r-- | src/lib/edje/edje_private.h | 2 |
4 files changed, 32 insertions, 1 deletions
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c index de1556dc8e..34d430edec 100644 --- a/src/bin/edje/edje_cc_handlers.c +++ b/src/bin/edje/edje_cc_handlers.c | |||
@@ -209,6 +209,7 @@ static void st_collections_group_program_source(void); | |||
209 | static void st_collections_group_part_remove(void); | 209 | static void st_collections_group_part_remove(void); |
210 | static void st_collections_group_program_remove(void); | 210 | static void st_collections_group_program_remove(void); |
211 | static void st_collections_group_script_only(void); | 211 | static void st_collections_group_script_only(void); |
212 | static void st_collections_group_script_recursion(void); | ||
212 | static void st_collections_group_alias(void); | 213 | static void st_collections_group_alias(void); |
213 | static void st_collections_group_min(void); | 214 | static void st_collections_group_min(void); |
214 | static void st_collections_group_max(void); | 215 | static void st_collections_group_max(void); |
@@ -532,6 +533,7 @@ New_Statement_Handler statement_handlers[] = | |||
532 | {"collections.group.part_remove", st_collections_group_part_remove}, | 533 | {"collections.group.part_remove", st_collections_group_part_remove}, |
533 | {"collections.group.program_remove", st_collections_group_program_remove}, | 534 | {"collections.group.program_remove", st_collections_group_program_remove}, |
534 | {"collections.group.script_only", st_collections_group_script_only}, | 535 | {"collections.group.script_only", st_collections_group_script_only}, |
536 | {"collections.group.script_recursion", st_collections_group_script_recursion}, | ||
535 | {"collections.group.lua_script_only", st_collections_group_script_only}, | 537 | {"collections.group.lua_script_only", st_collections_group_script_only}, |
536 | {"collections.group.alias", st_collections_group_alias}, | 538 | {"collections.group.alias", st_collections_group_alias}, |
537 | {"collections.group.min", st_collections_group_min}, | 539 | {"collections.group.min", st_collections_group_min}, |
@@ -3477,6 +3479,32 @@ st_collections_group_script_only(void) | |||
3477 | /** | 3479 | /** |
3478 | @page edcref | 3480 | @page edcref |
3479 | @property | 3481 | @property |
3482 | script_recursion | ||
3483 | @parameters | ||
3484 | [1/0] | ||
3485 | @effect | ||
3486 | This flag (1/0) determines whether to error on unsafe calls when | ||
3487 | recursively running Embryo programs. | ||
3488 | For example, running an Embryo script which calls EDC which has a | ||
3489 | script{} block is unsafe, and the outer-most (first) Embryo stack is GUARANTEED | ||
3490 | to be corrupted. Only use this flag if you are sure that you know what you are doing. | ||
3491 | @since 1.10 | ||
3492 | @endproperty | ||
3493 | */ | ||
3494 | static void | ||
3495 | st_collections_group_script_recursion(void) | ||
3496 | { | ||
3497 | Edje_Part_Collection *pc; | ||
3498 | |||
3499 | check_arg_count(1); | ||
3500 | |||
3501 | pc = eina_list_data_get(eina_list_last(edje_collections)); | ||
3502 | pc->script_recursion = parse_bool(0); | ||
3503 | } | ||
3504 | |||
3505 | /** | ||
3506 | @page edcref | ||
3507 | @property | ||
3480 | alias | 3508 | alias |
3481 | @parameters | 3509 | @parameters |
3482 | [aditional group name] | 3510 | [aditional group name] |
diff --git a/src/lib/edje/edje_data.c b/src/lib/edje/edje_data.c index 2a9cf3fdaa..a6d7c8124a 100644 --- a/src/lib/edje/edje_data.c +++ b/src/lib/edje/edje_data.c | |||
@@ -1077,6 +1077,7 @@ _edje_edd_init(void) | |||
1077 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "physics.world.depth", physics.world.depth, EET_T_INT); | 1077 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "physics.world.depth", physics.world.depth, EET_T_INT); |
1078 | #endif | 1078 | #endif |
1079 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "physics_enabled", physics_enabled, EET_T_UCHAR); | 1079 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "physics_enabled", physics_enabled, EET_T_UCHAR); |
1080 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "script_recursion", script_recursion, EET_T_UCHAR); | ||
1080 | } | 1081 | } |
1081 | 1082 | ||
1082 | EAPI void | 1083 | EAPI void |
diff --git a/src/lib/edje/edje_embryo.c b/src/lib/edje/edje_embryo.c index b4ba41f171..2f03c6ba89 100644 --- a/src/lib/edje/edje_embryo.c +++ b/src/lib/edje/edje_embryo.c | |||
@@ -3871,7 +3871,7 @@ _edje_embryo_test_run(Edje *ed, const char *fname, const char *sig, const char * | |||
3871 | /* will likely end up being much longer than 0.016 seconds - more */ | 3871 | /* will likely end up being much longer than 0.016 seconds - more */ |
3872 | /* like 0.03 - 0.05 seconds or even more */ | 3872 | /* like 0.03 - 0.05 seconds or even more */ |
3873 | embryo_program_max_cycle_run_set(ed->collection->script, 5000000); | 3873 | embryo_program_max_cycle_run_set(ed->collection->script, 5000000); |
3874 | if (embryo_program_recursion_get(ed->collection->script)) | 3874 | if (embryo_program_recursion_get(ed->collection->script) && (!ed->collection->script_recursion)) |
3875 | ERR("You are running Embryo->EDC->Embryo with script program '%s';\nBy the power of Grayskull, your previous Embryo stack is now broken!", fname); | 3875 | ERR("You are running Embryo->EDC->Embryo with script program '%s';\nBy the power of Grayskull, your previous Embryo stack is now broken!", fname); |
3876 | ret = embryo_program_run(ed->collection->script, fn); | 3876 | ret = embryo_program_run(ed->collection->script, fn); |
3877 | if (ret == EMBRYO_PROGRAM_FAIL) | 3877 | if (ret == EMBRYO_PROGRAM_FAIL) |
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 96adb6ea9e..1c756b2a9f 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h | |||
@@ -967,6 +967,8 @@ struct _Edje_Part_Collection | |||
967 | 967 | ||
968 | unsigned char physics_enabled; /* will be 1 if a body is declared */ | 968 | unsigned char physics_enabled; /* will be 1 if a body is declared */ |
969 | 969 | ||
970 | unsigned char script_recursion; /* permits unsafe Embryo->EDC->Embryo scripting */ | ||
971 | |||
970 | unsigned char checked : 1; | 972 | unsigned char checked : 1; |
971 | }; | 973 | }; |
972 | 974 | ||