[Swfdec] 2 commits - libswfdec/swfdec_as_object.c test/trace
Benjamin Otte
company at kemper.freedesktop.org
Mon Sep 10 13:08:12 PDT 2007
libswfdec/swfdec_as_object.c | 2 ++
test/trace/Makefile.am | 9 +++++++++
test/trace/object-watch-segv-5.swf |binary
test/trace/object-watch-segv-5.swf.trace | 7 +++++++
test/trace/object-watch-segv-6.swf |binary
test/trace/object-watch-segv-6.swf.trace | 9 +++++++++
test/trace/object-watch-segv-7.swf |binary
test/trace/object-watch-segv-7.swf.trace | 9 +++++++++
test/trace/object-watch-segv-8.swf |binary
test/trace/object-watch-segv-8.swf.trace | 9 +++++++++
test/trace/object-watch-segv.as | 25 +++++++++++++++++++++++++
11 files changed, 70 insertions(+)
New commits:
diff-tree 93f0e1b0eaeb04357370f7daf9ea8dbbe3786d3e (from dc9b8d5aa159cf8b2e0c835a3038063a62a8393c)
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Sep 10 22:07:56 2007 +0200
add a random Object.watch() test
diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index 95e7c9c..5f360cc 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -770,6 +770,15 @@ EXTRA_DIST = \
object-watch-6.swf.trace \
object-watch-7.swf \
object-watch-7.swf.trace \
+ object-watch-segv.as \
+ object-watch-segv-5.swf \
+ object-watch-segv-5.swf.trace \
+ object-watch-segv-6.swf \
+ object-watch-segv-6.swf.trace \
+ object-watch-segv-7.swf \
+ object-watch-segv-7.swf.trace \
+ object-watch-segv-8.swf \
+ object-watch-segv-8.swf.trace \
onload-childparent.c \
onload-childparent.swf \
onload-childparent.swf.trace \
diff --git a/test/trace/object-watch-segv-5.swf b/test/trace/object-watch-segv-5.swf
new file mode 100644
index 0000000..4dc8336
Binary files /dev/null and b/test/trace/object-watch-segv-5.swf differ
diff --git a/test/trace/object-watch-segv-5.swf.trace b/test/trace/object-watch-segv-5.swf.trace
new file mode 100644
index 0000000..1e63931
--- /dev/null
+++ b/test/trace/object-watch-segv-5.swf.trace
@@ -0,0 +1,7 @@
+undefined
+undefined
+42
+10
+undefined
+undefined
+100
diff --git a/test/trace/object-watch-segv-6.swf b/test/trace/object-watch-segv-6.swf
new file mode 100644
index 0000000..85f3ca8
Binary files /dev/null and b/test/trace/object-watch-segv-6.swf differ
diff --git a/test/trace/object-watch-segv-6.swf.trace b/test/trace/object-watch-segv-6.swf.trace
new file mode 100644
index 0000000..6a9ebe3
--- /dev/null
+++ b/test/trace/object-watch-segv-6.swf.trace
@@ -0,0 +1,9 @@
+true
+true
+run 2
+43
+run 2
+11
+true
+true
+5
diff --git a/test/trace/object-watch-segv-7.swf b/test/trace/object-watch-segv-7.swf
new file mode 100644
index 0000000..6765d70
Binary files /dev/null and b/test/trace/object-watch-segv-7.swf differ
diff --git a/test/trace/object-watch-segv-7.swf.trace b/test/trace/object-watch-segv-7.swf.trace
new file mode 100644
index 0000000..6a9ebe3
--- /dev/null
+++ b/test/trace/object-watch-segv-7.swf.trace
@@ -0,0 +1,9 @@
+true
+true
+run 2
+43
+run 2
+11
+true
+true
+5
diff --git a/test/trace/object-watch-segv-8.swf b/test/trace/object-watch-segv-8.swf
new file mode 100644
index 0000000..c6d0bda
Binary files /dev/null and b/test/trace/object-watch-segv-8.swf differ
diff --git a/test/trace/object-watch-segv-8.swf.trace b/test/trace/object-watch-segv-8.swf.trace
new file mode 100644
index 0000000..6a9ebe3
--- /dev/null
+++ b/test/trace/object-watch-segv-8.swf.trace
@@ -0,0 +1,9 @@
+true
+true
+run 2
+43
+run 2
+11
+true
+true
+5
diff --git a/test/trace/object-watch-segv.as b/test/trace/object-watch-segv.as
new file mode 100644
index 0000000..db06b4a
--- /dev/null
+++ b/test/trace/object-watch-segv.as
@@ -0,0 +1,25 @@
+// makeswf -v 7 -s 200x150 -r 1 -o object-watch-segv.swf object-watch-segv.as
+
+function foo (name, old, new, data) {
+ delete this[x];
+ trace ("run " + data);
+ return new + 1;
+};
+function evil () {
+ this.unwatch ("x");
+ return 5;
+};
+
+trace (this.watch ("x", foo, 1));
+trace (this.watch ("x", foo, 2));
+this.x = 42;
+trace (x);
+delete this[x];
+this.x = 10;
+trace (x);
+trace (this.hasOwnProperty ("x"));
+trace (this.watch ("x", evil));
+this.x = 100;
+trace (this.x);
+
+loadMovie ("FSCommand:quit", "");
diff-tree dc9b8d5aa159cf8b2e0c835a3038063a62a8393c (from 890b14c29384f9610b68eaf44e4fedfcc6580618)
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Sep 10 22:06:50 2007 +0200
actually change the watch function when it is reset
diff --git a/libswfdec/swfdec_as_object.c b/libswfdec/swfdec_as_object.c
index a331030..5719eaf 100644
--- a/libswfdec/swfdec_as_object.c
+++ b/libswfdec/swfdec_as_object.c
@@ -1322,6 +1322,8 @@ swfdec_as_object_watch (SwfdecAsContext
if (watch == NULL)
return;
g_hash_table_insert (object->watches, (char *) name, watch);
+ } else {
+ watch->watch = SWFDEC_AS_FUNCTION (SWFDEC_AS_VALUE_GET_OBJECT (&argv[1]));
}
if (argc >= 3) {
More information about the Swfdec
mailing list