[Swfdec] 20 commits - libswfdec/Makefile.am libswfdec/swfdec_as_context.c libswfdec/swfdec_as_function.c libswfdec/swfdec_as_initialize.as libswfdec/swfdec_as_initialize.h libswfdec/swfdec_as_internal.h libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_number.c libswfdec/swfdec_as_number.h libswfdec/swfdec_as_object.c libswfdec/swfdec_net_stream.c test/trace

Benjamin Otte company at kemper.freedesktop.org
Mon Sep 3 06:56:24 PDT 2007


 libswfdec/Makefile.am                                  |    2 
 libswfdec/swfdec_as_context.c                          |   27 
 libswfdec/swfdec_as_function.c                         |   18 
 libswfdec/swfdec_as_initialize.as                      |   35 +
 libswfdec/swfdec_as_initialize.h                       |   33 +
 libswfdec/swfdec_as_internal.h                         |    5 
 libswfdec/swfdec_as_interpret.c                        |    6 
 libswfdec/swfdec_as_number.c                           |   62 --
 libswfdec/swfdec_as_number.h                           |    3 
 libswfdec/swfdec_as_object.c                           |   41 -
 libswfdec/swfdec_net_stream.c                          |    3 
 test/trace/Makefile.am                                 |   46 +
 test/trace/constructor-madness-5.swf                   |binary
 test/trace/constructor-madness-5.swf.trace             |    5 
 test/trace/constructor-madness-6.swf                   |binary
 test/trace/constructor-madness-6.swf.trace             |    5 
 test/trace/constructor-madness-7.swf                   |binary
 test/trace/constructor-madness-7.swf.trace             |    5 
 test/trace/constructor-madness-8.swf                   |binary
 test/trace/constructor-madness-8.swf.trace             |    5 
 test/trace/constructor-madness.as                      |   10 
 test/trace/crash-0.5.2-new-netstream.as                |    5 
 test/trace/crash-0.5.2-new-netstream.swf               |binary
 test/trace/number-properties-6.swf                     |binary
 test/trace/number-properties-6.swf.trace               |   22 
 test/trace/number-properties-7.swf                     |binary
 test/trace/number-properties-7.swf.trace               |   21 
 test/trace/number-properties-8.swf                     |binary
 test/trace/number-properties-8.swf.trace               |   21 
 test/trace/number-properties.as                        |   12 
 test/trace/prototype-addProperty-5.swf                 |binary
 test/trace/prototype-addProperty-5.swf.trace           |    4 
 test/trace/prototype-addProperty-6.swf                 |binary
 test/trace/prototype-addProperty-6.swf.trace           |    5 
 test/trace/prototype-addProperty-7.swf                 |binary
 test/trace/prototype-addProperty-7.swf.trace           |    5 
 test/trace/prototype-addProperty-8.swf                 |binary
 test/trace/prototype-addProperty-8.swf.trace           |    5 
 test/trace/prototype-addProperty.as                    |   19 
 test/trace/prototype-recursion-addProperty-5.swf       |binary
 test/trace/prototype-recursion-addProperty-5.swf.trace |  254 ++++++++
 test/trace/prototype-recursion-addProperty-6.swf       |binary
 test/trace/prototype-recursion-addProperty-6.swf.trace |  256 ++++++++
 test/trace/prototype-recursion-addProperty-7.swf       |binary
 test/trace/prototype-recursion-addProperty-7.swf.trace |  256 ++++++++
 test/trace/prototype-recursion-addProperty-8.swf       |binary
 test/trace/prototype-recursion-addProperty-8.swf.trace |  256 ++++++++
 test/trace/prototype-recursion-addProperty.as          |   14 
 test/trace/prototype-recursion-get-5.swf               |binary
 test/trace/prototype-recursion-get-5.swf.trace         |  514 +++++++++++++++++
 test/trace/prototype-recursion-get-6.swf               |binary
 test/trace/prototype-recursion-get-6.swf.trace         |  514 +++++++++++++++++
 test/trace/prototype-recursion-get-7.swf               |binary
 test/trace/prototype-recursion-get-7.swf.trace         |  514 +++++++++++++++++
 test/trace/prototype-recursion-get-8.swf               |binary
 test/trace/prototype-recursion-get-8.swf.trace         |  514 +++++++++++++++++
 test/trace/prototype-recursion-get.as                  |   14 
 test/trace/system-capabilities-query-5.swf             |binary
 test/trace/trace_properties.as                         |    1 
 59 files changed, 3452 insertions(+), 85 deletions(-)

New commits:
diff-tree 635b7b3bfceaa763cd502b478f122b39c27bd040 (from parents)
Merge: 7c65f202f89174b0a898d48b3b2470fa3174adf4 362b6d991a6595468790b564501fb4f3b94d3a41
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 3 15:50:36 2007 +0200

    Merge branch 'master' of ssh://company@git.freedesktop.org/git/swfdec/swfdec

diff-tree 7c65f202f89174b0a898d48b3b2470fa3174adf4 (from 10ffab0e4c0bdd7c9d182b86da5492339ebc8938)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 3 15:48:22 2007 +0200

    don't set __constructor__ in Flash <= 5

diff --git a/libswfdec/swfdec_as_object.c b/libswfdec/swfdec_as_object.c
index 579d315..4472615 100644
--- a/libswfdec/swfdec_as_object.c
+++ b/libswfdec/swfdec_as_object.c
@@ -1011,10 +1011,10 @@ swfdec_as_object_create (SwfdecAsFunctio
       swfdec_as_object_set_variable_and_flags (new, SWFDEC_AS_STR_constructor, 
 	  &val, SWFDEC_AS_VARIABLE_HIDDEN);
     }
