[Swfdec] 4 commits - libswfdec/swfdec_as_object.c libswfdec/swfdec_movie.c test/trace

Benjamin Otte company at kemper.freedesktop.org
Wed Aug 15 10:05:19 PDT 2007


 libswfdec/swfdec_as_object.c           |    4 +++-
 libswfdec/swfdec_movie.c               |    6 +++---
 test/trace/Makefile.am                 |   18 ++++++++++++++++++
 test/trace/property-native-5.swf       |binary
 test/trace/property-native-5.swf.trace |    4 ++++
 test/trace/property-native-6.swf       |binary
 test/trace/property-native-6.swf.trace |    4 ++++
 test/trace/property-native-7.swf       |binary
 test/trace/property-native-7.swf.trace |    4 ++++
 test/trace/property-native-8.swf       |binary
 test/trace/property-native-8.swf.trace |    4 ++++
 test/trace/property-native.as          |   11 +++++++++++
 test/trace/prototype-movie-5.swf       |binary
 test/trace/prototype-movie-5.swf.trace |    4 ++++
 test/trace/prototype-movie-6.swf       |binary
 test/trace/prototype-movie-6.swf.trace |    4 ++++
 test/trace/prototype-movie-7.swf       |binary
 test/trace/prototype-movie-7.swf.trace |    4 ++++
 test/trace/prototype-movie-8.swf       |binary
 test/trace/prototype-movie-8.swf.trace |    4 ++++
 test/trace/prototype-movie.as          |   12 ++++++++++++
 21 files changed, 79 insertions(+), 4 deletions(-)

New commits:
diff-tree 01dc987b2068a641f131abed7da476b2f7fd852a (from 130724227041a0e3916529bd498b207986880838)
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Aug 15 19:01:48 2007 +0200

    add test for last commit

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index e3168fe..7e72228 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -740,6 +740,15 @@ EXTRA_DIST = \
 	place-object-remove-name-7.swf.trace \
 	preload.swf \
 	preload.swf.trace \
+	property-native.as \
+	property-native-5.swf \
+	property-native-5.swf.trace \
+	property-native-6.swf \
+	property-native-6.swf.trace \
+	property-native-7.swf \
+	property-native-7.swf.trace \
+	property-native-8.swf \
+	property-native-8.swf.trace \
 	prototype-movie.as \
 	prototype-movie-5.swf \
 	prototype-movie-5.swf.trace \
diff --git a/test/trace/property-native-5.swf b/test/trace/property-native-5.swf
new file mode 100644
index 0000000..e70f266
Binary files /dev/null and b/test/trace/property-native-5.swf differ
diff --git a/test/trace/property-native-5.swf.trace b/test/trace/property-native-5.swf.trace
new file mode 100644
index 0000000..c64601c
--- /dev/null
+++ b/test/trace/property-native-5.swf.trace
@@ -0,0 +1,4 @@
+Check how addProperty overwrites native properties
+0
+0
+10
diff --git a/test/trace/property-native-6.swf b/test/trace/property-native-6.swf
new file mode 100644
index 0000000..a875d5e
Binary files /dev/null and b/test/trace/property-native-6.swf differ
diff --git a/test/trace/property-native-6.swf.trace b/test/trace/property-native-6.swf.trace
new file mode 100644
index 0000000..bcc092c
--- /dev/null
+++ b/test/trace/property-native-6.swf.trace
@@ -0,0 +1,4 @@
+Check how addProperty overwrites native properties
+0
+42
+42
diff --git a/test/trace/property-native-7.swf b/test/trace/property-native-7.swf
new file mode 100644
index 0000000..5e0b535
Binary files /dev/null and b/test/trace/property-native-7.swf differ
diff --git a/test/trace/property-native-7.swf.trace b/test/trace/property-native-7.swf.trace
new file mode 100644
index 0000000..bcc092c
--- /dev/null
+++ b/test/trace/property-native-7.swf.trace
@@ -0,0 +1,4 @@
+Check how addProperty overwrites native properties
+0
+42
+42
diff --git a/test/trace/property-native-8.swf b/test/trace/property-native-8.swf
new file mode 100644
index 0000000..d081fd9
Binary files /dev/null and b/test/trace/property-native-8.swf differ
diff --git a/test/trace/property-native-8.swf.trace b/test/trace/property-native-8.swf.trace
new file mode 100644
index 0000000..bcc092c
--- /dev/null
+++ b/test/trace/property-native-8.swf.trace
@@ -0,0 +1,4 @@
+Check how addProperty overwrites native properties
+0
+42
+42
diff --git a/test/trace/property-native.as b/test/trace/property-native.as
new file mode 100644
index 0000000..a987b1b
--- /dev/null
+++ b/test/trace/property-native.as
@@ -0,0 +1,11 @@
+// makeswf -v 7 -s 200x150 -r 1 -o property-native.swf property-native.as
+
+trace ("Check how addProperty overwrites native properties");
+this.__proto__._x = 42;
+trace (this._x);
+this.addProperty ("_x", function () { return 42; }, function () { trace ("set"); });
+trace (this._x);
+this._x = 10;
+trace (this._x);
+
+loadMovie ("FSCommand:quit", "");
diff-tree 130724227041a0e3916529bd498b207986880838 (from d930fe50031d06c34edff598697220405ce7e88b)
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Aug 15 18:55:52 2007 +0200

    query own properties before doing special ones

