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

Benjamin Otte company at kemper.freedesktop.org
Mon Aug 20 09:01:34 PDT 2007


 libswfdec/swfdec_as_object.c             |    2 --
 test/trace/Makefile.am                   |    9 +++++++++
 test/trace/addProperty-flags-5.swf       |binary
 test/trace/addProperty-flags-5.swf.trace |    6 ++++++
 test/trace/addProperty-flags-6.swf       |binary
 test/trace/addProperty-flags-6.swf.trace |    8 ++++++++
 test/trace/addProperty-flags-7.swf       |binary
 test/trace/addProperty-flags-7.swf.trace |    8 ++++++++
 test/trace/addProperty-flags-8.swf       |binary
 test/trace/addProperty-flags-8.swf.trace |    8 ++++++++
 test/trace/addProperty-flags.as          |   23 +++++++++++++++++++++++
 11 files changed, 62 insertions(+), 2 deletions(-)

New commits:
diff-tree da9fc3e76d3757cb3a8a4459802c753adbbbcbe7 (from 589ed7ba10280a39d4ce2ce5c15863120511b600)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Aug 20 17:59:23 2007 +0200

    add test checking if flags change for addProperty calls

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index 91f6c63..ba9619c 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -46,6 +46,15 @@ EXTRA_DIST = \
 	addProperty-delete-7.swf.trace \
 	addProperty-delete-8.swf \
 	addProperty-delete-8.swf.trace \
+	addProperty-flags.as \
+	addProperty-flags-5.swf \
+	addProperty-flags-5.swf.trace \
+	addProperty-flags-6.swf \
+	addProperty-flags-6.swf.trace \
+	addProperty-flags-7.swf \
+	addProperty-flags-7.swf.trace \
+	addProperty-flags-8.swf \
+	addProperty-flags-8.swf.trace \
 	addProperty-get-prototypes.as \
 	addProperty-get-prototypes-5.swf \
 	addProperty-get-prototypes-5.swf.trace \
diff --git a/test/trace/addProperty-flags-5.swf b/test/trace/addProperty-flags-5.swf
new file mode 100644
index 0000000..c22255d
Binary files /dev/null and b/test/trace/addProperty-flags-5.swf differ
diff --git a/test/trace/addProperty-flags-5.swf.trace b/test/trace/addProperty-flags-5.swf.trace
new file mode 100644
index 0000000..4fc2ce3
--- /dev/null
+++ b/test/trace/addProperty-flags-5.swf.trace
@@ -0,0 +1,6 @@
+Check if flags of variables get reset upon addProperty
+set:
+mark constant:
+overwrite:
+10
+10
diff --git a/test/trace/addProperty-flags-6.swf b/test/trace/addProperty-flags-6.swf
new file mode 100644
index 0000000..74b9adf
Binary files /dev/null and b/test/trace/addProperty-flags-6.swf differ
diff --git a/test/trace/addProperty-flags-6.swf.trace b/test/trace/addProperty-flags-6.swf.trace
new file mode 100644
index 0000000..ea545bd
--- /dev/null
+++ b/test/trace/addProperty-flags-6.swf.trace
@@ -0,0 +1,8 @@
+Check if flags of variables get reset upon addProperty
+set:
+set called
+mark constant:
+overwrite:
+10
+get
+42
diff --git a/test/trace/addProperty-flags-7.swf b/test/trace/addProperty-flags-7.swf
new file mode 100644
index 0000000..237a007
Binary files /dev/null and b/test/trace/addProperty-flags-7.swf differ
diff --git a/test/trace/addProperty-flags-7.swf.trace b/test/trace/addProperty-flags-7.swf.trace
new file mode 100644
index 0000000..ea545bd
--- /dev/null
+++ b/test/trace/addProperty-flags-7.swf.trace
@@ -0,0 +1,8 @@
+Check if flags of variables get reset upon addProperty
+set:
+set called
+mark constant:
+overwrite:
+10
+get
+42
diff --git a/test/trace/addProperty-flags-8.swf b/test/trace/addProperty-flags-8.swf
new file mode 100644
index 0000000..469db26
Binary files /dev/null and b/test/trace/addProperty-flags-8.swf differ
diff --git a/test/trace/addProperty-flags-8.swf.trace b/test/trace/addProperty-flags-8.swf.trace
new file mode 100644
index 0000000..ea545bd
--- /dev/null
+++ b/test/trace/addProperty-flags-8.swf.trace
@@ -0,0 +1,8 @@
+Check if flags of variables get reset upon addProperty
+set:
+set called
+mark constant:
+overwrite:
+10
+get
+42
diff --git a/test/trace/addProperty-flags.as b/test/trace/addProperty-flags.as
new file mode 100644
index 0000000..47049bb
--- /dev/null
+++ b/test/trace/addProperty-flags.as
@@ -0,0 +1,23 @@
+// makeswf -v 7 -s 200x150 -r 1 -o addProperty-flags.swf addProperty-flags.as
+
+trace ("Check if flags of variables get reset upon addProperty");
+
+o = {};
+o.addProperty ("foo", function () { trace ("get"); return 42; }, function () { trace ("set called"); });
+trace ("set:");
+o.foo = 20;
+trace ("mark constant:");
+ASSetPropFlags (o, "foo", 4);
+o.foo = 20;
+trace ("overwrite:");
+o.addProperty ("foo", function () { trace ("get"); return 42; }, function () { trace ("set called"); });
+o.foo = 20;
+
+o.bar = 10;
+ASSetPropFlags (o, "bar", 4);
+trace (o.bar);
+o.addProperty ("bar", function () { trace ("get"); return 42; }, function () { trace ("set called"); });
+
+trace (o.bar);
+
+loadMovie ("FSCommand:quit", "");
diff-tree 589ed7ba10280a39d4ce2ce5c15863120511b600 (from fd36de2f156ce685d5095aaf323e0766ea017bd7)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Aug 20 17:48:20 2007 +0200

    don't mark addProperty()'d variables as constant when they have no set function

diff --git a/libswfdec/swfdec_as_object.c b/libswfdec/swfdec_as_object.c
index 213ddb3..83ad4cf 100644
--- a/libswfdec/swfdec_as_object.c
+++ b/libswfdec/swfdec_as_object.c
@@ -1022,8 +1022,6 @@ swfdec_as_object_add_variable (SwfdecAsO
     return;
   var->get = get;
   var->set = set;
-  if (set == NULL)
-    var->flags |= SWFDEC_AS_VARIABLE_CONSTANT;
 }
 
 /*** AS CODE ***/


More information about the Swfdec mailing list