-    if (context->version <= 5)
-      SWFDEC_AS_VALUE_SET_UNDEFINED (&val);
-    swfdec_as_object_set_variable_and_flags (new, SWFDEC_AS_STR___constructor__, 
-	&val, SWFDEC_AS_VARIABLE_HIDDEN);
+    if (context->version > 5) {
+      swfdec_as_object_set_variable_and_flags (new, SWFDEC_AS_STR___constructor__, 
+	  &val, SWFDEC_AS_VARIABLE_HIDDEN);
+    }
   } else {
     /* need to do this, since we must push something to the frame stack */
     new = NULL;
diff-tree 10ffab0e4c0bdd7c9d182b86da5492339ebc8938 (from c76e6c5be127ac99fbb0ed8b2fda203d2de26089)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 3 15:47:54 2007 +0200

    add test for Number proeprties
    
    ensures the swfdec_as_initialize.as script works.
    A test for version 5 will follow after the XML stuff lands.

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index b2c362e..70c60e3 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -665,6 +665,13 @@ EXTRA_DIST = \
 	netstream-onstatus-notfound.swf.trace \
 	number.swf \
 	number.swf.trace \
+	number-properties.as \
+	number-properties-6.swf \
+	number-properties-6.swf.trace \
+	number-properties-7.swf \
+	number-properties-7.swf.trace \
+	number-properties-8.swf \
+	number-properties-8.swf.trace \
 	object-math-5.swf \
 	object-math-5.swf.trace \
 	object-math-6.swf \
diff --git a/test/trace/number-properties-6.swf b/test/trace/number-properties-6.swf
new file mode 100644
index 0000000..5248908
Binary files /dev/null and b/test/trace/number-properties-6.swf differ
diff --git a/test/trace/number-properties-6.swf.trace b/test/trace/number-properties-6.swf.trace
new file mode 100644
index 0000000..3688d93
--- /dev/null
+++ b/test/trace/number-properties-6.swf.trace
@@ -0,0 +1,22 @@
+_global.Number = function
+  MAX_VALUE (hpc) = number : 1.79769313486231e+308
+  MIN_VALUE (hpc) = number : 0
+  NEGATIVE_INFINITY (hpc) = number : -Infinity
+  NaN (hpc) = number : NaN
+  POSITIVE_INFINITY (hpc) = number : Infinity
+  __proto__ (hpc) = _global.Object.__proto__
+  constructor (hpc) = _global.Object.constructor
+  prototype (hpc) = object
+    __proto__ (hp) = _global.Object.prototype
+    constructor (hp) = _global.Number
+    toString (hp) = function
+      __proto__ (hp) = _global.Object.__proto__
+      constructor (hp) = _global.Object.constructor
+    valueOf (hp) = function
+      __proto__ (hp) = _global.Object.__proto__
+      constructor (hp) = _global.Object.constructor
+local.a = _global.Number.prototype
+  __constructor__ (h) = _global.Number
+  __proto__ (hp) = _global.Number.prototype
+  constructor (h) = _global.Number
+local.b = number : 42
diff --git a/test/trace/number-properties-7.swf b/test/trace/number-properties-7.swf
new file mode 100644
index 0000000..a90efb4
Binary files /dev/null and b/test/trace/number-properties-7.swf differ
diff --git a/test/trace/number-properties-7.swf.trace b/test/trace/number-properties-7.swf.trace
new file mode 100644
index 0000000..4f7025e
--- /dev/null
+++ b/test/trace/number-properties-7.swf.trace
@@ -0,0 +1,21 @@
+_global.Number = function
+  MAX_VALUE (hpc) = number : 1.79769313486231e+308
+  MIN_VALUE (hpc) = number : 0
+  NEGATIVE_INFINITY (hpc) = number : -Infinity
+  NaN (hpc) = number : NaN
+  POSITIVE_INFINITY (hpc) = number : Infinity
+  __proto__ (hpc) = _global.Object.__proto__
+  constructor (hpc) = _global.Object.constructor
+  prototype (hpc) = object
+    __proto__ (hp) = _global.Object.prototype
+    constructor (hp) = _global.Number
+    toString (hp) = function
+      __proto__ (hp) = _global.Object.__proto__
+      constructor (hp) = _global.Object.constructor
+    valueOf (hp) = function
+      __proto__ (hp) = _global.Object.__proto__
+      constructor (hp) = _global.Object.constructor
+local.a = _global.Number.prototype
+  __constructor__ (h) = _global.Number
+  __proto__ (hp) = _global.Number.prototype
+local.b = number : 42
diff --git a/test/trace/number-properties-8.swf b/test/trace/number-properties-8.swf
new file mode 100644
index 0000000..dc78fb2
Binary files /dev/null and b/test/trace/number-properties-8.swf differ
diff --git a/test/trace/number-properties-8.swf.trace b/test/trace/number-properties-8.swf.trace
new file mode 100644
index 0000000..4f7025e
--- /dev/null
+++ b/test/trace/number-properties-8.swf.trace
@@ -0,0 +1,21 @@
+_global.Number = function
+  MAX_VALUE (hpc) = number : 1.79769313486231e+308
+  MIN_VALUE (hpc) = number : 0
+  NEGATIVE_INFINITY (hpc) = number : -Infinity
+  NaN (hpc) = number : NaN
+  POSITIVE_INFINITY (hpc) = number : Infinity
+  __proto__ (hpc) = _global.Object.__proto__
+  constructor (hpc) = _global.Object.constructor
+  prototype (hpc) = object
+    __proto__ (hp) = _global.Object.prototype
+    constructor (hp) = _global.Number
+    toString (hp) = function
+      __proto__ (hp) = _global.Object.__proto__
+      constructor (hp) = _global.Object.constructor
+    valueOf (hp) = function
+      __proto__ (hp) = _global.Object.__proto__
+      constructor (hp) = _global.Object.constructor
+local.a = _global.Number.prototype
+  __constructor__ (h) = _global.Number
+  __proto__ (hp) = _global.Number.prototype
+local.b = number : 42
diff --git a/test/trace/number-properties.as b/test/trace/number-properties.as
new file mode 100644
index 0000000..b65446e
--- /dev/null
+++ b/test/trace/number-properties.as
@@ -0,0 +1,12 @@
+// makeswf -v 7 -s 200x150 -r 1 -o number-properties-7.swf number-properties.as
+
+#include "trace_properties.as"
+
+var a = new Number(10);
+var b = 42;
+
+trace_properties (_global.Number, "_global", "Number");
+trace_properties (a, "local", "a");
+trace_properties (b, "local", "b");
+
+loadMovie ("FSCommand:quit", "");
diff-tree c76e6c5be127ac99fbb0ed8b2fda203d2de26089 (from 9dec9c1f6fbe7699e89a0c56272ad87c7fef690b)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 3 15:41:11 2007 +0200

    set an undefined __proto__ if function_prototype doesn't exist
    
    Fixes Flash 5 problems

diff --git a/libswfdec/swfdec_as_function.c b/libswfdec/swfdec_as_function.c
index 5a82064..f89f56c 100644
--- a/libswfdec/swfdec_as_function.c
+++ b/libswfdec/swfdec_as_function.c
@@ -84,16 +84,20 @@ swfdec_as_function_set_constructor (Swfd
 
   object = SWFDEC_AS_OBJECT (fun);
   context = object->context;
-  if (context->Function) {
-    SWFDEC_AS_VALUE_SET_OBJECT (&val, context->Function);
-    swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_constructor,
-	&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
-  }
+  if (context->Function == NULL)
+    return;
+  
+  SWFDEC_AS_VALUE_SET_OBJECT (&val, context->Function);
+  swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_constructor,
+      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
+
   if (context->Function_prototype) {
     SWFDEC_AS_VALUE_SET_OBJECT (&val, context->Function_prototype);
-    swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR___proto__,
-	&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
+  } else {
+    SWFDEC_AS_VALUE_SET_UNDEFINED (&val);
   }
+  swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR___proto__,
+      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
 }
 
 /**
diff-tree 9dec9c1f6fbe7699e89a0c56272ad87c7fef690b (from a66701541ec744f27624de35eae95a1268cbbf2f)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 3 15:40:15 2007 +0200

    include recent fix for delete in trace_properties

diff --git a/test/trace/system-capabilities-query-5.swf b/test/trace/system-capabilities-query-5.swf
index dbc9e12..24acabb 100644
Binary files a/test/trace/system-capabilities-query-5.swf and b/test/trace/system-capabilities-query-5.swf differ
diff-tree a66701541ec744f27624de35eae95a1268cbbf2f (from 62f2e4615342ee03bfd8d24e7ebc46752731c2d0)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 3 14:20:09 2007 +0200

    check for __constructor__ vs constructor in new Object()s

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index c5e2a7a..b2c362e 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -293,6 +293,15 @@ EXTRA_DIST = \
 	construct-properties-7.swf.trace \
 	construct-properties-8.swf \
 	construct-properties-8.swf.trace \
+	constructor-madness.as \
+	constructor-madness-5.swf \
+	constructor-madness-5.swf.trace \
+	constructor-madness-6.swf \
+	constructor-madness-6.swf.trace \
+	constructor-madness-7.swf \
+	constructor-madness-7.swf.trace \
+	constructor-madness-8.swf \
+	constructor-madness-8.swf.trace \
 	constructor-prototype.swf \
 	constructor-prototype.swf.trace \
 	countdown.swf \
diff --git a/test/trace/constructor-madness-5.swf b/test/trace/constructor-madness-5.swf
new file mode 100644
index 0000000..ea6ea33
Binary files /dev/null and b/test/trace/constructor-madness-5.swf differ
diff --git a/test/trace/constructor-madness-5.swf.trace b/test/trace/constructor-madness-5.swf.trace
new file mode 100644
index 0000000..702431f
--- /dev/null
+++ b/test/trace/constructor-madness-5.swf.trace
@@ -0,0 +1,5 @@
+Check what version has __constructor__ vs constructor
+undefined
+undefined
+[type Function]
+undefined
diff --git a/test/trace/constructor-madness-6.swf b/test/trace/constructor-madness-6.swf
new file mode 100644
index 0000000..71c7124
Binary files /dev/null and b/test/trace/constructor-madness-6.swf differ
diff --git a/test/trace/constructor-madness-6.swf.trace b/test/trace/constructor-madness-6.swf.trace
new file mode 100644
index 0000000..db821ed
--- /dev/null
+++ b/test/trace/constructor-madness-6.swf.trace
@@ -0,0 +1,5 @@
+Check what version has __constructor__ vs constructor
+[type Function]
+true
+[type Function]
+true
diff --git a/test/trace/constructor-madness-7.swf b/test/trace/constructor-madness-7.swf
new file mode 100644
index 0000000..cf24af0
Binary files /dev/null and b/test/trace/constructor-madness-7.swf differ
diff --git a/test/trace/constructor-madness-7.swf.trace b/test/trace/constructor-madness-7.swf.trace
new file mode 100644
index 0000000..6831e0a
--- /dev/null
+++ b/test/trace/constructor-madness-7.swf.trace
@@ -0,0 +1,5 @@
+Check what version has __constructor__ vs constructor
+[type Function]
+true
+[type Function]
+false
diff --git a/test/trace/constructor-madness-8.swf b/test/trace/constructor-madness-8.swf
new file mode 100644
index 0000000..ed35009
Binary files /dev/null and b/test/trace/constructor-madness-8.swf differ
diff --git a/test/trace/constructor-madness-8.swf.trace b/test/trace/constructor-madness-8.swf.trace
new file mode 100644
index 0000000..6831e0a
--- /dev/null
+++ b/test/trace/constructor-madness-8.swf.trace
@@ -0,0 +1,5 @@
+Check what version has __constructor__ vs constructor
+[type Function]
+true
+[type Function]
+false
diff --git a/test/trace/constructor-madness.as b/test/trace/constructor-madness.as
new file mode 100644
index 0000000..7944812
--- /dev/null
+++ b/test/trace/constructor-madness.as
@@ -0,0 +1,10 @@
+// makeswf -v 7 -s 200x150 -r 1 -o constructor-madness.swf constructor-madness.as
+
+trace ("Check what version has __constructor__ vs constructor");
+o = new Object ();
+trace (o.__constructor__);
+trace (o.hasOwnProperty ("__constructor__"));
+trace (o.constructor);
+trace (o.hasOwnProperty ("constructor"));
+
+loadMovie ("FSCommand:quit", "");
diff-tree 62f2e4615342ee03bfd8d24e7ebc46752731c2d0 (from 12ed7065f523247bd107c2b03cc087d89d9177c3)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 3 14:15:43 2007 +0200

    __constructor__ is a Flash 6 invention

diff --git a/libswfdec/swfdec_as_interpret.c b/libswfdec/swfdec_as_interpret.c
index e8f6e64..32613a2 100644
--- a/libswfdec/swfdec_as_interpret.c
+++ b/libswfdec/swfdec_as_interpret.c
@@ -1884,8 +1884,10 @@ swfdec_action_extends (SwfdecAsContext *
     return;
   swfdec_as_object_get_variable (super, SWFDEC_AS_STR_prototype, &proto);
   swfdec_as_object_set_variable (prototype, SWFDEC_AS_STR___proto__, &proto);
-  swfdec_as_object_set_variable_and_flags (prototype, SWFDEC_AS_STR___constructor__,
-      superclass, SWFDEC_AS_VARIABLE_HIDDEN);
+  if (cx->version > 5) {
+    swfdec_as_object_set_variable_and_flags (prototype, SWFDEC_AS_STR___constructor__,
+	superclass, SWFDEC_AS_VARIABLE_HIDDEN);
+  }
   SWFDEC_AS_VALUE_SET_OBJECT (&proto, prototype);
   swfdec_as_object_set_variable (SWFDEC_AS_VALUE_GET_OBJECT (subclass),
       SWFDEC_AS_STR_prototype, &proto);
diff-tree 12ed7065f523247bd107c2b03cc087d89d9177c3 (from bf143f665e737c4a174cdcb5fad759e84aab87ba)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 3 14:05:19 2007 +0200

    set propflags to non-permanent before attempting to delete the property

diff --git a/test/trace/trace_properties.as b/test/trace/trace_properties.as
index 901526f..3925bdb 100644
--- a/test/trace/trace_properties.as
+++ b/test/trace/trace_properties.as
@@ -108,6 +108,7 @@ function hasOwnProperty (o, prop)
       result = false;
     }
 
+    ASSetPropFlags (o, "__proto__", 0, 2);
     o.__proto__ = "to-be-deleted";
     delete o.__proto__;
     if (o.__proto__ != undefined) {
diff-tree bf143f665e737c4a174cdcb5fad759e84aab87ba (from fed4bb6ee10ac1be6d915b2e78c4ae1673a5828b)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 3 13:13:05 2007 +0200

    add testcase that does some addProperty madness with __proto__

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index bd32622..c5e2a7a 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -891,6 +891,15 @@ EXTRA_DIST = \
 	property-native-7.swf.trace \
 	property-native-8.swf \
 	property-native-8.swf.trace \
+	prototype-addProperty.as \
+	prototype-addProperty-5.swf \
+	prototype-addProperty-5.swf.trace \
+	prototype-addProperty-6.swf \
+	prototype-addProperty-6.swf.trace \
+	prototype-addProperty-7.swf \
+	prototype-addProperty-7.swf.trace \
+	prototype-addProperty-8.swf \
+	prototype-addProperty-8.swf.trace \
 	prototype-movie.as \
 	prototype-movie-5.swf \
 	prototype-movie-5.swf.trace \
diff --git a/test/trace/prototype-addProperty-5.swf b/test/trace/prototype-addProperty-5.swf
new file mode 100644
index 0000000..f79789d
Binary files /dev/null and b/test/trace/prototype-addProperty-5.swf differ
diff --git a/test/trace/prototype-addProperty-5.swf.trace b/test/trace/prototype-addProperty-5.swf.trace
new file mode 100644
index 0000000..d6d590b
--- /dev/null
+++ b/test/trace/prototype-addProperty-5.swf.trace
@@ -0,0 +1,4 @@
+Check addProperty ("__proto__", ...) setting doesn't affect prototypes
+hi
+undefined
+undefined
diff --git a/test/trace/prototype-addProperty-6.swf b/test/trace/prototype-addProperty-6.swf
new file mode 100644
index 0000000..2e481fe
Binary files /dev/null and b/test/trace/prototype-addProperty-6.swf differ
diff --git a/test/trace/prototype-addProperty-6.swf.trace b/test/trace/prototype-addProperty-6.swf.trace
new file mode 100644
index 0000000..c0d1be9
--- /dev/null
+++ b/test/trace/prototype-addProperty-6.swf.trace
@@ -0,0 +1,5 @@
+Check addProperty ("__proto__", ...) setting doesn't affect prototypes
+hi
+set
+undefined
+undefined
diff --git a/test/trace/prototype-addProperty-7.swf b/test/trace/prototype-addProperty-7.swf
new file mode 100644
index 0000000..b64ff8c
Binary files /dev/null and b/test/trace/prototype-addProperty-7.swf differ
diff --git a/test/trace/prototype-addProperty-7.swf.trace b/test/trace/prototype-addProperty-7.swf.trace
new file mode 100644
index 0000000..b9910da
--- /dev/null
+++ b/test/trace/prototype-addProperty-7.swf.trace
@@ -0,0 +1,5 @@
+Check addProperty ("__proto__", ...) setting doesn't affect prototypes
+hi
+set
+42
+undefined
diff --git a/test/trace/prototype-addProperty-8.swf b/test/trace/prototype-addProperty-8.swf
new file mode 100644
index 0000000..4e156cf
Binary files /dev/null and b/test/trace/prototype-addProperty-8.swf differ
diff --git a/test/trace/prototype-addProperty-8.swf.trace b/test/trace/prototype-addProperty-8.swf.trace
new file mode 100644
index 0000000..b9910da
--- /dev/null
+++ b/test/trace/prototype-addProperty-8.swf.trace
@@ -0,0 +1,5 @@
+Check addProperty ("__proto__", ...) setting doesn't affect prototypes
+hi
+set
+42
+undefined
diff --git a/test/trace/prototype-addProperty.as b/test/trace/prototype-addProperty.as
new file mode 100644
index 0000000..687b424
--- /dev/null
+++ b/test/trace/prototype-addProperty.as
@@ -0,0 +1,19 @@
+// makeswf -v 7 -s 200x150 -r 1 -o prototype-addProperty.swf prototype-addProperty.as
+
+trace ("Check addProperty (\"__proto__\", ...) setting doesn't affect prototypes");
+o = new Object ();
+o.x = 42;
+o.addProperty ("__proto__", function () { trace("get"); }, function () { trace("set"); });
+p = new Object ();
+p.__proto__ = o;
+trace ("hi");
+o.__proto__ = new Object ();
+ASSetPropFlags (p, "__proto__", 0, 7);
+delete p.__proto__;
+trace (p.x);
+p.__proto__ = new Object ();
+ASSetPropFlags (p, "__proto__", 7);
+p.__proto__ = o;
+trace (p.x);
+
+loadMovie ("FSCommand:quit", "");
diff-tree fed4bb6ee10ac1be6d915b2e78c4ae1673a5828b (from 5072de677d012350f5439d08f3d296ed349ad7dd)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 3 13:07:19 2007 +0200

    in versions < 7, deleting __proto__ deletes the prototype link

diff --git a/libswfdec/swfdec_as_object.c b/libswfdec/swfdec_as_object.c
index 6b496cf..579d315 100644
--- a/libswfdec/swfdec_as_object.c
+++ b/libswfdec/swfdec_as_object.c
@@ -307,6 +307,9 @@ swfdec_as_object_do_delete (SwfdecAsObje
   if (var->flags & SWFDEC_AS_VARIABLE_PERMANENT)
     return SWFDEC_AS_DELETE_NOT_DELETED;
 
+  if (variable == SWFDEC_AS_STR___proto__ &&
+      object->context->version <= 6)
+    object->prototype = NULL;
   swfdec_as_object_free_property (NULL, var, object);
   if (!g_hash_table_remove (object->properties, variable)) {
     g_assert_not_reached ();
diff-tree 5072de677d012350f5439d08f3d296ed349ad7dd (from 2f139f8cd0d896d44cea0d9a0d7f5c6a435dd37f)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 3 12:59:35 2007 +0200

    seems like there's no addProperty lookup for __proto__
    
    Testcase will follow

diff --git a/libswfdec/swfdec_as_object.c b/libswfdec/swfdec_as_object.c
index 8432c7a..6b496cf 100644
--- a/libswfdec/swfdec_as_object.c
+++ b/libswfdec/swfdec_as_object.c
@@ -234,7 +234,7 @@ swfdec_as_object_do_set (SwfdecAsObject 
     return;
 
   var = swfdec_as_object_hash_lookup (object, variable);
-  if (var == NULL) {
+  if (var == NULL && variable != SWFDEC_AS_STR___proto__) {
     guint i;
     SwfdecAsObject *proto = object->prototype;
 
diff-tree 2f139f8cd0d896d44cea0d9a0d7f5c6a435dd37f (from 1ed4ec72029a99387527033479df01a2527a09b5)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 3 12:40:24 2007 +0200

    assign prototype member at the end of setter, so the new prototype doesn't affect the actual setting

diff --git a/libswfdec/swfdec_as_object.c b/libswfdec/swfdec_as_object.c
index 35b3b2b..8432c7a 100644
--- a/libswfdec/swfdec_as_object.c
+++ b/libswfdec/swfdec_as_object.c
@@ -233,15 +233,6 @@ swfdec_as_object_do_set (SwfdecAsObject 
   if (!swfdec_as_variable_name_is_valid (variable))
     return;
 
-  if (variable == SWFDEC_AS_STR___proto__) {
-    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;
-    }
-  }
-
   var = swfdec_as_object_hash_lookup (object, variable);
   if (var == NULL) {
     guint i;
@@ -276,6 +267,15 @@ swfdec_as_object_do_set (SwfdecAsObject 
   } else { 
     var->value = *val;
   }
+  if (variable == SWFDEC_AS_STR___proto__) {
+    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;
+    }
+  }
+
 }
 
 static void
diff-tree 1ed4ec72029a99387527033479df01a2527a09b5 (from e8ae03820c9f9bc64bb5ec06034649502305f406)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 3 12:23:02 2007 +0200

    add a test for limits when getting variables

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index 9484dbf..bd32622 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -909,6 +909,15 @@ EXTRA_DIST = \
 	prototype-recursion-addProperty-7.swf.trace \
 	prototype-recursion-addProperty-8.swf \
 	prototype-recursion-addProperty-8.swf.trace \
+	prototype-recursion-get.as \
+	prototype-recursion-get-5.swf \
+	prototype-recursion-get-5.swf.trace \
+	prototype-recursion-get-6.swf \
+	prototype-recursion-get-6.swf.trace \
+	prototype-recursion-get-7.swf \
+	prototype-recursion-get-7.swf.trace \
+	prototype-recursion-get-8.swf \
+	prototype-recursion-get-8.swf.trace \
 	prototypes.swf \
 	prototypes.swf.trace \
 	propflags.as \
diff --git a/test/trace/prototype-recursion-get-5.swf b/test/trace/prototype-recursion-get-5.swf
new file mode 100644
index 0000000..a07324f
Binary files /dev/null and b/test/trace/prototype-recursion-get-5.swf differ
diff --git a/test/trace/prototype-recursion-get-5.swf.trace b/test/trace/prototype-recursion-get-5.swf.trace
new file mode 100644
index 0000000..6537be2
--- /dev/null
+++ b/test/trace/prototype-recursion-get-5.swf.trace
@@ -0,0 +1,514 @@
+test recursion limit of getting properties
+>>>
+0: 42
+>>>
+1: 42
+>>>
+2: 42
+>>>
+3: 42
+>>>
+4: 42
+>>>
+5: 42
+>>>
+6: 42
+>>>
+7: 42
+>>>
+8: 42
+>>>
+9: 42
+>>>
+10: 42
+>>>
+11: 42
+>>>
+12: 42
+>>>
+13: 42
+>>>
+14: 42
+>>>
+15: 42
+>>>
+16: 42
+>>>
+17: 42
+>>>
+18: 42
+>>>
+19: 42
+>>>
+20: 42
+>>>
+21: 42
+>>>
+22: 42
+>>>
+23: 42
+>>>
+24: 42
+>>>
+25: 42
+>>>
+26: 42
+>>>
+27: 42
+>>>
+28: 42
+>>>
+29: 42
+>>>
+30: 42
+>>>
+31: 42
+>>>
+32: 42
+>>>
+33: 42
+>>>
+34: 42
+>>>
+35: 42
+>>>
+36: 42
+>>>
+37: 42
+>>>
+38: 42
+>>>
+39: 42
+>>>
+40: 42
+>>>
+41: 42
+>>>
+42: 42
+>>>
+43: 42
+>>>
+44: 42
+>>>
+45: 42
+>>>
+46: 42
+>>>
+47: 42
+>>>
+48: 42
+>>>
+49: 42
+>>>
+50: 42
+>>>
+51: 42
+>>>
+52: 42
+>>>
+53: 42
+>>>
+54: 42
+>>>
+55: 42
+>>>
+56: 42
+>>>
+57: 42
+>>>
+58: 42
+>>>
+59: 42
+>>>
+60: 42
+>>>
+61: 42
+>>>
+62: 42
+>>>
+63: 42
+>>>
+64: 42
+>>>
+65: 42
+>>>
+66: 42
+>>>
+67: 42
+>>>
+68: 42
+>>>
+69: 42
+>>>
+70: 42
+>>>
+71: 42
+>>>
+72: 42
+>>>
+73: 42
+>>>
+74: 42
+>>>
+75: 42
+>>>
+76: 42
+>>>
+77: 42
+>>>
+78: 42
+>>>
+79: 42
+>>>
+80: 42
+>>>
+81: 42
+>>>
+82: 42
+>>>
+83: 42
+>>>
+84: 42
+>>>
+85: 42
+>>>
+86: 42
+>>>
+87: 42
+>>>
+88: 42
+>>>
+89: 42
+>>>
+90: 42
+>>>
+91: 42
+>>>
+92: 42
+>>>
+93: 42
+>>>
+94: 42
+>>>
+95: 42
+>>>
+96: 42
+>>>
+97: 42
+>>>
+98: 42
+>>>
+99: 42
+>>>
+100: 42
+>>>
+101: 42
+>>>
+102: 42
+>>>
+103: 42
+>>>
+104: 42
+>>>
+105: 42
+>>>
+106: 42
+>>>
+107: 42
+>>>
+108: 42
+>>>
+109: 42
+>>>
+110: 42
+>>>
+111: 42
+>>>
+112: 42
+>>>
+113: 42
+>>>
+114: 42
+>>>
+115: 42
+>>>
+116: 42
+>>>
+117: 42
+>>>
+118: 42
+>>>
+119: 42
+>>>
+120: 42
+>>>
+121: 42
+>>>
+122: 42
+>>>
+123: 42
+>>>
+124: 42
+>>>
+125: 42
+>>>
+126: 42
+>>>
+127: 42
+>>>
+128: 42
+>>>
+129: 42
+>>>
+130: 42
+>>>
+131: 42
+>>>
+132: 42
+>>>
+133: 42
+>>>
+134: 42
+>>>
+135: 42
+>>>
+136: 42
+>>>
+137: 42
+>>>
+138: 42
+>>>
+139: 42
+>>>
+140: 42
+>>>
+141: 42
+>>>
+142: 42
+>>>
+143: 42
+>>>
+144: 42
+>>>
+145: 42
+>>>
+146: 42
+>>>
+147: 42
+>>>
+148: 42
+>>>
+149: 42
+>>>
+150: 42
+>>>
+151: 42
+>>>
+152: 42
+>>>
+153: 42
+>>>
+154: 42
+>>>
+155: 42
+>>>
+156: 42
+>>>
+157: 42
+>>>
+158: 42
+>>>
+159: 42
+>>>
+160: 42
+>>>
+161: 42
+>>>
+162: 42
+>>>
+163: 42
+>>>
+164: 42
+>>>
+165: 42
+>>>
+166: 42
+>>>
+167: 42
+>>>
+168: 42
+>>>
+169: 42
+>>>
+170: 42
+>>>
+171: 42
+>>>
+172: 42
+>>>
+173: 42
+>>>
+174: 42
+>>>
+175: 42
+>>>
+176: 42
+>>>
+177: 42
+>>>
+178: 42
+>>>
+179: 42
+>>>
+180: 42
+>>>
+181: 42
+>>>
+182: 42
+>>>
+183: 42
+>>>
+184: 42
+>>>
+185: 42
+>>>
+186: 42
+>>>
+187: 42
+>>>
+188: 42
+>>>
+189: 42
+>>>
+190: 42
+>>>
+191: 42
+>>>
+192: 42
+>>>
+193: 42
+>>>
+194: 42
+>>>
+195: 42
+>>>
+196: 42
+>>>
+197: 42
+>>>
+198: 42
+>>>
+199: 42
+>>>
+200: 42
+>>>
+201: 42
+>>>
+202: 42
+>>>
+203: 42
+>>>
+204: 42
+>>>
+205: 42
+>>>
+206: 42
+>>>
+207: 42
+>>>
+208: 42
+>>>
+209: 42
+>>>
+210: 42
+>>>
+211: 42
+>>>
+212: 42
+>>>
+213: 42
+>>>
+214: 42
+>>>
+215: 42
+>>>
+216: 42
+>>>
+217: 42
+>>>
+218: 42
+>>>
+219: 42
+>>>
+220: 42
+>>>
+221: 42
+>>>
+222: 42
+>>>
+223: 42
+>>>
+224: 42
+>>>
+225: 42
+>>>
+226: 42
+>>>
+227: 42
+>>>
+228: 42
+>>>
+229: 42
+>>>
+230: 42
+>>>
+231: 42
+>>>
+232: 42
+>>>
+233: 42
+>>>
+234: 42
+>>>
+235: 42
+>>>
+236: 42
+>>>
+237: 42
+>>>
+238: 42
+>>>
+239: 42
+>>>
+240: 42
+>>>
+241: 42
+>>>
+242: 42
+>>>
+243: 42
+>>>
+244: 42
+>>>
+245: 42
+>>>
+246: 42
+>>>
+247: 42
+>>>
+248: 42
+>>>
+249: 42
+>>>
+250: 42
+>>>
+251: 42
+>>>
+252: 42
+>>>
+253: 42
+>>>
+254: 42
+>>>
+255: 42
+>>>
diff --git a/test/trace/prototype-recursion-get-6.swf b/test/trace/prototype-recursion-get-6.swf
new file mode 100644
index 0000000..5079fbd
Binary files /dev/null and b/test/trace/prototype-recursion-get-6.swf differ
diff --git a/test/trace/prototype-recursion-get-6.swf.trace b/test/trace/prototype-recursion-get-6.swf.trace
new file mode 100644
index 0000000..6537be2
--- /dev/null
+++ b/test/trace/prototype-recursion-get-6.swf.trace
@@ -0,0 +1,514 @@
+test recursion limit of getting properties
+>>>
+0: 42
+>>>
+1: 42
+>>>
+2: 42
+>>>
+3: 42
+>>>
+4: 42
+>>>
+5: 42
+>>>
+6: 42
+>>>
+7: 42
+>>>
+8: 42
+>>>
+9: 42
+>>>
+10: 42
+>>>
+11: 42
+>>>
+12: 42
+>>>
+13: 42
+>>>
+14: 42
+>>>
+15: 42
+>>>
+16: 42
+>>>
+17: 42
+>>>
+18: 42
+>>>
+19: 42
+>>>
+20: 42
+>>>
+21: 42
+>>>
+22: 42
+>>>
+23: 42
+>>>
+24: 42
+>>>
+25: 42
+>>>
+26: 42
+>>>
+27: 42
+>>>
+28: 42
+>>>
+29: 42
+>>>
+30: 42
+>>>
+31: 42
+>>>
+32: 42
+>>>
+33: 42
+>>>
+34: 42
+>>>
+35: 42
+>>>
+36: 42
+>>>
+37: 42
+>>>
+38: 42
+>>>
+39: 42
+>>>
+40: 42
+>>>
+41: 42
+>>>
+42: 42
+>>>
+43: 42
+>>>
+44: 42
+>>>
+45: 42
+>>>
+46: 42
+>>>
+47: 42
+>>>
+48: 42
+>>>
+49: 42
+>>>
+50: 42
+>>>
+51: 42
+>>>
+52: 42
+>>>
+53: 42
+>>>
+54: 42
+>>>
+55: 42
+>>>
+56: 42
+>>>
+57: 42
+>>>
+58: 42
+>>>
+59: 42
+>>>
+60: 42
+>>>
+61: 42
+>>>
+62: 42
+>>>
+63: 42
+>>>
+64: 42
+>>>
+65: 42
+>>>
+66: 42
+>>>
+67: 42
+>>>
+68: 42
+>>>
+69: 42
+>>>
+70: 42
+>>>
+71: 42
+>>>
+72: 42
+>>>
+73: 42
+>>>
+74: 42
+>>>
+75: 42
+>>>
+76: 42
+>>>
+77: 42
+>>>
+78: 42
+>>>
+79: 42
+>>>
+80: 42
+>>>
+81: 42
+>>>
+82: 42
+>>>
+83: 42
+>>>
+84: 42
+>>>
+85: 42
+>>>
+86: 42
+>>>
+87: 42
+>>>
+88: 42
+>>>
+89: 42
+>>>
+90: 42
+>>>
+91: 42
+>>>
+92: 42
+>>>
+93: 42
+>>>
+94: 42
+>>>
+95: 42
+>>>
+96: 42
+>>>
+97: 42
+>>>
+98: 42
+>>>
+99: 42
+>>>
+100: 42
+>>>
+101: 42
+>>>
+102: 42
+>>>
+103: 42
+>>>
+104: 42
+>>>
+105: 42
+>>>
+106: 42
+>>>
+107: 42
+>>>
+108: 42
+>>>
+109: 42
+>>>
+110: 42
+>>>
+111: 42
+>>>
+112: 42
+>>>
+113: 42
+>>>
+114: 42
+>>>
+115: 42
+>>>
+116: 42
+>>>
+117: 42
+>>>
+118: 42
+>>>
+119: 42
+>>>
+120: 42
+>>>
+121: 42
+>>>
+122: 42
+>>>
+123: 42
+>>>
+124: 42
+>>>
+125: 42
+>>>
+126: 42
+>>>
+127: 42
+>>>
+128: 42
+>>>
+129: 42
+>>>
+130: 42
+>>>
+131: 42
+>>>
+132: 42
+>>>
+133: 42
+>>>
+134: 42
+>>>
+135: 42
+>>>
+136: 42
+>>>
+137: 42
+>>>
+138: 42
+>>>
+139: 42
+>>>
+140: 42
+>>>
+141: 42
+>>>
+142: 42
+>>>
+143: 42
+>>>
+144: 42
+>>>
+145: 42
+>>>
+146: 42
+>>>
+147: 42
+>>>
+148: 42
+>>>
+149: 42
+>>>
+150: 42
+>>>
+151: 42
+>>>
+152: 42
+>>>
+153: 42
+>>>
+154: 42
+>>>
+155: 42
+>>>
+156: 42
+>>>
+157: 42
+>>>
+158: 42
+>>>
+159: 42
+>>>
+160: 42
+>>>
+161: 42
+>>>
+162: 42
+>>>
+163: 42
+>>>
+164: 42
+>>>
+165: 42
+>>>
+166: 42
+>>>
+167: 42
+>>>
+168: 42
+>>>
+169: 42
+>>>
+170: 42
+>>>
+171: 42
+>>>
+172: 42
+>>>
+173: 42
+>>>
+174: 42
+>>>
+175: 42
+>>>
+176: 42
+>>>
+177: 42
+>>>
+178: 42
+>>>
+179: 42
+>>>
+180: 42
+>>>
+181: 42
+>>>
+182: 42
+>>>
+183: 42
+>>>
+184: 42
+>>>
+185: 42
+>>>
+186: 42
+>>>
+187: 42
+>>>
+188: 42
+>>>
+189: 42
+>>>
+190: 42
+>>>
+191: 42
+>>>
+192: 42
+>>>
+193: 42
+>>>
+194: 42
+>>>
+195: 42
+>>>
+196: 42
+>>>
+197: 42
+>>>
+198: 42
+>>>
+199: 42
+>>>
+200: 42
+>>>
+201: 42
+>>>
+202: 42
+>>>
+203: 42
+>>>
+204: 42
+>>>
+205: 42
+>>>
+206: 42
+>>>
+207: 42
+>>>
+208: 42
+>>>
+209: 42
+>>>
+210: 42
+>>>
+211: 42
+>>>
+212: 42
+>>>
+213: 42
+>>>
+214: 42
+>>>
+215: 42
+>>>
+216: 42
+>>>
+217: 42
+>>>
+218: 42
+>>>
+219: 42
+>>>
+220: 42
+>>>
+221: 42
+>>>
+222: 42
+>>>
+223: 42
+>>>
+224: 42
+>>>
+225: 42
+>>>
+226: 42
+>>>
+227: 42
+>>>
+228: 42
+>>>
+229: 42
+>>>
+230: 42
+>>>
+231: 42
+>>>
+232: 42
+>>>
+233: 42
+>>>
+234: 42
+>>>
+235: 42
+>>>
+236: 42
+>>>
+237: 42
+>>>
+238: 42
+>>>
+239: 42
+>>>
+240: 42
+>>>
+241: 42
+>>>
+242: 42
+>>>
+243: 42
+>>>
+244: 42
+>>>
+245: 42
+>>>
+246: 42
+>>>
+247: 42
+>>>
+248: 42
+>>>
+249: 42
+>>>
+250: 42
+>>>
+251: 42
+>>>
+252: 42
+>>>
+253: 42
+>>>
+254: 42
+>>>
+255: 42
+>>>
diff --git a/test/trace/prototype-recursion-get-7.swf b/test/trace/prototype-recursion-get-7.swf
new file mode 100644
index 0000000..c66913e
Binary files /dev/null and b/test/trace/prototype-recursion-get-7.swf differ
diff --git a/test/trace/prototype-recursion-get-7.swf.trace b/test/trace/prototype-recursion-get-7.swf.trace
new file mode 100644
index 0000000..6537be2
--- /dev/null
+++ b/test/trace/prototype-recursion-get-7.swf.trace
@@ -0,0 +1,514 @@
+test recursion limit of getting properties
+>>>
+0: 42
+>>>
+1: 42
+>>>
+2: 42
+>>>
+3: 42
+>>>
+4: 42
+>>>
+5: 42
+>>>
+6: 42
+>>>
+7: 42
+>>>
+8: 42
+>>>
+9: 42
+>>>
+10: 42
+>>>
+11: 42
+>>>
+12: 42
+>>>
+13: 42
+>>>
+14: 42
+>>>
+15: 42
+>>>
+16: 42
+>>>
+17: 42
+>>>
+18: 42
+>>>
+19: 42
+>>>
+20: 42
+>>>
+21: 42
+>>>
+22: 42
+>>>
+23: 42
+>>>
+24: 42
+>>>
+25: 42
+>>>
+26: 42
+>>>
+27: 42
+>>>
+28: 42
+>>>
+29: 42
+>>>
+30: 42
+>>>
+31: 42
+>>>
+32: 42
+>>>
+33: 42
+>>>
+34: 42
+>>>
+35: 42
+>>>
+36: 42
+>>>
+37: 42
+>>>
+38: 42
+>>>
+39: 42
+>>>
+40: 42
+>>>
+41: 42
+>>>
+42: 42
+>>>
+43: 42
+>>>
+44: 42
+>>>
+45: 42
+>>>
+46: 42
+>>>
+47: 42
+>>>
+48: 42
+>>>
+49: 42
+>>>
+50: 42
+>>>
+51: 42
+>>>
+52: 42
+>>>
+53: 42
+>>>
+54: 42
+>>>
+55: 42
+>>>
+56: 42
+>>>
+57: 42
+>>>
+58: 42
+>>>
+59: 42
+>>>
+60: 42
+>>>
+61: 42
+>>>
+62: 42
+>>>
+63: 42
+>>>
+64: 42
+>>>
+65: 42
+>>>
+66: 42
+>>>
+67: 42
+>>>
+68: 42
+>>>
+69: 42
+>>>
+70: 42
+>>>
+71: 42
+>>>
+72: 42
+>>>
+73: 42
+>>>
+74: 42
+>>>
+75: 42
+>>>
+76: 42
+>>>
+77: 42
+>>>
+78: 42
+>>>
+79: 42
+>>>
+80: 42
+>>>
+81: 42
+>>>
+82: 42
+>>>
+83: 42
+>>>
+84: 42
+>>>
+85: 42
+>>>
+86: 42
+>>>
+87: 42
+>>>
+88: 42
+>>>
+89: 42
+>>>
+90: 42
+>>>
+91: 42
+>>>
+92: 42
+>>>
+93: 42
+>>>
+94: 42
+>>>
+95: 42
+>>>
+96: 42
+>>>
+97: 42
+>>>
+98: 42
+>>>
+99: 42
+>>>
+100: 42
+>>>
+101: 42
+>>>
+102: 42
+>>>
+103: 42
+>>>
+104: 42
+>>>
+105: 42
+>>>
+106: 42
+>>>
+107: 42
+>>>
+108: 42
+>>>
+109: 42
+>>>
+110: 42
+>>>
+111: 42
+>>>
+112: 42
+>>>
+113: 42
+>>>
+114: 42
+>>>
+115: 42
+>>>
+116: 42
+>>>
+117: 42
+>>>
+118: 42
+>>>
+119: 42
+>>>
+120: 42
+>>>
+121: 42
+>>>
+122: 42
+>>>
+123: 42
+>>>
+124: 42
+>>>
+125: 42
+>>>
+126: 42
+>>>
+127: 42
+>>>
+128: 42
+>>>
+129: 42
+>>>
+130: 42
+>>>
+131: 42
+>>>
+132: 42
+>>>
+133: 42
+>>>
+134: 42
+>>>
+135: 42
+>>>
+136: 42
+>>>
+137: 42
+>>>
+138: 42
+>>>
+139: 42
+>>>
+140: 42
+>>>
+141: 42
+>>>
+142: 42
+>>>
+143: 42
+>>>
+144: 42
+>>>
+145: 42
+>>>
+146: 42
+>>>
+147: 42
+>>>
+148: 42
+>>>
+149: 42
+>>>
+150: 42
+>>>
+151: 42
+>>>
+152: 42
+>>>
+153: 42
+>>>
+154: 42
+>>>
+155: 42
+>>>
+156: 42
+>>>
+157: 42
+>>>
+158: 42
+>>>
+159: 42
+>>>
+160: 42
+>>>
+161: 42
+>>>
+162: 42
+>>>
+163: 42
+>>>
+164: 42
+>>>
+165: 42
+>>>
+166: 42
+>>>
+167: 42
+>>>
+168: 42
+>>>
+169: 42
+>>>
+170: 42
+>>>
+171: 42
+>>>
+172: 42
+>>>
+173: 42
+>>>
+174: 42
+>>>
+175: 42
+>>>
+176: 42
+>>>
+177: 42
+>>>
+178: 42
+>>>
+179: 42
+>>>
+180: 42
+>>>
+181: 42
+>>>
+182: 42
+>>>
+183: 42
+>>>
+184: 42
+>>>
+185: 42
+>>>
+186: 42
+>>>
+187: 42
+>>>
+188: 42
+>>>
+189: 42
+>>>
+190: 42
+>>>
+191: 42
+>>>
+192: 42
+>>>
+193: 42
+>>>
+194: 42
+>>>
+195: 42
+>>>
+196: 42
+>>>
+197: 42
+>>>
+198: 42
+>>>
+199: 42
+>>>
+200: 42
+>>>
+201: 42
+>>>
+202: 42
+>>>
+203: 42
+>>>
+204: 42
+>>>
+205: 42
+>>>
+206: 42
+>>>
+207: 42
+>>>
+208: 42
+>>>
+209: 42
+>>>
+210: 42
+>>>
+211: 42
+>>>
+212: 42
+>>>
+213: 42
+>>>
+214: 42
+>>>
+215: 42
+>>>
+216: 42
+>>>
+217: 42
+>>>
+218: 42
+>>>
+219: 42
+>>>
+220: 42
+>>>
+221: 42
+>>>
+222: 42
+>>>
+223: 42
+>>>
+224: 42
+>>>
+225: 42
+>>>
+226: 42
+>>>
+227: 42
+>>>
+228: 42
+>>>
+229: 42
+>>>
+230: 42
+>>>
+231: 42
+>>>
+232: 42
+>>>
+233: 42
+>>>
+234: 42
+>>>
+235: 42
+>>>
+236: 42
+>>>
+237: 42
+>>>
+238: 42
+>>>
+239: 42
+>>>
+240: 42
+>>>
+241: 42
+>>>
+242: 42
+>>>
+243: 42
+>>>
+244: 42
+>>>
+245: 42
+>>>
+246: 42
+>>>
+247: 42
+>>>
+248: 42
+>>>
+249: 42
+>>>
+250: 42
+>>>
+251: 42
+>>>
+252: 42
+>>>
+253: 42
+>>>
+254: 42
+>>>
+255: 42
+>>>
diff --git a/test/trace/prototype-recursion-get-8.swf b/test/trace/prototype-recursion-get-8.swf
new file mode 100644
index 0000000..a8357f0
Binary files /dev/null and b/test/trace/prototype-recursion-get-8.swf differ
diff --git a/test/trace/prototype-recursion-get-8.swf.trace b/test/trace/prototype-recursion-get-8.swf.trace
new file mode 100644
index 0000000..6537be2
--- /dev/null
+++ b/test/trace/prototype-recursion-get-8.swf.trace
@@ -0,0 +1,514 @@
+test recursion limit of getting properties
+>>>
+0: 42
+>>>
+1: 42
+>>>
+2: 42
+>>>
+3: 42
+>>>
+4: 42
+>>>
+5: 42
+>>>
+6: 42
+>>>
+7: 42
+>>>
+8: 42
+>>>
+9: 42
+>>>
+10: 42
+>>>
+11: 42
+>>>
+12: 42
+>>>
+13: 42
+>>>
+14: 42
+>>>
+15: 42
+>>>
+16: 42
+>>>
+17: 42
+>>>
+18: 42
+>>>
+19: 42
+>>>
+20: 42
+>>>
+21: 42
+>>>
+22: 42
+>>>
+23: 42
+>>>
+24: 42
+>>>
+25: 42
+>>>
+26: 42
+>>>
+27: 42
+>>>
+28: 42
+>>>
+29: 42
+>>>
+30: 42
+>>>
+31: 42
+>>>
+32: 42
+>>>
+33: 42
+>>>
+34: 42
+>>>
+35: 42
+>>>
+36: 42
+>>>
+37: 42
+>>>
+38: 42
+>>>
+39: 42
+>>>
+40: 42
+>>>
+41: 42
+>>>
+42: 42
+>>>
+43: 42
+>>>
+44: 42
+>>>
+45: 42
+>>>
+46: 42
+>>>
+47: 42
+>>>
+48: 42
+>>>
+49: 42
+>>>
+50: 42
+>>>
+51: 42
+>>>
+52: 42
+>>>
+53: 42
+>>>
+54: 42
+>>>
+55: 42
+>>>
+56: 42
+>>>
+57: 42
+>>>
+58: 42
+>>>
+59: 42
+>>>
+60: 42
+>>>
+61: 42
+>>>
+62: 42
+>>>
+63: 42
+>>>
+64: 42
+>>>
+65: 42
+>>>
+66: 42
+>>>
+67: 42
+>>>
+68: 42
+>>>
+69: 42
+>>>
+70: 42
+>>>
+71: 42
+>>>
+72: 42
+>>>
+73: 42
+>>>
+74: 42
+>>>
+75: 42
+>>>
+76: 42
+>>>
+77: 42
+>>>
+78: 42
+>>>
+79: 42
+>>>
+80: 42
+>>>
+81: 42
+>>>
+82: 42
+>>>
+83: 42
+>>>
+84: 42
+>>>
+85: 42
+>>>
+86: 42
+>>>
+87: 42
+>>>
+88: 42
+>>>
+89: 42
+>>>
+90: 42
+>>>
+91: 42
+>>>
+92: 42
+>>>
+93: 42
+>>>
+94: 42
+>>>
+95: 42
+>>>
+96: 42
+>>>
+97: 42
+>>>
+98: 42
+>>>
+99: 42
+>>>
+100: 42
+>>>
+101: 42
+>>>
+102: 42
+>>>
+103: 42
+>>>
+104: 42
+>>>
+105: 42
+>>>
+106: 42
+>>>
+107: 42
+>>>
+108: 42
+>>>
+109: 42
+>>>
+110: 42
+>>>
+111: 42
+>>>
+112: 42
+>>>
+113: 42
+>>>
+114: 42
+>>>
+115: 42
+>>>
+116: 42
+>>>
+117: 42
+>>>
+118: 42
+>>>
+119: 42
+>>>
+120: 42
+>>>
+121: 42
+>>>
+122: 42
+>>>
+123: 42
+>>>
+124: 42
+>>>
+125: 42
+>>>
+126: 42
+>>>
+127: 42
+>>>
+128: 42
+>>>
+129: 42
+>>>
+130: 42
+>>>
+131: 42
+>>>
+132: 42
+>>>
+133: 42
+>>>
+134: 42
+>>>
+135: 42
+>>>
+136: 42
+>>>
+137: 42
+>>>
+138: 42
+>>>
+139: 42
+>>>
+140: 42
+>>>
+141: 42
+>>>
+142: 42
+>>>
+143: 42
+>>>
+144: 42
+>>>
+145: 42
+>>>
+146: 42
+>>>
+147: 42
+>>>
+148: 42
+>>>
+149: 42
+>>>
+150: 42
+>>>
+151: 42
+>>>
+152: 42
+>>>
+153: 42
+>>>
+154: 42
+>>>
+155: 42
+>>>
+156: 42
+>>>
+157: 42
+>>>
+158: 42
+>>>
+159: 42
+>>>
+160: 42
+>>>
+161: 42
+>>>
+162: 42
+>>>
+163: 42
+>>>
+164: 42
+>>>
+165: 42
+>>>
+166: 42
+>>>
+167: 42
+>>>
+168: 42
+>>>
+169: 42
+>>>
+170: 42
+>>>
+171: 42
+>>>
+172: 42
+>>>
+173: 42
+>>>
+174: 42
+>>>
+175: 42
+>>>
+176: 42
+>>>
+177: 42
+>>>
+178: 42
+>>>
+179: 42
+>>>
+180: 42
+>>>
+181: 42
+>>>
+182: 42
+>>>
+183: 42
+>>>
+184: 42
+>>>
+185: 42
+>>>
+186: 42
+>>>
+187: 42
+>>>
+188: 42
+>>>
+189: 42
+>>>
+190: 42
+>>>
+191: 42
+>>>
+192: 42
+>>>
+193: 42
+>>>
+194: 42
+>>>
+195: 42
+>>>
+196: 42
+>>>
+197: 42
+>>>
+198: 42
+>>>
+199: 42
+>>>
+200: 42
+>>>
+201: 42
+>>>
+202: 42
+>>>
+203: 42
+>>>
+204: 42
+>>>
+205: 42
+>>>
+206: 42
+>>>
+207: 42
+>>>
+208: 42
+>>>
+209: 42
+>>>
+210: 42
+>>>
+211: 42
+>>>
+212: 42
+>>>
+213: 42
+>>>
+214: 42
+>>>
+215: 42
+>>>
+216: 42
+>>>
+217: 42
+>>>
+218: 42
+>>>
+219: 42
+>>>
+220: 42
+>>>
+221: 42
+>>>
+222: 42
+>>>
+223: 42
+>>>
+224: 42
+>>>
+225: 42
+>>>
+226: 42
+>>>
+227: 42
+>>>
+228: 42
+>>>
+229: 42
+>>>
+230: 42
+>>>
+231: 42
+>>>
+232: 42
+>>>
+233: 42
+>>>
+234: 42
+>>>
+235: 42
+>>>
+236: 42
+>>>
+237: 42
+>>>
+238: 42
+>>>
+239: 42
+>>>
+240: 42
+>>>
+241: 42
+>>>
+242: 42
+>>>
+243: 42
+>>>
+244: 42
+>>>
+245: 42
+>>>
+246: 42
+>>>
+247: 42
+>>>
+248: 42
+>>>
+249: 42
+>>>
+250: 42
+>>>
+251: 42
+>>>
+252: 42
+>>>
+253: 42
+>>>
+254: 42
+>>>
+255: 42
+>>>
diff --git a/test/trace/prototype-recursion-get.as b/test/trace/prototype-recursion-get.as
new file mode 100644
index 0000000..6e2b82c
--- /dev/null
+++ b/test/trace/prototype-recursion-get.as
@@ -0,0 +1,14 @@
+// makeswf -v 7 -s 200x150 -r 1 -o prototype-recursion-get.swf prototype-recursion-get.as
+
+trace ("test recursion limit of getting properties");
+o = new Object ();
+o.x = 42;
+for (i = 0; ; i++) {
+  p = new Object ();
+  p.__proto__ = o;
+  o = p;
+  trace (">>>");
+  trace (i + ": " + o.x);
+}
+
+loadMovie ("FSCommand:quit", "");
diff-tree e8ae03820c9f9bc64bb5ec06034649502305f406 (from 8d2edb296c1de14bd6253c577697614d641f4376)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 3 12:10:28 2007 +0200

    add a test for recursion limits of variables

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index e0e5a92..9484dbf 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -900,6 +900,15 @@ EXTRA_DIST = \
 	prototype-movie-7.swf.trace \
 	prototype-movie-8.swf \
 	prototype-movie-8.swf.trace \
+	prototype-recursion-addProperty.as \
+	prototype-recursion-addProperty-5.swf \
+	prototype-recursion-addProperty-5.swf.trace \
+	prototype-recursion-addProperty-6.swf \
+	prototype-recursion-addProperty-6.swf.trace \
+	prototype-recursion-addProperty-7.swf \
+	prototype-recursion-addProperty-7.swf.trace \
+	prototype-recursion-addProperty-8.swf \
+	prototype-recursion-addProperty-8.swf.trace \
 	prototypes.swf \
 	prototypes.swf.trace \
 	propflags.as \
diff --git a/test/trace/prototype-recursion-addProperty-5.swf b/test/trace/prototype-recursion-addProperty-5.swf
new file mode 100644
index 0000000..212eecc
Binary files /dev/null and b/test/trace/prototype-recursion-addProperty-5.swf differ
diff --git a/test/trace/prototype-recursion-addProperty-5.swf.trace b/test/trace/prototype-recursion-addProperty-5.swf.trace
new file mode 100644
index 0000000..a5bf0eb
--- /dev/null
+++ b/test/trace/prototype-recursion-addProperty-5.swf.trace
@@ -0,0 +1,254 @@
+0: 
+1: 
+2: 
+3: 
+4: 
+5: 
+6: 
+7: 
+8: 
+9: 
+10: 
+11: 
+12: 
+13: 
+14: 
+15: 
+16: 
+17: 
+18: 
+19: 
+20: 
+21: 
+22: 
+23: 
+24: 
+25: 
+26: 
+27: 
+28: 
+29: 
+30: 
+31: 
+32: 
+33: 
+34: 
+35: 
+36: 
+37: 
+38: 
+39: 
+40: 
+41: 
+42: 
+43: 
+44: 
+45: 
+46: 
+47: 
+48: 
+49: 
+50: 
+51: 
+52: 
+53: 
+54: 
+55: 
+56: 
+57: 
+58: 
+59: 
+60: 
+61: 
+62: 
+63: 
+64: 
+65: 
+66: 
+67: 
+68: 
+69: 
+70: 
+71: 
+72: 
+73: 
+74: 
+75: 
+76: 
+77: 
+78: 
+79: 
+80: 
+81: 
+82: 
+83: 
+84: 
+85: 
+86: 
+87: 
+88: 
+89: 
+90: 
+91: 
+92: 
+93: 
+94: 
+95: 
+96: 
+97: 
+98: 
+99: 
+100: 
+101: 
+102: 
+103: 
+104: 
+105: 
+106: 
+107: 
+108: 
+109: 
+110: 
+111: 
+112: 
+113: 
+114: 
+115: 
+116: 
+117: 
+118: 
+119: 
+120: 
+121: 
+122: 
+123: 
+124: 
+125: 
+126: 
+127: 
+128: 
+129: 
+130: 
+131: 
+132: 
+133: 
+134: 
+135: 
+136: 
+137: 
+138: 
+139: 
+140: 
+141: 
+142: 
+143: 
+144: 
+145: 
+146: 
+147: 
+148: 
+149: 
+150: 
+151: 
+152: 
+153: 
+154: 
+155: 
+156: 
+157: 
+158: 
+159: 
+160: 
+161: 
+162: 
+163: 
+164: 
+165: 
+166: 
+167: 
+168: 
+169: 
+170: 
+171: 
+172: 
+173: 
+174: 
+175: 
+176: 
+177: 
+178: 
+179: 
+180: 
+181: 
+182: 
+183: 
+184: 
+185: 
+186: 
+187: 
+188: 
+189: 
+190: 
+191: 
+192: 
+193: 
+194: 
+195: 
+196: 
+197: 
+198: 
+199: 
+200: 
+201: 
+202: 
+203: 
+204: 
+205: 
+206: 
+207: 
+208: 
+209: 
+210: 
+211: 
+212: 
+213: 
+214: 
+215: 
+216: 
+217: 
+218: 
+219: 
+220: 
+221: 
+222: 
+223: 
+224: 
+225: 
+226: 
+227: 
+228: 
+229: 
+230: 
+231: 
+232: 
+233: 
+234: 
+235: 
+236: 
+237: 
+238: 
+239: 
+240: 
+241: 
+242: 
+243: 
+244: 
+245: 
+246: 
+247: 
+248: 
+249: 
+250: 
+251: 
+252: 
+253: 
diff --git a/test/trace/prototype-recursion-addProperty-6.swf b/test/trace/prototype-recursion-addProperty-6.swf
new file mode 100644
index 0000000..642c75e
Binary files /dev/null and b/test/trace/prototype-recursion-addProperty-6.swf differ
diff --git a/test/trace/prototype-recursion-addProperty-6.swf.trace b/test/trace/prototype-recursion-addProperty-6.swf.trace
new file mode 100644
index 0000000..4d26eed
--- /dev/null
+++ b/test/trace/prototype-recursion-addProperty-6.swf.trace
@@ -0,0 +1,256 @@
+0: false
+1: false
+2: false
+3: false
+4: false
+5: false
+6: false
+7: false
+8: false
+9: false
+10: false
+11: false
+12: false
+13: false
+14: false
+15: false
+16: false
+17: false
+18: false
+19: false
+20: false
+21: false
+22: false
+23: false
+24: false
+25: false
+26: false
+27: false
+28: false
+29: false
+30: false
+31: false
+32: false
+33: false
+34: false
+35: false
+36: false
+37: false
+38: false
+39: false
+40: false
+41: false
+42: false
+43: false
+44: false
+45: false
+46: false
+47: false
+48: false
+49: false
+50: false
+51: false
+52: false
+53: false
+54: false
+55: false
+56: false
+57: false
+58: false
+59: false
+60: false
+61: false
+62: false
+63: false
+64: false
+65: false
+66: false
+67: false
+68: false
+69: false
+70: false
+71: false
+72: false
+73: false
+74: false
+75: false
+76: false
+77: false
+78: false
+79: false
+80: false
+81: false
+82: false
+83: false
+84: false
+85: false
+86: false
+87: false
+88: false
+89: false
+90: false
+91: false
+92: false
+93: false
+94: false
+95: false
+96: false
+97: false
+98: false
+99: false
+100: false
+101: false
+102: false
+103: false
+104: false
+105: false
+106: false
+107: false
+108: false
+109: false
+110: false
+111: false
+112: false
+113: false
+114: false
+115: false
+116: false
+117: false
+118: false
+119: false
+120: false
+121: false
+122: false
+123: false
+124: false
+125: false
+126: false
+127: false
+128: false
+129: false
+130: false
+131: false
+132: false
+133: false
+134: false
+135: false
+136: false
+137: false
+138: false
+139: false
+140: false
+141: false
+142: false
+143: false
+144: false
+145: false
+146: false
+147: false
+148: false
+149: false
+150: false
+151: false
+152: false
+153: false
+154: false
+155: false
+156: false
+157: false
+158: false
+159: false
+160: false
+161: false
+162: false
+163: false
+164: false
+165: false
+166: false
+167: false
+168: false
+169: false
+170: false
+171: false
+172: false
+173: false
+174: false
+175: false
+176: false
+177: false
+178: false
+179: false
+180: false
+181: false
+182: false
+183: false
+184: false
+185: false
+186: false
+187: false
+188: false
+189: false
+190: false
+191: false
+192: false
+193: false
+194: false
+195: false
+196: false
+197: false
+198: false
+199: false
+200: false
+201: false
+202: false
+203: false
+204: false
+205: false
+206: false
+207: false
+208: false
+209: false
+210: false
+211: false
+212: false
+213: false
+214: false
+215: false
+216: false
+217: false
+218: false
+219: false
+220: false
+221: false
+222: false
+223: false
+224: false
+225: false
+226: false
+227: false
+228: false
+229: false
+230: false
+231: false
+232: false
+233: false
+234: false
+235: false
+236: false
+237: false
+238: false
+239: false
+240: false
+241: false
+242: false
+243: false
+244: false
+245: false
+246: false
+247: false
+248: false
+249: false
+250: false
+251: false
+252: false
+253: false
+254: false
+255: false
diff --git a/test/trace/prototype-recursion-addProperty-7.swf b/test/trace/prototype-recursion-addProperty-7.swf
new file mode 100644
index 0000000..4e15210
Binary files /dev/null and b/test/trace/prototype-recursion-addProperty-7.swf differ
diff --git a/test/trace/prototype-recursion-addProperty-7.swf.trace b/test/trace/prototype-recursion-addProperty-7.swf.trace
new file mode 100644
index 0000000..4d26eed
--- /dev/null
+++ b/test/trace/prototype-recursion-addProperty-7.swf.trace
@@ -0,0 +1,256 @@
+0: false
+1: false
+2: false
+3: false
+4: false
+5: false
+6: false
+7: false
+8: false
+9: false
+10: false
+11: false
+12: false
+13: false
+14: false
+15: false
+16: false
+17: false
+18: false
+19: false
+20: false
+21: false
+22: false
+23: false
+24: false
+25: false
+26: false
+27: false
+28: false
+29: false
+30: false
+31: false
+32: false
+33: false
+34: false
+35: false
+36: false
+37: false
+38: false
+39: false
+40: false
+41: false
+42: false
+43: false
+44: false
+45: false
+46: false
+47: false
+48: false
+49: false
+50: false
+51: false
+52: false
+53: false
+54: false
+55: false
+56: false
+57: false
+58: false
+59: false
+60: false
+61: false
+62: false
+63: false
+64: false
+65: false
+66: false
+67: false
+68: false
+69: false
+70: false
+71: false
+72: false
+73: false
+74: false
+75: false
+76: false
+77: false
+78: false
+79: false
+80: false
+81: false
+82: false
+83: false
+84: false
+85: false
+86: false
+87: false
+88: false
+89: false
+90: false
+91: false
+92: false
+93: false
+94: false
+95: false
+96: false
+97: false
+98: false
+99: false
+100: false
+101: false
+102: false
+103: false
+104: false
+105: false
+106: false
+107: false
+108: false
+109: false
+110: false
+111: false
+112: false
+113: false
+114: false
+115: false
+116: false
+117: false
+118: false
+119: false
+120: false
+121: false
+122: false
+123: false
+124: false
+125: false
+126: false
+127: false
+128: false
+129: false
+130: false
+131: false
+132: false
+133: false
+134: false
+135: false
+136: false
+137: false
+138: false
+139: false
+140: false
+141: false
+142: false
+143: false
+144: false
+145: false
+146: false
+147: false
+148: false
+149: false
+150: false
+151: false
+152: false
+153: false
+154: false
+155: false
+156: false
+157: false
+158: false
+159: false
+160: false
+161: false
+162: false
+163: false
+164: false
+165: false
+166: false
+167: false
+168: false
+169: false
+170: false
+171: false
+172: false
+173: false
+174: false
+175: false
+176: false
+177: false
+178: false
+179: false
+180: false
+181: false
+182: false
+183: false
+184: false
+185: false
+186: false
+187: false
+188: false
+189: false
+190: false
+191: false
+192: false
+193: false
+194: false
+195: false
+196: false
+197: false
+198: false
+199: false
+200: false
+201: false
+202: false
+203: false
+204: false
+205: false
+206: false
+207: false
+208: false
+209: false
+210: false
+211: false
+212: false
+213: false
+214: false
+215: false
+216: false
+217: false
+218: false
+219: false
+220: false
+221: false
+222: false
+223: false
+224: false
+225: false
+226: false
+227: false
+228: false
+229: false
+230: false
+231: false
+232: false
+233: false
+234: false
+235: false
+236: false
+237: false
+238: false
+239: false
+240: false
+241: false
+242: false
+243: false
+244: false
+245: false
+246: false
+247: false
+248: false
+249: false
+250: false
+251: false
+252: false
+253: false
+254: false
+255: false
diff --git a/test/trace/prototype-recursion-addProperty-8.swf b/test/trace/prototype-recursion-addProperty-8.swf
new file mode 100644
index 0000000..6c06b94
Binary files /dev/null and b/test/trace/prototype-recursion-addProperty-8.swf differ
diff --git a/test/trace/prototype-recursion-addProperty-8.swf.trace b/test/trace/prototype-recursion-addProperty-8.swf.trace
new file mode 100644
index 0000000..4d26eed
--- /dev/null
+++ b/test/trace/prototype-recursion-addProperty-8.swf.trace
@@ -0,0 +1,256 @@
+0: false
+1: false
+2: false
+3: false
+4: false
+5: false
+6: false
+7: false
+8: false
+9: false
+10: false
+11: false
+12: false
+13: false
+14: false
+15: false
+16: false
+17: false
+18: false
+19: false
+20: false
+21: false
+22: false
+23: false
+24: false
+25: false
+26: false
+27: false
+28: false
+29: false
+30: false
+31: false
+32: false
+33: false
+34: false
+35: false
+36: false
+37: false
+38: false
+39: false
+40: false
+41: false
+42: false
+43: false
+44: false
+45: false
+46: false
+47: false
+48: false
+49: false
+50: false
+51: false
+52: false
+53: false
+54: false
+55: false
+56: false
+57: false
+58: false
+59: false
+60: false
+61: false
+62: false
+63: false
+64: false
+65: false
+66: false
+67: false
+68: false
+69: false
+70: false
+71: false
+72: false
+73: false
+74: false
+75: false
+76: false
+77: false
+78: false
+79: false
+80: false
+81: false
+82: false
+83: false
+84: false
+85: false
+86: false
+87: false
+88: false
+89: false
+90: false
+91: false
+92: false
+93: false
+94: false
+95: false
+96: false
+97: false
+98: false
+99: false
+100: false
+101: false
+102: false
+103: false
+104: false
+105: false
+106: false
+107: false
+108: false
+109: false
+110: false
+111: false
+112: false
+113: false
+114: false
+115: false
+116: false
+117: false
+118: false
+119: false
+120: false
+121: false
+122: false
+123: false
+124: false
+125: false
+126: false
+127: false
+128: false
+129: false
+130: false
+131: false
+132: false
+133: false
+134: false
+135: false
+136: false
+137: false
+138: false
+139: false
+140: false
+141: false
+142: false
+143: false
+144: false
+145: false
+146: false
+147: false
+148: false
+149: false
+150: false
+151: false
+152: false
+153: false
+154: false
+155: false
+156: false
+157: false
+158: false
+159: false
+160: false
+161: false
+162: false
+163: false
+164: false
+165: false
+166: false
+167: false
+168: false
+169: false
+170: false
+171: false
+172: false
+173: false
+174: false
+175: false
+176: false
+177: false
+178: false
+179: false
+180: false
+181: false
+182: false
+183: false
+184: false
+185: false
+186: false
+187: false
+188: false
+189: false
+190: false
+191: false
+192: false
+193: false
+194: false
+195: false
+196: false
+197: false
+198: false
+199: false
+200: false
+201: false
+202: false
+203: false
+204: false
+205: false
+206: false
+207: false
+208: false
+209: false
+210: false
+211: false
+212: false
+213: false
+214: false
+215: false
+216: false
+217: false
+218: false
+219: false
+220: false
+221: false
+222: false
+223: false
+224: false
+225: false
+226: false
+227: false
+228: false
+229: false
+230: false
+231: false
+232: false
+233: false
+234: false
+235: false
+236: false
+237: false
+238: false
+239: false
+240: false
+241: false
+242: false
+243: false
+244: false
+245: false
+246: false
+247: false
+248: false
+249: false
+250: false
+251: false
+252: false
+253: false
+254: false
+255: false
diff --git a/test/trace/prototype-recursion-addProperty.as b/test/trace/prototype-recursion-addProperty.as
new file mode 100644
index 0000000..7dca46c
--- /dev/null
+++ b/test/trace/prototype-recursion-addProperty.as
@@ -0,0 +1,14 @@
+// makeswf -v 7 -s 200x150 -r 1 -o prototype-recursion-addProperty.swf prototype-recursion-addProperty.as
+
+o = new Object ();
+o.addProperty ("x", function () {}, null);
+for (i = 0; ; i++) {
+  p = new Object ();
+  p.hasOwnProperty = o.hasOwnProperty;
+  p.__proto__ = o;
+  o = p;
+  o.x = 42;
+  trace (i + ": " + o.hasOwnProperty ("x"));
+};
+
+loadMovie ("FSCommand:quit", "");
diff-tree 8d2edb296c1de14bd6253c577697614d641f4376 (from 6435df904ac7e33242ad031d2a4dc7bc4caeb213)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 3 12:04:06 2007 +0200

    getting seems to handle one step more than setting

diff --git a/libswfdec/swfdec_as_object.c b/libswfdec/swfdec_as_object.c
index 91f4b96..35b3b2b 100644
--- a/libswfdec/swfdec_as_object.c
+++ b/libswfdec/swfdec_as_object.c
@@ -33,7 +33,7 @@
 #include "swfdec_debug.h"
 #include "swfdec_movie.h"
 
-#define SWFDEC_AS_OBJECT_PROTOTYPE_RECURSION_LIMIT 257
+#define SWFDEC_AS_OBJECT_PROTOTYPE_RECURSION_LIMIT 256
 
 /**
  * SECTION:SwfdecAsObject
@@ -661,7 +661,7 @@ swfdec_as_object_get_variable_and_flags 
     pobject = &tmp_pobject;
 
   cur = object;
-  for (i = 0; i < SWFDEC_AS_OBJECT_PROTOTYPE_RECURSION_LIMIT && cur != NULL; i++) {
+  for (i = 0; i <= SWFDEC_AS_OBJECT_PROTOTYPE_RECURSION_LIMIT && cur != NULL; i++) {
     klass = SWFDEC_AS_OBJECT_GET_CLASS (cur);
     if (klass->get (cur, object, variable, value, flags)) {
       *pobject = cur;
@@ -669,7 +669,7 @@ swfdec_as_object_get_variable_and_flags 
     }
     cur = cur->prototype;
   }
-  if (i == SWFDEC_AS_OBJECT_PROTOTYPE_RECURSION_LIMIT) {
+  if (i > SWFDEC_AS_OBJECT_PROTOTYPE_RECURSION_LIMIT) {
     swfdec_as_context_abort (object->context, "Prototype recursion limit exceeded");
     *flags = 0;
     *pobject = NULL;
diff-tree 6435df904ac7e33242ad031d2a4dc7bc4caeb213 (from 5d2a00fc0c22c79f793232704c069fca8a757f5e)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 3 11:39:31 2007 +0200

    set recursion limit to correct value

diff --git a/libswfdec/swfdec_as_object.c b/libswfdec/swfdec_as_object.c
index 78738ed..91f4b96 100644
--- a/libswfdec/swfdec_as_object.c
+++ b/libswfdec/swfdec_as_object.c
@@ -33,7 +33,7 @@
 #include "swfdec_debug.h"
 #include "swfdec_movie.h"
 
-#define SWFDEC_AS_OBJECT_PROTOTYPE_RECURSION_LIMIT 256
+#define SWFDEC_AS_OBJECT_PROTOTYPE_RECURSION_LIMIT 257
 
 /**
  * SECTION:SwfdecAsObject
diff-tree 5d2a00fc0c22c79f793232704c069fca8a757f5e (from 78f402b9eaa838fdf3a5e974fbeb0f7db90ada9e)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 3 11:37:16 2007 +0200

    replace recusrion limit by a macro

diff --git a/libswfdec/swfdec_as_object.c b/libswfdec/swfdec_as_object.c
index 28a1dd7..78738ed 100644
--- a/libswfdec/swfdec_as_object.c
+++ b/libswfdec/swfdec_as_object.c
@@ -33,6 +33,8 @@
 #include "swfdec_debug.h"
 #include "swfdec_movie.h"
 
+#define SWFDEC_AS_OBJECT_PROTOTYPE_RECURSION_LIMIT 256
+
 /**
  * SECTION:SwfdecAsObject
  * @title: SwfdecAsObject
@@ -245,14 +247,14 @@ swfdec_as_object_do_set (SwfdecAsObject 
     guint i;
     SwfdecAsObject *proto = object->prototype;
 
-    for (i = 0; i < 256 && proto; i++) {
+    for (i = 0; i < SWFDEC_AS_OBJECT_PROTOTYPE_RECURSION_LIMIT && proto; i++) {
       var = swfdec_as_object_hash_lookup (proto, variable);
       if (var && var->get)
 	break;
       proto = proto->prototype;
       var = NULL;
     }
-    if (i == 256) {
+    if (i == SWFDEC_AS_OBJECT_PROTOTYPE_RECURSION_LIMIT) {
       swfdec_as_context_abort (object->context, "Prototype recursion limit exceeded");
       return;
     }
@@ -659,7 +661,7 @@ swfdec_as_object_get_variable_and_flags 
     pobject = &tmp_pobject;
 
   cur = object;
-  for (i = 0; i < 256 && cur != NULL; i++) {
+  for (i = 0; i < SWFDEC_AS_OBJECT_PROTOTYPE_RECURSION_LIMIT && cur != NULL; i++) {
     klass = SWFDEC_AS_OBJECT_GET_CLASS (cur);
     if (klass->get (cur, object, variable, value, flags)) {
       *pobject = cur;
@@ -667,7 +669,7 @@ swfdec_as_object_get_variable_and_flags 
     }
     cur = cur->prototype;
   }
-  if (i == 256) {
+  if (i == SWFDEC_AS_OBJECT_PROTOTYPE_RECURSION_LIMIT) {
     swfdec_as_context_abort (object->context, "Prototype recursion limit exceeded");
     *flags = 0;
     *pobject = NULL;
diff-tree 78f402b9eaa838fdf3a5e974fbeb0f7db90ada9e (from 9684f33a680b7c3d667e1cdf21a1006f017b02cd)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 3 11:03:58 2007 +0200

    add test for just committed fix

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index 484da67..e0e5a92 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -297,6 +297,9 @@ EXTRA_DIST = \
 	constructor-prototype.swf.trace \
 	countdown.swf \
 	countdown.swf.trace \
+	crash-0.5.2-new-netstream.as \
+	crash-0.5.2-new-netstream.swf \
+	crash-0.5.2-new-netstream.swf.trace \
 	crash-0.5.2-startdrag.as \
 	crash-0.5.2-startdrag.swf \
 	crash-0.5.2-startdrag.swf.trace \
diff --git a/test/trace/crash-0.5.2-new-netstream.as b/test/trace/crash-0.5.2-new-netstream.as
new file mode 100644
index 0000000..24e3bac
--- /dev/null
+++ b/test/trace/crash-0.5.2-new-netstream.as
@@ -0,0 +1,5 @@
+// makeswf -v 7 -s 200x150 -r 1 -o crash-0.5.2-new-netstream.swf crash-0.5.2-new-netstream.as
+
+ns = new NetStream ();
+
+loadMovie ("FSCommand:quit", "");
diff --git a/test/trace/crash-0.5.2-new-netstream.swf b/test/trace/crash-0.5.2-new-netstream.swf
new file mode 100644
index 0000000..ff6d48e
Binary files /dev/null and b/test/trace/crash-0.5.2-new-netstream.swf differ
diff --git a/test/trace/crash-0.5.2-new-netstream.swf.trace b/test/trace/crash-0.5.2-new-netstream.swf.trace
new file mode 100644
index 0000000..e69de29
diff-tree 9684f33a680b7c3d667e1cdf21a1006f017b02cd (from 4acbe7aea3a7190a3c59bc993285ea14ef1b073b)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 3 10:52:37 2007 +0200

    Fix SEGV in GC when a NetStream object was constructed without connection

diff --git a/libswfdec/swfdec_net_stream.c b/libswfdec/swfdec_net_stream.c
index fac0886..ecec037 100644
--- a/libswfdec/swfdec_net_stream.c
+++ b/libswfdec/swfdec_net_stream.c
@@ -402,7 +402,8 @@ swfdec_net_stream_mark (SwfdecAsObject *
 {
   SwfdecNetStream *stream = SWFDEC_NET_STREAM (object);
 
-  swfdec_as_object_mark (SWFDEC_AS_OBJECT (stream->conn));
+  if (stream->conn)
+    swfdec_as_object_mark (SWFDEC_AS_OBJECT (stream->conn));
 
   SWFDEC_AS_OBJECT_CLASS (swfdec_net_stream_parent_class)->mark (object);
 }
diff-tree 4acbe7aea3a7190a3c59bc993285ea14ef1b073b (from aa5947ee972f285b59556ab8888081addd458bfe)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 3 10:46:41 2007 +0200

    add startup script for AS code
    
    This works the same way as the normal init script in swfdec_initialize.as.
    The only difference is that this script is for the stuff that should be in
    SwfdecAsContext as opposed to the old one that was only for stuff that should
    end up in SwfdecPlayer, but not in SwfdecAsContext.
    
    This patch alse makes Number use that script as a proof-of-concept and bugfix.

diff --git a/libswfdec/Makefile.am b/libswfdec/Makefile.am
index d1b3d95..17c524d 100644
--- a/libswfdec/Makefile.am
+++ b/libswfdec/Makefile.am
@@ -155,6 +155,7 @@ noinst_HEADERS = \
 	swfdec_as_array.h \
 	swfdec_as_boolean.h \
 	swfdec_as_frame_internal.h \
+	swfdec_as_initialize.h \
 	swfdec_as_internal.h \
 	swfdec_as_interpret.h \
 	swfdec_as_math.h \
@@ -227,6 +228,7 @@ noinst_HEADERS = \
 
 EXTRA_DIST = \
 	compiler.c \
+	swfdec_as_initialize.as \
 	swfdec_initialize.as \
 	swfdec_marshal.list
 
diff --git a/libswfdec/swfdec_as_context.c b/libswfdec/swfdec_as_context.c
index 9c4254c..3b0ec12 100644
--- a/libswfdec/swfdec_as_context.c
+++ b/libswfdec/swfdec_as_context.c
@@ -28,11 +28,11 @@
 #include "swfdec_as_boolean.h"
 #include "swfdec_as_frame_internal.h"
 #include "swfdec_as_function.h"
+#include "swfdec_as_initialize.h"
 #include "swfdec_as_internal.h"
 #include "swfdec_as_interpret.h"
 #include "swfdec_as_math.h"
 #include "swfdec_as_native_function.h"
-#include "swfdec_as_number.h"
 #include "swfdec_as_object.h"
 #include "swfdec_as_stack.h"
 #include "swfdec_as_string.h"
@@ -1181,6 +1181,27 @@ swfdec_as_context_init_global (SwfdecAsC
       swfdec_as_context_parseInt, 1);
 }
 
+void
+swfdec_as_context_run_init_script (SwfdecAsContext *context, const guint8 *data, gsize length)
+{
+  g_return_if_fail (SWFDEC_IS_AS_CONTEXT (context));
+  g_return_if_fail (data != NULL);
+  g_return_if_fail (length > 0);
+
+  if (context->version > 4) {
+    SwfdecBits bits;
+    SwfdecScript *script;
+    swfdec_bits_init_data (&bits, data, length);
+    script = swfdec_script_new_from_bits (&bits, "init", context->version);
+    if (script == NULL) {
+      g_warning ("script passed to swfdec_as_context_run_init_script is invalid");
+      return;
+    }
+    swfdec_as_object_run (context->global, script);
+    swfdec_script_unref (script);
+  }
+}
+
 /**
  * swfdec_as_context_startup:
  * @context: a #SwfdecAsContext
@@ -1207,11 +1228,13 @@ swfdec_as_context_startup (SwfdecAsConte
   swfdec_as_array_init_context (context, version);
   /* define the type objects */
   swfdec_as_boolean_init_context (context, version);
-  swfdec_as_number_init_context (context, version);
   swfdec_as_string_init_context (context, version);
   /* define the rest */
   swfdec_as_math_init_context (context, version);
 
+  /* run init script */
+  swfdec_as_context_run_init_script (context, swfdec_as_initialize, sizeof (swfdec_as_initialize));
+
   if (context->state == SWFDEC_AS_CONTEXT_NEW)
     context->state = SWFDEC_AS_CONTEXT_RUNNING;
 }
