Pekka Lampila
2007-Sep-02 18:34 UTC
[Swfdec] 3 commits - libswfdec/swfdec_as_number.c libswfdec/swfdec_internal.h libswfdec/swfdec_player_as.c libswfdec/swfdec_player.c test/trace
libswfdec/swfdec_as_number.c | 2 +- libswfdec/swfdec_internal.h | 2 ++ libswfdec/swfdec_player.c | 2 ++ libswfdec/swfdec_player_as.c | 43 ++++++++++++++----------------------------- test/trace/Makefile.am | 8 ++++++++ 5 files changed, 27 insertions(+), 30 deletions(-) New commits: diff-tree aa5947ee972f285b59556ab8888081addd458bfe (from cc6e32e8cbbd672fb0393ef428f65fc7f4b49f43) Author: Pekka Lampila <pekka.lampila at iki.fi> Date: Sat Sep 1 22:08:11 2007 +0300 LoadVars test was missing from Makefile.am diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am index 22b7a95..484da67 100644 --- a/test/trace/Makefile.am +++ b/test/trace/Makefile.am @@ -575,6 +575,14 @@ EXTRA_DIST = \ loadobject-6.swf.trace \ loadobject-7.swf \ loadobject-7.swf.trace \ + loadvars.as \ + loadvars-5.swf \ + loadvars-5.swf.trace \ + loadvars-6.swf \ + loadvars-6.swf.trace \ + loadvars-7.swf \ + loadvars-7.swf.trace \ + loadvars.txt \ local.swf \ local.swf.trace \ lots-of-arguments.as \ diff-tree cc6e32e8cbbd672fb0393ef428f65fc7f4b49f43 (from 613fd1b7aee8c0b58dd4a9061caa8cd2bb899ce2) Author: Pekka Lampila <pekka.lampila at iki.fi> Date: Sat Sep 1 00:36:53 2007 +0300 Handle making ASnative and ASconstructor childless in nicer way Create them before swfdec_as_context_startup is ran, so they never get any properties. diff --git a/libswfdec/swfdec_internal.h b/libswfdec/swfdec_internal.h index 563bd35..f98cd08 100644 --- a/libswfdec/swfdec_internal.h +++ b/libswfdec/swfdec_internal.h @@ -62,6 +62,8 @@ SwfdecVideoDecoder * swfdec_video_decode /* AS engine setup code */ +void swfdec_player_preinit_global (SwfdecPlayer * player, + guint version); void swfdec_player_init_global (SwfdecPlayer * player, guint version); void swfdec_movie_color_init_context (SwfdecPlayer * player, diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c index 5987382..ecdc3cf 100644 --- a/libswfdec/swfdec_player.c +++ b/libswfdec/swfdec_player.c @@ -1595,6 +1595,8 @@ swfdec_player_initialize (SwfdecPlayer * if (swfdec_player_is_initialized (player)) return; + swfdec_player_preinit_global (player, version); + context = SWFDEC_AS_CONTEXT (player); swfdec_as_context_startup (context, version); /* reset state for initialization */ diff --git a/libswfdec/swfdec_player_as.c b/libswfdec/swfdec_player_as.c index a492055..2fd543a 100644 --- a/libswfdec/swfdec_player_as.c +++ b/libswfdec/swfdec_player_as.c @@ -264,11 +264,23 @@ swfdec_player_object_registerClass (Swfd SWFDEC_AS_VALUE_SET_BOOLEAN (rval, TRUE); } +// this is ran before swfdec_as_context_startup +void +swfdec_player_preinit_global (SwfdecPlayer *player, guint version) +{ + SwfdecAsContext *context = SWFDEC_AS_CONTEXT (player); + + // init these two before swfdec_as_context_startup, so they won't get + // __proto__ and constructor properties + swfdec_as_object_add_function (context->global, SWFDEC_AS_STR_ASnative, + 0, swfdec_player_ASnative, 2); + swfdec_as_object_add_function (context->global, SWFDEC_AS_STR_ASconstructor, + 0, swfdec_player_ASconstructor, 2); +} + void swfdec_player_init_global (SwfdecPlayer *player, guint version) { - SwfdecAsValue val; - SwfdecAsObject *object; SwfdecAsContext *context = SWFDEC_AS_CONTEXT (player); swfdec_as_object_add_function (context->Object, SWFDEC_AS_STR_registerClass, @@ -277,32 +289,5 @@ swfdec_player_init_global (SwfdecPlayer 0, swfdec_player_setInterval, 2); swfdec_as_object_add_function (context->global, SWFDEC_AS_STR_clearInterval, 0, swfdec_player_clearInterval, 1); - swfdec_as_object_add_function (context->global, SWFDEC_AS_STR_ASnative, - 0, swfdec_player_ASnative, 2); - swfdec_as_object_add_function (context->global, SWFDEC_AS_STR_ASconstructor, - 0, swfdec_player_ASconstructor, 2); - - // remove __proto__ and constructor from ASnative and ASconstructor - - swfdec_as_object_get_variable (context->global, SWFDEC_AS_STR_ASnative, &val); - g_assert (SWFDEC_AS_VALUE_IS_OBJECT (&val)); - object = SWFDEC_AS_VALUE_GET_OBJECT (&val); - swfdec_as_object_unset_variable_flags (object, SWFDEC_AS_STR___proto__, - SWFDEC_AS_VARIABLE_PERMANENT); - swfdec_as_object_delete_variable (object, SWFDEC_AS_STR___proto__); - swfdec_as_object_unset_variable_flags (object, SWFDEC_AS_STR_constructor, - SWFDEC_AS_VARIABLE_PERMANENT); - swfdec_as_object_delete_variable (object, SWFDEC_AS_STR_constructor); - - swfdec_as_object_get_variable (context->global, SWFDEC_AS_STR_ASconstructor, - &val); - g_assert (SWFDEC_AS_VALUE_IS_OBJECT (&val)); - object = SWFDEC_AS_VALUE_GET_OBJECT (&val); - swfdec_as_object_unset_variable_flags (object, SWFDEC_AS_STR___proto__, - SWFDEC_AS_VARIABLE_PERMANENT); - swfdec_as_object_delete_variable (object, SWFDEC_AS_STR___proto__); - swfdec_as_object_unset_variable_flags (object, SWFDEC_AS_STR_constructor, - SWFDEC_AS_VARIABLE_PERMANENT); - swfdec_as_object_delete_variable (object, SWFDEC_AS_STR_constructor); } diff-tree 613fd1b7aee8c0b58dd4a9061caa8cd2bb899ce2 (from 7a06bd440379a8307047894e2b476ca6e354556e) Author: Pekka Lampila <pekka.lampila at iki.fi> Date: Sat Sep 1 00:35:09 2007 +0300 Number valueOf had wrong ASnative number diff --git a/libswfdec/swfdec_as_number.c b/libswfdec/swfdec_as_number.c index 9328b26..8a44733 100644 --- a/libswfdec/swfdec_as_number.c +++ b/libswfdec/swfdec_as_number.c @@ -84,7 +84,7 @@ swfdec_as_number_toString (SwfdecAsConte SWFDEC_AS_VALUE_SET_STRING (ret, s); } -SWFDEC_AS_NATIVE (106, 1, swfdec_as_number_valueOf) +SWFDEC_AS_NATIVE (106, 0, swfdec_as_number_valueOf) void swfdec_as_number_valueOf (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
Reasonably Related Threads
- 4 commits - libswfdec/swfdec_as_number.c libswfdec/swfdec_as_strings.c libswfdec/swfdec_player_as.c test/trace
- 5 commits - libswfdec/swfdec_as_array.c libswfdec/swfdec_as_boolean.c libswfdec/swfdec_as_function.c libswfdec/swfdec_as_math.c libswfdec/swfdec_as_number.c libswfdec/swfdec_as_script_function.c libswfdec/swfdec_initialize.as libswfdec/swfdec_initialize.h
- Branch 'as' - 3 commits - libswfdec/swfdec_as_array.c libswfdec/swfdec_as_context.c libswfdec/swfdec_as_math.c libswfdec/swfdec_as_native_function.c libswfdec/swfdec_as_number.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_string.c
- 4 commits - libswfdec/swfdec_as_array.c libswfdec/swfdec_as_boolean.c libswfdec/swfdec_as_function.c libswfdec/swfdec_as_number.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_string.c libswfdec/swfdec_color_as.c test/trace
- Branch 'vivi' - 60 commits - libswfdec-gtk/swfdec_gtk_loader.c libswfdec/Makefile.am libswfdec/swfdec_as_array.c libswfdec/swfdec_as_context.c libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame_internal.h libswfdec/swfdec_as_interpret.c