discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=939f2eea7f8318864c85010c704a6045d2e77b51

commit 939f2eea7f8318864c85010c704a6045d2e77b51
Author: Mike Blumenkrantz <[email protected]>
Date:   Mon Apr 21 10:29:53 2014 -0400

    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
---
 src/bin/edje/edje_cc_handlers.c | 28 ++++++++++++++++++++++++++++
 src/lib/edje/edje_data.c        |  1 +
 src/lib/edje/edje_embryo.c      |  2 +-
 src/lib/edje/edje_private.h     |  2 ++
 4 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index de1556d..34d430e 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);
 static void st_collections_group_part_remove(void);
 static void st_collections_group_program_remove(void);
 static void st_collections_group_script_only(void);
+static void st_collections_group_script_recursion(void);
 static void st_collections_group_alias(void);
 static void st_collections_group_min(void);
 static void st_collections_group_max(void);
@@ -532,6 +533,7 @@ New_Statement_Handler statement_handlers[] =
      {"collections.group.part_remove", st_collections_group_part_remove},
      {"collections.group.program_remove", st_collections_group_program_remove},
      {"collections.group.script_only", st_collections_group_script_only},
+     {"collections.group.script_recursion", 
st_collections_group_script_recursion},
      {"collections.group.lua_script_only", st_collections_group_script_only},
      {"collections.group.alias", st_collections_group_alias},
      {"collections.group.min", st_collections_group_min},
@@ -3477,6 +3479,32 @@ st_collections_group_script_only(void)
 /**
     @page edcref
     @property
+        script_recursion
+    @parameters
+        [1/0]
+    @effect
+        This flag (1/0) determines whether to error on unsafe calls when
+        recursively running Embryo programs.
+        For example, running an Embryo script which calls EDC which has a
+        script{} block is unsafe, and the outer-most (first) Embryo stack is 
GUARANTEED
+        to be corrupted. Only use this flag if you are sure that you know what 
you are doing.
+        @since 1.10
+    @endproperty
+*/
+static void
+st_collections_group_script_recursion(void)
+{
+   Edje_Part_Collection *pc;
+
+   check_arg_count(1);
+
+   pc = eina_list_data_get(eina_list_last(edje_collections));
+   pc->script_recursion = parse_bool(0);
+}
+
+/**
+    @page edcref
+    @property
         alias
     @parameters
         [aditional group name]
diff --git a/src/lib/edje/edje_data.c b/src/lib/edje/edje_data.c
index 2a9cf3f..a6d7c81 100644
--- a/src/lib/edje/edje_data.c
+++ b/src/lib/edje/edje_data.c
@@ -1077,6 +1077,7 @@ _edje_edd_init(void)
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, 
Edje_Part_Collection, "physics.world.depth", physics.world.depth, EET_T_INT);
 #endif
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, 
Edje_Part_Collection, "physics_enabled", physics_enabled, EET_T_UCHAR);
+   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, 
Edje_Part_Collection, "script_recursion", script_recursion, EET_T_UCHAR);
 }
 
 EAPI void
diff --git a/src/lib/edje/edje_embryo.c b/src/lib/edje/edje_embryo.c
index b4ba41f..2f03c6b 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 *
         /* will likely end up being much longer than 0.016 seconds - more */
         /* like 0.03 - 0.05 seconds or even more */
         embryo_program_max_cycle_run_set(ed->collection->script, 5000000);
-        if (embryo_program_recursion_get(ed->collection->script))
+        if (embryo_program_recursion_get(ed->collection->script) && 
(!ed->collection->script_recursion))
           ERR("You are running Embryo->EDC->Embryo with script program 
'%s';\nBy the power of Grayskull, your previous Embryo stack is now broken!", 
fname);
         ret = embryo_program_run(ed->collection->script, fn);
         if (ret == EMBRYO_PROGRAM_FAIL)
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 96adb6e..1c756b2 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -967,6 +967,8 @@ struct _Edje_Part_Collection
 
    unsigned char    physics_enabled; /* will be 1 if a body is declared */
 
+   unsigned char    script_recursion; /* permits unsafe Embryo->EDC->Embryo 
scripting */
+
    unsigned char    checked : 1;
 };
 

-- 


Reply via email to