diff --git a/libswfdec/swfdec_as_initialize.as b/libswfdec/swfdec_as_initialize.as
new file mode 100644
index 0000000..4085c91
--- /dev/null
+++ b/libswfdec/swfdec_as_initialize.as
@@ -0,0 +1,35 @@
+/* Swfdec
+ * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+ * Boston, MA  02110-1301  USA
+ */
+
+/*** GENERAL ***/
+
+ASSetNative = ASnative (4, 0);
+ASSetNativeAccessor = ASnative (4, 1);
+
+/*** BASE OBJECTS ***/
+
+Number = ASconstructor (106, 2);
+ASSetNative (Number.prototype, 106, "valueOf,toString");
+ASSetPropFlags(Number.prototype, null, 3);
+Number.NaN = NaN;
+Number.POSITIVE_INFINITY = Infinity;
+Number.NEGATIVE_INFINITY = -Infinity;
+Number.MIN_VALUE = 0;
+Number.MAX_VALUE = 1.79769313486231e+308;
+ASSetPropFlags(Number, null, 7);
diff --git a/libswfdec/swfdec_as_initialize.h b/libswfdec/swfdec_as_initialize.h
new file mode 100644
index 0000000..64fd129
--- /dev/null
+++ b/libswfdec/swfdec_as_initialize.h
@@ -0,0 +1,33 @@
+/* This file is autogenerated, do not edit! */
+
+/* compiled from swfdec_as_initialize.as */
+const unsigned char swfdec_as_initialize[] = {
+  0x88, 0xAF, 0x00, 0x0E,  0x00, 0x41, 0x53, 0x53,  0x65, 0x74, 0x4E, 0x61,  0x74, 0x69, 0x76, 0x65,
+  0x00, 0x41, 0x53, 0x6E,  0x61, 0x74, 0x69, 0x76,  0x65, 0x00, 0x41, 0x53,  0x53, 0x65, 0x74, 0x4E,
+  0x61, 0x74, 0x69, 0x76,  0x65, 0x41, 0x63, 0x63,  0x65, 0x73, 0x73, 0x6F,  0x72, 0x00, 0x4E, 0x75,
+  0x6D, 0x62, 0x65, 0x72,  0x00, 0x41, 0x53, 0x63,  0x6F, 0x6E, 0x73, 0x74,  0x72, 0x75, 0x63, 0x74,
+  0x6F, 0x72, 0x00, 0x70,  0x72, 0x6F, 0x74, 0x6F,  0x74, 0x79, 0x70, 0x65,  0x00, 0x76, 0x61, 0x6C,
+  0x75, 0x65, 0x4F, 0x66,  0x2C, 0x74, 0x6F, 0x53,  0x74, 0x72, 0x69, 0x6E,  0x67, 0x00, 0x41, 0x53,
+  0x53, 0x65, 0x74, 0x50,  0x72, 0x6F, 0x70, 0x46,  0x6C, 0x61, 0x67, 0x73,  0x00, 0x4E, 0x61, 0x4E,
+  0x00, 0x50, 0x4F, 0x53,  0x49, 0x54, 0x49, 0x56,  0x45, 0x5F, 0x49, 0x4E,  0x46, 0x49, 0x4E, 0x49,
+  0x54, 0x59, 0x00, 0x49,  0x6E, 0x66, 0x69, 0x6E,  0x69, 0x74, 0x79, 0x00,  0x4E, 0x45, 0x47, 0x41,
+  0x54, 0x49, 0x56, 0x45,  0x5F, 0x49, 0x4E, 0x46,  0x49, 0x4E, 0x49, 0x54,  0x59, 0x00, 0x4D, 0x49,
+  0x4E, 0x5F, 0x56, 0x41,  0x4C, 0x55, 0x45, 0x00,  0x4D, 0x41, 0x58, 0x5F,  0x56, 0x41, 0x4C, 0x55,
+  0x45, 0x00, 0x96, 0x13,  0x00, 0x08, 0x00, 0x07,  0x00, 0x00, 0x00, 0x00,  0x07, 0x04, 0x00, 0x00,
+  0x00, 0x07, 0x02, 0x00,  0x00, 0x00, 0x08, 0x01,  0x3D, 0x1D, 0x96, 0x13,  0x00, 0x08, 0x02, 0x07,
+  0x01, 0x00, 0x00, 0x00,  0x07, 0x04, 0x00, 0x00,  0x00, 0x07, 0x02, 0x00,  0x00, 0x00, 0x08, 0x01,
+  0x3D, 0x1D, 0x96, 0x13,  0x00, 0x08, 0x03, 0x07,  0x02, 0x00, 0x00, 0x00,  0x07, 0x6A, 0x00, 0x00,
+  0x00, 0x07, 0x02, 0x00,  0x00, 0x00, 0x08, 0x04,  0x3D, 0x1D, 0x96, 0x09,  0x00, 0x08, 0x06, 0x07,
+  0x6A, 0x00, 0x00, 0x00,  0x08, 0x03, 0x1C, 0x96,  0x02, 0x00, 0x08, 0x05,  0x4E, 0x96, 0x07, 0x00,
+  0x07, 0x03, 0x00, 0x00,  0x00, 0x08, 0x00, 0x3D,  0x17, 0x96, 0x08, 0x00,  0x07, 0x03, 0x00, 0x00,
+  0x00, 0x02, 0x08, 0x03,  0x1C, 0x96, 0x02, 0x00,  0x08, 0x05, 0x4E, 0x96,  0x07, 0x00, 0x07, 0x03,
+  0x00, 0x00, 0x00, 0x08,  0x07, 0x3D, 0x17, 0x96,  0x02, 0x00, 0x08, 0x03,  0x1C, 0x96, 0x04, 0x00,
+  0x08, 0x08, 0x08, 0x08,  0x1C, 0x4F, 0x96, 0x02,  0x00, 0x08, 0x03, 0x1C,  0x96, 0x04, 0x00, 0x08,
+  0x09, 0x08, 0x0A, 0x1C,  0x4F, 0x96, 0x02, 0x00,  0x08, 0x03, 0x1C, 0x96,  0x04, 0x00, 0x08, 0x0B,
+  0x08, 0x0A, 0x1C, 0x96,  0x05, 0x00, 0x07, 0xFF,  0xFF, 0xFF, 0xFF, 0x0C,  0x4F, 0x96, 0x02, 0x00,
+  0x08, 0x03, 0x1C, 0x96,  0x07, 0x00, 0x08, 0x0C,  0x07, 0x00, 0x00, 0x00,  0x00, 0x4F, 0x96, 0x02,
+  0x00, 0x08, 0x03, 0x1C,  0x96, 0x0B, 0x00, 0x08,  0x0D, 0x06, 0xFF, 0xFF,  0xEF, 0x7F, 0xE2, 0xFF,
+  0xFF, 0xFF, 0x4F, 0x96,  0x08, 0x00, 0x07, 0x07,  0x00, 0x00, 0x00, 0x02,  0x08, 0x03, 0x1C, 0x96,
+  0x07, 0x00, 0x07, 0x03,  0x00, 0x00, 0x00, 0x08,  0x07, 0x3D, 0x17, 0x00
+};
+
diff --git a/libswfdec/swfdec_as_internal.h b/libswfdec/swfdec_as_internal.h
index 69db628..e64bc44 100644
--- a/libswfdec/swfdec_as_internal.h
+++ b/libswfdec/swfdec_as_internal.h
@@ -38,6 +38,11 @@ void		swfdec_as_function_set_constructor
 void		swfdec_as_function_init_context (SwfdecAsContext *	context,
 						 guint			version);
 