diff --git a/libswfdec/swfdec_movie.c b/libswfdec/swfdec_movie.c
index 42444b7..776e2b1 100644
--- a/libswfdec/swfdec_movie.c
+++ b/libswfdec/swfdec_movie.c
@@ -849,14 +849,14 @@ swfdec_movie_get_variable (SwfdecAsObjec
   if (movie->state == SWFDEC_MOVIE_STATE_DESTROYED)
     return FALSE;
 
+  if (SWFDEC_AS_OBJECT_CLASS (swfdec_movie_parent_class)->get (object, variable, val, flags))
+    return TRUE;
+
   if (swfdec_movie_get_asprop (movie, variable, val)) {
     *flags = 0;
     return TRUE;
   }
 
-  if (SWFDEC_AS_OBJECT_CLASS (swfdec_movie_parent_class)->get (object, variable, val, flags))
-    return TRUE;
-
   /* FIXME: check that this is correct */
   if (object->context->version > 5 && variable == SWFDEC_AS_STR__global) {
     SWFDEC_AS_VALUE_SET_OBJECT (val, object->context->global);
diff-tree d930fe50031d06c34edff598697220405ce7e88b (from 261b8c34898a7a4cd6b89a11acc08bfb0a5c35d2)
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Aug 15 16:03:40 2007 +0200

    add check that sets movie as prototype

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index 3481072..e3168fe 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -740,6 +740,15 @@ EXTRA_DIST = \
 	place-object-remove-name-7.swf.trace \
 	preload.swf \
 	preload.swf.trace \
+	prototype-movie.as \
+	prototype-movie-5.swf \
+	prototype-movie-5.swf.trace \
+	prototype-movie-6.swf \
+	prototype-movie-6.swf.trace \
+	prototype-movie-7.swf \
+	prototype-movie-7.swf.trace \
+	prototype-movie-8.swf \
+	prototype-movie-8.swf.trace \
 	prototypes.swf \
 	prototypes.swf.trace \
 	register-count.swf \
diff --git a/test/trace/prototype-movie-5.swf b/test/trace/prototype-movie-5.swf
new file mode 100644
index 0000000..d6e8053
Binary files /dev/null and b/test/trace/prototype-movie-5.swf differ
diff --git a/test/trace/prototype-movie-5.swf.trace b/test/trace/prototype-movie-5.swf.trace
new file mode 100644
index 0000000..84187bf
--- /dev/null
+++ b/test/trace/prototype-movie-5.swf.trace
@@ -0,0 +1,4 @@
+Check that movies cannot be prototypes
+undefined
+undefined
+undefined
diff --git a/test/trace/prototype-movie-6.swf b/test/trace/prototype-movie-6.swf
new file mode 100644
index 0000000..41a4005
Binary files /dev/null and b/test/trace/prototype-movie-6.swf differ
diff --git a/test/trace/prototype-movie-6.swf.trace b/test/trace/prototype-movie-6.swf.trace
new file mode 100644
index 0000000..d8b7ab2
--- /dev/null
+++ b/test/trace/prototype-movie-6.swf.trace
@@ -0,0 +1,4 @@
+Check that movies cannot be prototypes
+[type Function]
+undefined
+undefined
diff --git a/test/trace/prototype-movie-7.swf b/test/trace/prototype-movie-7.swf
new file mode 100644
index 0000000..434a42a
Binary files /dev/null and b/test/trace/prototype-movie-7.swf differ
diff --git a/test/trace/prototype-movie-7.swf.trace b/test/trace/prototype-movie-7.swf.trace
new file mode 100644
index 0000000..d8b7ab2
--- /dev/null
+++ b/test/trace/prototype-movie-7.swf.trace
@@ -0,0 +1,4 @@
+Check that movies cannot be prototypes
+[type Function]
+undefined
+undefined
diff --git a/test/trace/prototype-movie-8.swf b/test/trace/prototype-movie-8.swf
new file mode 100644
index 0000000..18f4e1b
Binary files /dev/null and b/test/trace/prototype-movie-8.swf differ
diff --git a/test/trace/prototype-movie-8.swf.trace b/test/trace/prototype-movie-8.swf.trace
new file mode 100644
index 0000000..d8b7ab2
--- /dev/null
+++ b/test/trace/prototype-movie-8.swf.trace
@@ -0,0 +1,4 @@
+Check that movies cannot be prototypes
+[type Function]
+undefined
+undefined
diff --git a/test/trace/prototype-movie.as b/test/trace/prototype-movie.as
new file mode 100644
index 0000000..92074b9
--- /dev/null
+++ b/test/trace/prototype-movie.as
@@ -0,0 +1,12 @@
+// makeswf -v 7 -s 200x150 -r 1 -o prototype-movie.swf movie6.as
+
+trace ("Check that movies cannot be prototypes");
+
+o = new Object ();
+this.foo = 42;
+trace (o.addProperty);
+o.__proto__ = this;
+trace (o.foo);
+trace (o.addProperty);
+
+loadMovie ("FSCommand:quit", "");
diff-tree 261b8c34898a7a4cd6b89a11acc08bfb0a5c35d2 (from 37ed222d6ea5305df2c238122be4e31a98af3229)
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Aug 15 16:02:30 2007 +0200

    movies cannot be prototypes

diff --git a/libswfdec/swfdec_as_object.c b/libswfdec/swfdec_as_object.c
index f7b0e98..64b8ff0 100644
--- a/libswfdec/swfdec_as_object.c
+++ b/libswfdec/swfdec_as_object.c
@@ -31,6 +31,7 @@
 #include "swfdec_as_stack.h"
 #include "swfdec_as_strings.h"
 #include "swfdec_debug.h"
+#include "swfdec_movie.h"
 
 /**
  * SECTION:SwfdecAsObject
@@ -205,7 +206,8 @@ swfdec_as_object_do_set (SwfdecAsObject 
     return;
 
   if (variable == SWFDEC_AS_STR___proto__) {
-    if (SWFDEC_AS_VALUE_IS_OBJECT (val)) {
+    if (SWFDEC_AS_VALUE_IS_OBJECT (val) &&
+	!SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_OBJECT (val))) {
       object->prototype = SWFDEC_AS_VALUE_GET_OBJECT (val);
     } else {
       object->prototype = NULL;


More information about the Swfdec mailing list