+/* swfdec_as_context.c */
+void		swfdec_as_context_run_init_script (SwfdecAsContext *	context,
+						 const guint8 *		data,
+						 gsize			length);
+
 /* swfdec_as_object.c */
 typedef SwfdecAsVariableForeach SwfdecAsVariableForeachRemove;
 typedef const char *(* SwfdecAsVariableForeachRename) (SwfdecAsObject *object, 
diff --git a/libswfdec/swfdec_as_number.c b/libswfdec/swfdec_as_number.c
index 8a44733..f047165 100644
--- a/libswfdec/swfdec_as_number.c
+++ b/libswfdec/swfdec_as_number.c
@@ -72,10 +72,14 @@ void
 swfdec_as_number_toString (SwfdecAsContext *cx, SwfdecAsObject *object,
     guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
 {
-  SwfdecAsNumber *num = SWFDEC_AS_NUMBER (object);
+  SwfdecAsNumber *num;
   SwfdecAsValue val;
   const char *s;
   
+  if (!SWFDEC_IS_AS_NUMBER (object))
+    return;
+
+  num = SWFDEC_AS_NUMBER (object);
   if (argc > 0) {
     SWFDEC_FIXME ("radix is not yet implemented");
   }
@@ -89,58 +93,12 @@ void
 swfdec_as_number_valueOf (SwfdecAsContext *cx, SwfdecAsObject *object,
     guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
 {
-  SwfdecAsNumber *num = SWFDEC_AS_NUMBER (object);
+  SwfdecAsNumber *num;
 
-  SWFDEC_AS_VALUE_SET_NUMBER (ret, num->number);
-}
-
-void
-swfdec_as_number_init_context (SwfdecAsContext *context, guint version)
-{
-  SwfdecAsObject *number, *proto;
-  SwfdecAsValue val;
-
-  g_return_if_fail (SWFDEC_IS_AS_CONTEXT (context));
-
-  proto = swfdec_as_object_new_empty (context);
-  if (proto == NULL)
+  if (!SWFDEC_IS_AS_NUMBER (object))
     return;
-  number = SWFDEC_AS_OBJECT (swfdec_as_object_add_constructor (context->global,
-      SWFDEC_AS_STR_Number, 0, SWFDEC_TYPE_AS_NUMBER, 
-      swfdec_as_number_construct, 0, proto));
-  if (!number)
-    return;
-  /* set the right properties on the Number object */
-  SWFDEC_AS_VALUE_SET_NUMBER (&val, NAN);
-  swfdec_as_object_set_variable_and_flags (number, SWFDEC_AS_STR_NaN, &val,
-      SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT |
-      SWFDEC_AS_VARIABLE_CONSTANT);
-  SWFDEC_AS_VALUE_SET_NUMBER (&val, G_MAXDOUBLE);
-  swfdec_as_object_set_variable_and_flags (number, SWFDEC_AS_STR_MAX_VALUE,
-      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT |
-      SWFDEC_AS_VARIABLE_CONSTANT);
-  SWFDEC_AS_VALUE_SET_NUMBER (&val, G_MINDOUBLE);
-  swfdec_as_object_set_variable_and_flags (number, SWFDEC_AS_STR_MIN_VALUE,
-      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT |
-      SWFDEC_AS_VARIABLE_CONSTANT);
-  SWFDEC_AS_VALUE_SET_NUMBER (&val, -HUGE_VAL);
-  swfdec_as_object_set_variable_and_flags (number,
-      SWFDEC_AS_STR_NEGATIVE_INFINITY, &val, SWFDEC_AS_VARIABLE_HIDDEN |
-      SWFDEC_AS_VARIABLE_PERMANENT | SWFDEC_AS_VARIABLE_CONSTANT);
-  SWFDEC_AS_VALUE_SET_NUMBER (&val, HUGE_VAL);
-  swfdec_as_object_set_variable_and_flags (number,
-      SWFDEC_AS_STR_POSITIVE_INFINITY, &val, SWFDEC_AS_VARIABLE_HIDDEN |
-      SWFDEC_AS_VARIABLE_PERMANENT | SWFDEC_AS_VARIABLE_CONSTANT);
-  /* set the right properties on the Number.prototype object */
-  SWFDEC_AS_VALUE_SET_OBJECT (&val, number);
-  swfdec_as_object_set_variable_and_flags (proto, SWFDEC_AS_STR_constructor,
-      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT |
-      SWFDEC_AS_VARIABLE_CONSTANT);
-  swfdec_as_object_add_function (proto, SWFDEC_AS_STR_toString, SWFDEC_TYPE_AS_NUMBER, swfdec_as_number_toString, 0);
-  swfdec_as_object_add_function (proto, SWFDEC_AS_STR_valueOf, SWFDEC_TYPE_AS_NUMBER, swfdec_as_number_valueOf, 0);
-  SWFDEC_AS_VALUE_SET_OBJECT (&val, context->Object_prototype);
-  swfdec_as_object_set_variable_and_flags (proto, SWFDEC_AS_STR___proto__, &val,
-      SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT |
-      SWFDEC_AS_VARIABLE_CONSTANT);
+
+  num = SWFDEC_AS_NUMBER (object);
+  SWFDEC_AS_VALUE_SET_NUMBER (ret, num->number);
 }
 
diff --git a/libswfdec/swfdec_as_number.h b/libswfdec/swfdec_as_number.h
index 52a1fd9..9b6ede0 100644
--- a/libswfdec/swfdec_as_number.h
+++ b/libswfdec/swfdec_as_number.h
@@ -47,9 +47,6 @@ struct _SwfdecAsNumberClass {
 
 GType		swfdec_as_number_get_type	(void);
 
-void		swfdec_as_number_init_context	(SwfdecAsContext *	context,
-						 guint			version);
-
 
 G_END_DECLS
 #endif


More information about the Swfdec mailing list