Benjamin Otte
2007-Sep-13 18:46 UTC
[Swfdec] 2 commits - libswfdec/swfdec_as_function.c test/trace
libswfdec/swfdec_as_function.c | 9 test/trace/Makefile.am | 117 ++++++++++ test/trace/scope-chain-did-you-understand-5.swf |binary test/trace/scope-chain-did-you-understand-5.swf.trace | 1 test/trace/scope-chain-did-you-understand-6.swf |binary test/trace/scope-chain-did-you-understand-6.swf.trace | 1 test/trace/scope-chain-did-you-understand-7.swf |binary test/trace/scope-chain-did-you-understand-7.swf.trace | 1 test/trace/scope-chain-did-you-understand-8.swf |binary test/trace/scope-chain-did-you-understand-8.swf.trace | 1 test/trace/scope-chain-did-you-understand.as | 23 + test/trace/scope-chain-function-and-5.swf |binary test/trace/scope-chain-function-and-5.swf.trace | 2 test/trace/scope-chain-function-and-6.swf |binary test/trace/scope-chain-function-and-6.swf.trace | 2 test/trace/scope-chain-function-and-7.swf |binary test/trace/scope-chain-function-and-7.swf.trace | 2 test/trace/scope-chain-function-and-8.swf |binary test/trace/scope-chain-function-and-8.swf.trace | 2 test/trace/scope-chain-function-and.as | 16 + test/trace/scope-chain-how-are-variables-assigned-2-5.swf |binary test/trace/scope-chain-how-are-variables-assigned-2-5.swf.trace | 4 test/trace/scope-chain-how-are-variables-assigned-2-6.swf |binary test/trace/scope-chain-how-are-variables-assigned-2-6.swf.trace | 4 test/trace/scope-chain-how-are-variables-assigned-2-7.swf |binary test/trace/scope-chain-how-are-variables-assigned-2-7.swf.trace | 4 test/trace/scope-chain-how-are-variables-assigned-2-8.swf |binary test/trace/scope-chain-how-are-variables-assigned-2-8.swf.trace | 4 test/trace/scope-chain-how-are-variables-assigned-2.as | 16 + test/trace/scope-chain-how-are-variables-assigned-3-5.swf |binary test/trace/scope-chain-how-are-variables-assigned-3-5.swf.trace | 4 test/trace/scope-chain-how-are-variables-assigned-3-6.swf |binary test/trace/scope-chain-how-are-variables-assigned-3-6.swf.trace | 4 test/trace/scope-chain-how-are-variables-assigned-3-7.swf |binary test/trace/scope-chain-how-are-variables-assigned-3-7.swf.trace | 4 test/trace/scope-chain-how-are-variables-assigned-3-8.swf |binary test/trace/scope-chain-how-are-variables-assigned-3-8.swf.trace | 4 test/trace/scope-chain-how-are-variables-assigned-3.as | 17 + test/trace/scope-chain-how-are-variables-assigned-5.swf |binary test/trace/scope-chain-how-are-variables-assigned-5.swf.trace | 4 test/trace/scope-chain-how-are-variables-assigned-6.swf |binary test/trace/scope-chain-how-are-variables-assigned-6.swf.trace | 4 test/trace/scope-chain-how-are-variables-assigned-7.swf |binary test/trace/scope-chain-how-are-variables-assigned-7.swf.trace | 4 test/trace/scope-chain-how-are-variables-assigned-8.swf |binary test/trace/scope-chain-how-are-variables-assigned-8.swf.trace | 4 test/trace/scope-chain-how-are-variables-assigned.as | 16 + test/trace/scope-chain-just-how-deep-5.swf |binary test/trace/scope-chain-just-how-deep-5.swf.trace | 6 test/trace/scope-chain-just-how-deep-6.swf |binary test/trace/scope-chain-just-how-deep-6.swf.trace | 6 test/trace/scope-chain-just-how-deep-7.swf |binary test/trace/scope-chain-just-how-deep-7.swf.trace | 6 test/trace/scope-chain-just-how-deep-8.swf |binary test/trace/scope-chain-just-how-deep-8.swf.trace | 6 test/trace/scope-chain-just-how-deep.as | 33 ++ test/trace/scope-chain-on-activation-object-persistance-5.swf |binary test/trace/scope-chain-on-activation-object-persistance-5.swf.trace | 3 test/trace/scope-chain-on-activation-object-persistance-6.swf |binary test/trace/scope-chain-on-activation-object-persistance-6.swf.trace | 3 test/trace/scope-chain-on-activation-object-persistance-7.swf |binary test/trace/scope-chain-on-activation-object-persistance-7.swf.trace | 3 test/trace/scope-chain-on-activation-object-persistance-8.swf |binary test/trace/scope-chain-on-activation-object-persistance-8.swf.trace | 3 test/trace/scope-chain-on-activation-object-persistance.as | 18 + test/trace/scope-chain-on-duplication-5.swf |binary test/trace/scope-chain-on-duplication-5.swf.trace | 4 test/trace/scope-chain-on-duplication-6.swf |binary test/trace/scope-chain-on-duplication-6.swf.trace | 4 test/trace/scope-chain-on-duplication-7.swf |binary test/trace/scope-chain-on-duplication-7.swf.trace | 4 test/trace/scope-chain-on-duplication-8.swf |binary test/trace/scope-chain-on-duplication-8.swf.trace | 4 test/trace/scope-chain-on-duplication.as | 25 ++ test/trace/scope-chain-scope-and-prototype-chain-5.swf |binary test/trace/scope-chain-scope-and-prototype-chain-5.swf.trace | 1 test/trace/scope-chain-scope-and-prototype-chain-6.swf |binary test/trace/scope-chain-scope-and-prototype-chain-6.swf.trace | 1 test/trace/scope-chain-scope-and-prototype-chain-7.swf |binary test/trace/scope-chain-scope-and-prototype-chain-7.swf.trace | 1 test/trace/scope-chain-scope-and-prototype-chain-8.swf |binary test/trace/scope-chain-scope-and-prototype-chain-8.swf.trace | 1 test/trace/scope-chain-scope-and-prototype-chain.as | 16 + test/trace/scope-chain-this-2-5.swf |binary test/trace/scope-chain-this-2-5.swf.trace | 1 test/trace/scope-chain-this-2-6.swf |binary test/trace/scope-chain-this-2-6.swf.trace | 1 test/trace/scope-chain-this-2-7.swf |binary test/trace/scope-chain-this-2-7.swf.trace | 1 test/trace/scope-chain-this-2-8.swf |binary test/trace/scope-chain-this-2-8.swf.trace | 1 test/trace/scope-chain-this-2.as | 14 + test/trace/scope-chain-this-5.swf |binary test/trace/scope-chain-this-5.swf.trace | 2 test/trace/scope-chain-this-6.swf |binary test/trace/scope-chain-this-6.swf.trace | 2 test/trace/scope-chain-this-7.swf |binary test/trace/scope-chain-this-7.swf.trace | 2 test/trace/scope-chain-this-8.swf |binary test/trace/scope-chain-this-8.swf.trace | 2 test/trace/scope-chain-this.as | 20 + test/trace/scope-chain-what-is-5.swf |binary test/trace/scope-chain-what-is-5.swf.trace | 3 test/trace/scope-chain-what-is-6.swf |binary test/trace/scope-chain-what-is-6.swf.trace | 3 test/trace/scope-chain-what-is-7.swf |binary test/trace/scope-chain-what-is-7.swf.trace | 3 test/trace/scope-chain-what-is-8.swf |binary test/trace/scope-chain-what-is-8.swf.trace | 3 test/trace/scope-chain-what-is.as | 16 + test/trace/scope-chain-with-and-scope-chain-5.swf |binary test/trace/scope-chain-with-and-scope-chain-5.swf.trace | 2 test/trace/scope-chain-with-and-scope-chain-6.swf |binary test/trace/scope-chain-with-and-scope-chain-6.swf.trace | 2 test/trace/scope-chain-with-and-scope-chain-7.swf |binary test/trace/scope-chain-with-and-scope-chain-7.swf.trace | 2 test/trace/scope-chain-with-and-scope-chain-8.swf |binary test/trace/scope-chain-with-and-scope-chain-8.swf.trace | 2 test/trace/scope-chain-with-and-scope-chain.as | 14 + 119 files changed, 513 insertions(+), 5 deletions(-) New commits: diff-tree 9c4a5df4d39d861247676283426891e29bfe9fe2 (from 87e4fa70d0d8cb93ec124fe97e5781794a8a2d7e) Author: Benjamin Otte <otte at gnome.org> Date: Thu Sep 13 20:45:51 2007 +0200 add tests from http://www.timotheegroleau.com/Flash/articles/scope_chain.htm diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am index fb81cde..eb8a89a 100644 --- a/test/trace/Makefile.am +++ b/test/trace/Makefile.am @@ -1145,6 +1145,123 @@ EXTRA_DIST = \ scope.swf.trace \ scope2.swf \ scope2.swf.trace \ + scope-chain-did-you-understand.as \ + scope-chain-did-you-understand-5.swf \ + scope-chain-did-you-understand-5.swf.trace \ + scope-chain-did-you-understand-6.swf \ + scope-chain-did-you-understand-6.swf.trace \ + scope-chain-did-you-understand-7.swf \ + scope-chain-did-you-understand-7.swf.trace \ + scope-chain-did-you-understand-8.swf \ + scope-chain-did-you-understand-8.swf.trace \ + scope-chain-function-and.as \ + scope-chain-function-and-5.swf \ + scope-chain-function-and-5.swf.trace \ + scope-chain-function-and-6.swf \ + scope-chain-function-and-6.swf.trace \ + scope-chain-function-and-7.swf \ + scope-chain-function-and-7.swf.trace \ + scope-chain-function-and-8.swf \ + scope-chain-function-and-8.swf.trace \ + scope-chain-how-are-variables-assigned.as \ + scope-chain-how-are-variables-assigned-5.swf \ + scope-chain-how-are-variables-assigned-5.swf.trace \ + scope-chain-how-are-variables-assigned-6.swf \ + scope-chain-how-are-variables-assigned-6.swf.trace \ + scope-chain-how-are-variables-assigned-7.swf \ + scope-chain-how-are-variables-assigned-7.swf.trace \ + scope-chain-how-are-variables-assigned-8.swf \ + scope-chain-how-are-variables-assigned-8.swf.trace \ + scope-chain-how-are-variables-assigned-2.as \ + scope-chain-how-are-variables-assigned-2-5.swf \ + scope-chain-how-are-variables-assigned-2-5.swf.trace \ + scope-chain-how-are-variables-assigned-2-6.swf \ + scope-chain-how-are-variables-assigned-2-6.swf.trace \ + scope-chain-how-are-variables-assigned-2-7.swf \ + scope-chain-how-are-variables-assigned-2-7.swf.trace \ + scope-chain-how-are-variables-assigned-2-8.swf \ + scope-chain-how-are-variables-assigned-2-8.swf.trace \ + scope-chain-how-are-variables-assigned-3.as \ + scope-chain-how-are-variables-assigned-3-5.swf \ + scope-chain-how-are-variables-assigned-3-5.swf.trace \ + scope-chain-how-are-variables-assigned-3-6.swf \ + scope-chain-how-are-variables-assigned-3-6.swf.trace \ + scope-chain-how-are-variables-assigned-3-7.swf \ + scope-chain-how-are-variables-assigned-3-7.swf.trace \ + scope-chain-how-are-variables-assigned-3-8.swf \ + scope-chain-how-are-variables-assigned-3-8.swf.trace \ + scope-chain-just-how-deep.as \ + scope-chain-just-how-deep-5.swf \ + scope-chain-just-how-deep-5.swf.trace \ + scope-chain-just-how-deep-6.swf \ + scope-chain-just-how-deep-6.swf.trace \ + scope-chain-just-how-deep-7.swf \ + scope-chain-just-how-deep-7.swf.trace \ + scope-chain-just-how-deep-8.swf \ + scope-chain-just-how-deep-8.swf.trace \ + scope-chain-on-activation-object-persistance.as \ + scope-chain-on-activation-object-persistance-5.swf \ + scope-chain-on-activation-object-persistance-5.swf.trace \ + scope-chain-on-activation-object-persistance-6.swf \ + scope-chain-on-activation-object-persistance-6.swf.trace \ + scope-chain-on-activation-object-persistance-7.swf \ + scope-chain-on-activation-object-persistance-7.swf.trace \ + scope-chain-on-activation-object-persistance-8.swf \ + scope-chain-on-activation-object-persistance-8.swf.trace \ + scope-chain-on-duplication.as \ + scope-chain-on-duplication-5.swf \ + scope-chain-on-duplication-5.swf.trace \ + scope-chain-on-duplication-6.swf \ + scope-chain-on-duplication-6.swf.trace \ + scope-chain-on-duplication-7.swf \ + scope-chain-on-duplication-7.swf.trace \ + scope-chain-on-duplication-8.swf \ + scope-chain-on-duplication-8.swf.trace \ + scope-chain-scope-and-prototype-chain.as \ + scope-chain-scope-and-prototype-chain-5.swf \ + scope-chain-scope-and-prototype-chain-5.swf.trace \ + scope-chain-scope-and-prototype-chain-6.swf \ + scope-chain-scope-and-prototype-chain-6.swf.trace \ + scope-chain-scope-and-prototype-chain-7.swf \ + scope-chain-scope-and-prototype-chain-7.swf.trace \ + scope-chain-scope-and-prototype-chain-8.swf \ + scope-chain-scope-and-prototype-chain-8.swf.trace \ + scope-chain-this-2.as \ + scope-chain-this-2-5.swf \ + scope-chain-this-2-5.swf.trace \ + scope-chain-this-2-6.swf \ + scope-chain-this-2-6.swf.trace \ + scope-chain-this-2-7.swf \ + scope-chain-this-2-7.swf.trace \ + scope-chain-this-2-8.swf \ + scope-chain-this-2-8.swf.trace \ + scope-chain-this.as \ + scope-chain-this-5.swf \ + scope-chain-this-5.swf.trace \ + scope-chain-this-6.swf \ + scope-chain-this-6.swf.trace \ + scope-chain-this-7.swf \ + scope-chain-this-7.swf.trace \ + scope-chain-this-8.swf \ + scope-chain-this-8.swf.trace \ + scope-chain-what-is.as \ + scope-chain-what-is-5.swf \ + scope-chain-what-is-5.swf.trace \ + scope-chain-what-is-6.swf \ + scope-chain-what-is-6.swf.trace \ + scope-chain-what-is-7.swf \ + scope-chain-what-is-7.swf.trace \ + scope-chain-what-is-8.swf \ + scope-chain-what-is-8.swf.trace \ + scope-chain-with-and-scope-chain.as \ + scope-chain-with-and-scope-chain-5.swf \ + scope-chain-with-and-scope-chain-5.swf.trace \ + scope-chain-with-and-scope-chain-6.swf \ + scope-chain-with-and-scope-chain-6.swf.trace \ + scope-chain-with-and-scope-chain-7.swf \ + scope-chain-with-and-scope-chain-7.swf.trace \ + scope-chain-with-and-scope-chain-8.swf \ + scope-chain-with-and-scope-chain-8.swf.trace \ set-overwrite-global-5.swf \ set-overwrite-global-6.swf \ set-overwrite-global-7.swf \ diff --git a/test/trace/scope-chain-did-you-understand-5.swf b/test/trace/scope-chain-did-you-understand-5.swf new file mode 100644 index 0000000..90e1d54 Binary files /dev/null and b/test/trace/scope-chain-did-you-understand-5.swf differ diff --git a/test/trace/scope-chain-did-you-understand-5.swf.trace b/test/trace/scope-chain-did-you-understand-5.swf.trace new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/test/trace/scope-chain-did-you-understand-5.swf.trace @@ -0,0 +1 @@ +7 diff --git a/test/trace/scope-chain-did-you-understand-6.swf b/test/trace/scope-chain-did-you-understand-6.swf new file mode 100644 index 0000000..bb7d117 Binary files /dev/null and b/test/trace/scope-chain-did-you-understand-6.swf differ diff --git a/test/trace/scope-chain-did-you-understand-6.swf.trace b/test/trace/scope-chain-did-you-understand-6.swf.trace new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/test/trace/scope-chain-did-you-understand-6.swf.trace @@ -0,0 +1 @@ +5 diff --git a/test/trace/scope-chain-did-you-understand-7.swf b/test/trace/scope-chain-did-you-understand-7.swf new file mode 100644 index 0000000..28ba86a Binary files /dev/null and b/test/trace/scope-chain-did-you-understand-7.swf differ diff --git a/test/trace/scope-chain-did-you-understand-7.swf.trace b/test/trace/scope-chain-did-you-understand-7.swf.trace new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/test/trace/scope-chain-did-you-understand-7.swf.trace @@ -0,0 +1 @@ +5 diff --git a/test/trace/scope-chain-did-you-understand-8.swf b/test/trace/scope-chain-did-you-understand-8.swf new file mode 100644 index 0000000..17e2edf Binary files /dev/null and b/test/trace/scope-chain-did-you-understand-8.swf differ diff --git a/test/trace/scope-chain-did-you-understand-8.swf.trace b/test/trace/scope-chain-did-you-understand-8.swf.trace new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/test/trace/scope-chain-did-you-understand-8.swf.trace @@ -0,0 +1 @@ +5 diff --git a/test/trace/scope-chain-did-you-understand.as b/test/trace/scope-chain-did-you-understand.as new file mode 100644 index 0000000..7d01c98 --- /dev/null +++ b/test/trace/scope-chain-did-you-understand.as @@ -0,0 +1,23 @@ +// makeswf -v 7 -s 200x150 -r 1 -o scope-chain-did-you-understand.swf scope-chain-did-you-understand.as +// taken with permission from http://www.timotheegroleau.com/Flash/articles/scope_chain.htm + +getMethod = function() { + var setProto = function() { + this.__proto__ = o1; + }; + setProto(); + + return function() { + trace(a); + }; +}; + +_global.a = 4; +o1 = {a:5}; +o2 = {a:6}; +a = 7; + +o2.theMethod = getMethod(); +o2.theMethod(); + +loadMovie ("FSCommand:quit", ""); diff --git a/test/trace/scope-chain-function-and-5.swf b/test/trace/scope-chain-function-and-5.swf new file mode 100644 index 0000000..fffebc2 Binary files /dev/null and b/test/trace/scope-chain-function-and-5.swf differ diff --git a/test/trace/scope-chain-function-and-5.swf.trace b/test/trace/scope-chain-function-and-5.swf.trace new file mode 100644 index 0000000..3233477 --- /dev/null +++ b/test/trace/scope-chain-function-and-5.swf.trace @@ -0,0 +1,2 @@ +5 +undefined diff --git a/test/trace/scope-chain-function-and-6.swf b/test/trace/scope-chain-function-and-6.swf new file mode 100644 index 0000000..1e07f5d Binary files /dev/null and b/test/trace/scope-chain-function-and-6.swf differ diff --git a/test/trace/scope-chain-function-and-6.swf.trace b/test/trace/scope-chain-function-and-6.swf.trace new file mode 100644 index 0000000..3233477 --- /dev/null +++ b/test/trace/scope-chain-function-and-6.swf.trace @@ -0,0 +1,2 @@ +5 +undefined diff --git a/test/trace/scope-chain-function-and-7.swf b/test/trace/scope-chain-function-and-7.swf new file mode 100644 index 0000000..d78af1a Binary files /dev/null and b/test/trace/scope-chain-function-and-7.swf differ diff --git a/test/trace/scope-chain-function-and-7.swf.trace b/test/trace/scope-chain-function-and-7.swf.trace new file mode 100644 index 0000000..3233477 --- /dev/null +++ b/test/trace/scope-chain-function-and-7.swf.trace @@ -0,0 +1,2 @@ +5 +undefined diff --git a/test/trace/scope-chain-function-and-8.swf b/test/trace/scope-chain-function-and-8.swf new file mode 100644 index 0000000..ca3266d Binary files /dev/null and b/test/trace/scope-chain-function-and-8.swf differ diff --git a/test/trace/scope-chain-function-and-8.swf.trace b/test/trace/scope-chain-function-and-8.swf.trace new file mode 100644 index 0000000..3233477 --- /dev/null +++ b/test/trace/scope-chain-function-and-8.swf.trace @@ -0,0 +1,2 @@ +5 +undefined diff --git a/test/trace/scope-chain-function-and.as b/test/trace/scope-chain-function-and.as new file mode 100644 index 0000000..834640a --- /dev/null +++ b/test/trace/scope-chain-function-and.as @@ -0,0 +1,16 @@ +// makeswf -v 7 -s 200x150 -r 1 -o scope-chain-function-and.swf scope-chain-function-and.as +// taken with permission from http://www.timotheegroleau.com/Flash/articles/scope_chain.htm + +a = 5; +test = function() { + trace(a); // 5 + delete a; + trace(a); // undefined +}; + +obj = new Object(); +obj.a = 6; +obj.meth = test; +obj.meth(); + +loadMovie ("FSCommand:quit", ""); diff --git a/test/trace/scope-chain-how-are-variables-assigned-2-5.swf b/test/trace/scope-chain-how-are-variables-assigned-2-5.swf new file mode 100644 index 0000000..1f3a73d Binary files /dev/null and b/test/trace/scope-chain-how-are-variables-assigned-2-5.swf differ diff --git a/test/trace/scope-chain-how-are-variables-assigned-2-5.swf.trace b/test/trace/scope-chain-how-are-variables-assigned-2-5.swf.trace new file mode 100644 index 0000000..5dda7d4 --- /dev/null +++ b/test/trace/scope-chain-how-are-variables-assigned-2-5.swf.trace @@ -0,0 +1,4 @@ +The first 'a' reference found is: 4 +5 +undefined +undefined diff --git a/test/trace/scope-chain-how-are-variables-assigned-2-6.swf b/test/trace/scope-chain-how-are-variables-assigned-2-6.swf new file mode 100644 index 0000000..682c651 Binary files /dev/null and b/test/trace/scope-chain-how-are-variables-assigned-2-6.swf differ diff --git a/test/trace/scope-chain-how-are-variables-assigned-2-6.swf.trace b/test/trace/scope-chain-how-are-variables-assigned-2-6.swf.trace new file mode 100644 index 0000000..5dda7d4 --- /dev/null +++ b/test/trace/scope-chain-how-are-variables-assigned-2-6.swf.trace @@ -0,0 +1,4 @@ +The first 'a' reference found is: 4 +5 +undefined +undefined diff --git a/test/trace/scope-chain-how-are-variables-assigned-2-7.swf b/test/trace/scope-chain-how-are-variables-assigned-2-7.swf new file mode 100644 index 0000000..db3a538 Binary files /dev/null and b/test/trace/scope-chain-how-are-variables-assigned-2-7.swf differ diff --git a/test/trace/scope-chain-how-are-variables-assigned-2-7.swf.trace b/test/trace/scope-chain-how-are-variables-assigned-2-7.swf.trace new file mode 100644 index 0000000..5dda7d4 --- /dev/null +++ b/test/trace/scope-chain-how-are-variables-assigned-2-7.swf.trace @@ -0,0 +1,4 @@ +The first 'a' reference found is: 4 +5 +undefined +undefined diff --git a/test/trace/scope-chain-how-are-variables-assigned-2-8.swf b/test/trace/scope-chain-how-are-variables-assigned-2-8.swf new file mode 100644 index 0000000..95ca7e6 Binary files /dev/null and b/test/trace/scope-chain-how-are-variables-assigned-2-8.swf differ diff --git a/test/trace/scope-chain-how-are-variables-assigned-2-8.swf.trace b/test/trace/scope-chain-how-are-variables-assigned-2-8.swf.trace new file mode 100644 index 0000000..5dda7d4 --- /dev/null +++ b/test/trace/scope-chain-how-are-variables-assigned-2-8.swf.trace @@ -0,0 +1,4 @@ +The first 'a' reference found is: 4 +5 +undefined +undefined diff --git a/test/trace/scope-chain-how-are-variables-assigned-2.as b/test/trace/scope-chain-how-are-variables-assigned-2.as new file mode 100644 index 0000000..68849a6 --- /dev/null +++ b/test/trace/scope-chain-how-are-variables-assigned-2.as @@ -0,0 +1,16 @@ +// makeswf -v 7 -s 200x150 -r 1 -o scope-chain-how-are-variables-assigned-2.swf scope-chain-how-are-variables-assigned-2.as +// taken with permission from http://www.timotheegroleau.com/Flash/articles/scope_chain.htm + +o1 = {a:4}; +o2 = {}; +with (o1) { + with (o2) { + trace("The first 'a' reference found is: " + a); + a = 5; + }; +}; +trace(o1.a); // 5 +trace(o2.a); // undefined +trace(a); // undefined + +loadMovie ("FSCommand:quit", ""); diff --git a/test/trace/scope-chain-how-are-variables-assigned-3-5.swf b/test/trace/scope-chain-how-are-variables-assigned-3-5.swf new file mode 100644 index 0000000..a6b61c3 Binary files /dev/null and b/test/trace/scope-chain-how-are-variables-assigned-3-5.swf differ diff --git a/test/trace/scope-chain-how-are-variables-assigned-3-5.swf.trace b/test/trace/scope-chain-how-are-variables-assigned-3-5.swf.trace new file mode 100644 index 0000000..d5d1b82 --- /dev/null +++ b/test/trace/scope-chain-how-are-variables-assigned-3-5.swf.trace @@ -0,0 +1,4 @@ +The first 'a' reference found is: 4 +4 +undefined +5 diff --git a/test/trace/scope-chain-how-are-variables-assigned-3-6.swf b/test/trace/scope-chain-how-are-variables-assigned-3-6.swf new file mode 100644 index 0000000..f270e33 Binary files /dev/null and b/test/trace/scope-chain-how-are-variables-assigned-3-6.swf differ diff --git a/test/trace/scope-chain-how-are-variables-assigned-3-6.swf.trace b/test/trace/scope-chain-how-are-variables-assigned-3-6.swf.trace new file mode 100644 index 0000000..d5d1b82 --- /dev/null +++ b/test/trace/scope-chain-how-are-variables-assigned-3-6.swf.trace @@ -0,0 +1,4 @@ +The first 'a' reference found is: 4 +4 +undefined +5 diff --git a/test/trace/scope-chain-how-are-variables-assigned-3-7.swf b/test/trace/scope-chain-how-are-variables-assigned-3-7.swf new file mode 100644 index 0000000..98a0159 Binary files /dev/null and b/test/trace/scope-chain-how-are-variables-assigned-3-7.swf differ diff --git a/test/trace/scope-chain-how-are-variables-assigned-3-7.swf.trace b/test/trace/scope-chain-how-are-variables-assigned-3-7.swf.trace new file mode 100644 index 0000000..d5d1b82 --- /dev/null +++ b/test/trace/scope-chain-how-are-variables-assigned-3-7.swf.trace @@ -0,0 +1,4 @@ +The first 'a' reference found is: 4 +4 +undefined +5 diff --git a/test/trace/scope-chain-how-are-variables-assigned-3-8.swf b/test/trace/scope-chain-how-are-variables-assigned-3-8.swf new file mode 100644 index 0000000..725e01b Binary files /dev/null and b/test/trace/scope-chain-how-are-variables-assigned-3-8.swf differ diff --git a/test/trace/scope-chain-how-are-variables-assigned-3-8.swf.trace b/test/trace/scope-chain-how-are-variables-assigned-3-8.swf.trace new file mode 100644 index 0000000..d5d1b82 --- /dev/null +++ b/test/trace/scope-chain-how-are-variables-assigned-3-8.swf.trace @@ -0,0 +1,4 @@ +The first 'a' reference found is: 4 +4 +undefined +5 diff --git a/test/trace/scope-chain-how-are-variables-assigned-3.as b/test/trace/scope-chain-how-are-variables-assigned-3.as new file mode 100644 index 0000000..82cff6e --- /dev/null +++ b/test/trace/scope-chain-how-are-variables-assigned-3.as @@ -0,0 +1,17 @@ +// makeswf -v 7 -s 200x150 -r 1 -o scope-chain-how-are-variables-assigned-3.swf scope-chain-how-are-variables-assigned-3.as +// taken with permission from http://www.timotheegroleau.com/Flash/articles/scope_chain.htm + +o1 = {}; +o1.__proto__ = {a:4}; +o2 = {}; +with (o1) { + with (o2) { + trace("The first 'a' reference found is: " + a); + a = 5; + }; +}; +trace(o1.a); // 4 +trace(o2.a); // undefined +trace(a); // 5 + +loadMovie ("FSCommand:quit", ""); diff --git a/test/trace/scope-chain-how-are-variables-assigned-5.swf b/test/trace/scope-chain-how-are-variables-assigned-5.swf new file mode 100644 index 0000000..d1e9706 Binary files /dev/null and b/test/trace/scope-chain-how-are-variables-assigned-5.swf differ diff --git a/test/trace/scope-chain-how-are-variables-assigned-5.swf.trace b/test/trace/scope-chain-how-are-variables-assigned-5.swf.trace new file mode 100644 index 0000000..17c33eb --- /dev/null +++ b/test/trace/scope-chain-how-are-variables-assigned-5.swf.trace @@ -0,0 +1,4 @@ +The first 'a' reference found is: +undefined +undefined +5 diff --git a/test/trace/scope-chain-how-are-variables-assigned-6.swf b/test/trace/scope-chain-how-are-variables-assigned-6.swf new file mode 100644 index 0000000..1f024dd Binary files /dev/null and b/test/trace/scope-chain-how-are-variables-assigned-6.swf differ diff --git a/test/trace/scope-chain-how-are-variables-assigned-6.swf.trace b/test/trace/scope-chain-how-are-variables-assigned-6.swf.trace new file mode 100644 index 0000000..17c33eb --- /dev/null +++ b/test/trace/scope-chain-how-are-variables-assigned-6.swf.trace @@ -0,0 +1,4 @@ +The first 'a' reference found is: +undefined +undefined +5 diff --git a/test/trace/scope-chain-how-are-variables-assigned-7.swf b/test/trace/scope-chain-how-are-variables-assigned-7.swf new file mode 100644 index 0000000..ba0df03 Binary files /dev/null and b/test/trace/scope-chain-how-are-variables-assigned-7.swf differ diff --git a/test/trace/scope-chain-how-are-variables-assigned-7.swf.trace b/test/trace/scope-chain-how-are-variables-assigned-7.swf.trace new file mode 100644 index 0000000..70da056 --- /dev/null +++ b/test/trace/scope-chain-how-are-variables-assigned-7.swf.trace @@ -0,0 +1,4 @@ +The first 'a' reference found is: undefined +undefined +undefined +5 diff --git a/test/trace/scope-chain-how-are-variables-assigned-8.swf b/test/trace/scope-chain-how-are-variables-assigned-8.swf new file mode 100644 index 0000000..7caeb07 Binary files /dev/null and b/test/trace/scope-chain-how-are-variables-assigned-8.swf differ diff --git a/test/trace/scope-chain-how-are-variables-assigned-8.swf.trace b/test/trace/scope-chain-how-are-variables-assigned-8.swf.trace new file mode 100644 index 0000000..70da056 --- /dev/null +++ b/test/trace/scope-chain-how-are-variables-assigned-8.swf.trace @@ -0,0 +1,4 @@ +The first 'a' reference found is: undefined +undefined +undefined +5 diff --git a/test/trace/scope-chain-how-are-variables-assigned.as b/test/trace/scope-chain-how-are-variables-assigned.as new file mode 100644 index 0000000..9a5ce7d --- /dev/null +++ b/test/trace/scope-chain-how-are-variables-assigned.as @@ -0,0 +1,16 @@ +// makeswf -v 7 -s 200x150 -r 1 -o scope-chain-how-are-variables-assigned.swf scope-chain-how-are-variables-assigned.as +// taken with permission from http://www.timotheegroleau.com/Flash/articles/scope_chain.htm + +o1 = {}; +o2 = {}; +with (o1) { + with (o2) { + trace("The first 'a' reference found is: " + a); + a = 5; + }; +}; +trace(o1.a); // undefined +trace(o2.a); // undefined +trace(a); // 5 + +loadMovie ("FSCommand:quit", ""); diff --git a/test/trace/scope-chain-just-how-deep-5.swf b/test/trace/scope-chain-just-how-deep-5.swf new file mode 100644 index 0000000..8798e9f Binary files /dev/null and b/test/trace/scope-chain-just-how-deep-5.swf differ diff --git a/test/trace/scope-chain-just-how-deep-5.swf.trace b/test/trace/scope-chain-just-how-deep-5.swf.trace new file mode 100644 index 0000000..3a2e34c --- /dev/null +++ b/test/trace/scope-chain-just-how-deep-5.swf.trace @@ -0,0 +1,6 @@ +10 +undefined +undefined +undefined +undefined +5 diff --git a/test/trace/scope-chain-just-how-deep-6.swf b/test/trace/scope-chain-just-how-deep-6.swf new file mode 100644 index 0000000..1168ba7 Binary files /dev/null and b/test/trace/scope-chain-just-how-deep-6.swf differ diff --git a/test/trace/scope-chain-just-how-deep-6.swf.trace b/test/trace/scope-chain-just-how-deep-6.swf.trace new file mode 100644 index 0000000..14aa4af --- /dev/null +++ b/test/trace/scope-chain-just-how-deep-6.swf.trace @@ -0,0 +1,6 @@ +10 +9 +8 +7 +6 +5 diff --git a/test/trace/scope-chain-just-how-deep-7.swf b/test/trace/scope-chain-just-how-deep-7.swf new file mode 100644 index 0000000..97256bf Binary files /dev/null and b/test/trace/scope-chain-just-how-deep-7.swf differ diff --git a/test/trace/scope-chain-just-how-deep-7.swf.trace b/test/trace/scope-chain-just-how-deep-7.swf.trace new file mode 100644 index 0000000..14aa4af --- /dev/null +++ b/test/trace/scope-chain-just-how-deep-7.swf.trace @@ -0,0 +1,6 @@ +10 +9 +8 +7 +6 +5 diff --git a/test/trace/scope-chain-just-how-deep-8.swf b/test/trace/scope-chain-just-how-deep-8.swf new file mode 100644 index 0000000..61719d5 Binary files /dev/null and b/test/trace/scope-chain-just-how-deep-8.swf differ diff --git a/test/trace/scope-chain-just-how-deep-8.swf.trace b/test/trace/scope-chain-just-how-deep-8.swf.trace new file mode 100644 index 0000000..14aa4af --- /dev/null +++ b/test/trace/scope-chain-just-how-deep-8.swf.trace @@ -0,0 +1,6 @@ +10 +9 +8 +7 +6 +5 diff --git a/test/trace/scope-chain-just-how-deep.as b/test/trace/scope-chain-just-how-deep.as new file mode 100644 index 0000000..51f96bd --- /dev/null +++ b/test/trace/scope-chain-just-how-deep.as @@ -0,0 +1,33 @@ +// makeswf -v 7 -s 200x150 -r 1 -o scope-chain-just-how-deep.swf scope-chain-just-how-deep.as +// taken with permission from http://www.timotheegroleau.com/Flash/articles/scope_chain.htm + +a1 = 5; +addFunc = function(obj) { + var a2 = 6; + var func = function(obj) { + var a3 = 7; + var func = function(obj) { + var a4 = 8; + var func = function(obj) { + var a5 = 9; + obj.retrieve = function(refName) { + var a6 = 10; + trace(eval(refName)); + }; + }; + func(obj); + }; + func(obj); + }; + func(obj); +}; +o = {}; +addFunc(o); +o.retrieve("a6"); // 10 +o.retrieve("a5"); // 9 +o.retrieve("a4"); // 8 +o.retrieve("a3"); // 7 +o.retrieve("a2"); // 6 +o.retrieve("a1"); // 5 + +loadMovie ("FSCommand:quit", ""); diff --git a/test/trace/scope-chain-on-activation-object-persistance-5.swf b/test/trace/scope-chain-on-activation-object-persistance-5.swf new file mode 100644 index 0000000..7305d36 Binary files /dev/null and b/test/trace/scope-chain-on-activation-object-persistance-5.swf differ diff --git a/test/trace/scope-chain-on-activation-object-persistance-5.swf.trace b/test/trace/scope-chain-on-activation-object-persistance-5.swf.trace new file mode 100644 index 0000000..1a87c1e --- /dev/null +++ b/test/trace/scope-chain-on-activation-object-persistance-5.swf.trace @@ -0,0 +1,3 @@ +undefined +undefined +undefined diff --git a/test/trace/scope-chain-on-activation-object-persistance-6.swf b/test/trace/scope-chain-on-activation-object-persistance-6.swf new file mode 100644 index 0000000..214640a Binary files /dev/null and b/test/trace/scope-chain-on-activation-object-persistance-6.swf differ diff --git a/test/trace/scope-chain-on-activation-object-persistance-6.swf.trace b/test/trace/scope-chain-on-activation-object-persistance-6.swf.trace new file mode 100644 index 0000000..73c3559 --- /dev/null +++ b/test/trace/scope-chain-on-activation-object-persistance-6.swf.trace @@ -0,0 +1,3 @@ +Hello +There +Tim diff --git a/test/trace/scope-chain-on-activation-object-persistance-7.swf b/test/trace/scope-chain-on-activation-object-persistance-7.swf new file mode 100644 index 0000000..91b06f1 Binary files /dev/null and b/test/trace/scope-chain-on-activation-object-persistance-7.swf differ diff --git a/test/trace/scope-chain-on-activation-object-persistance-7.swf.trace b/test/trace/scope-chain-on-activation-object-persistance-7.swf.trace new file mode 100644 index 0000000..73c3559 --- /dev/null +++ b/test/trace/scope-chain-on-activation-object-persistance-7.swf.trace @@ -0,0 +1,3 @@ +Hello +There +Tim diff --git a/test/trace/scope-chain-on-activation-object-persistance-8.swf b/test/trace/scope-chain-on-activation-object-persistance-8.swf new file mode 100644 index 0000000..e519a87 Binary files /dev/null and b/test/trace/scope-chain-on-activation-object-persistance-8.swf differ diff --git a/test/trace/scope-chain-on-activation-object-persistance-8.swf.trace b/test/trace/scope-chain-on-activation-object-persistance-8.swf.trace new file mode 100644 index 0000000..73c3559 --- /dev/null +++ b/test/trace/scope-chain-on-activation-object-persistance-8.swf.trace @@ -0,0 +1,3 @@ +Hello +There +Tim diff --git a/test/trace/scope-chain-on-activation-object-persistance.as b/test/trace/scope-chain-on-activation-object-persistance.as new file mode 100644 index 0000000..119e85c --- /dev/null +++ b/test/trace/scope-chain-on-activation-object-persistance.as @@ -0,0 +1,18 @@ +// makeswf -v 7 -s 200x150 -r 1 -o scope-chain-on-activation-object-persistance.swf scope-chain-on-activation-object-persistance.as +// taken with permission from http://www.timotheegroleau.com/Flash/articles/scope_chain.htm + +test = function(obj) { + var aVariable_1 = "Hello"; + var aVariable_2 = "There"; + var aVariable_3 = "Tim"; + obj.retrieve = function(refName) { + trace(eval(refName)); + }; +}; +o = new Object(); +test(o); +o.retrieve("aVariable_1"); // Hello +o.retrieve("aVariable_2"); // There +o.retrieve("aVariable_3"); // Tim + +loadMovie ("FSCommand:quit", ""); diff --git a/test/trace/scope-chain-on-duplication-5.swf b/test/trace/scope-chain-on-duplication-5.swf new file mode 100644 index 0000000..2b61186 Binary files /dev/null and b/test/trace/scope-chain-on-duplication-5.swf differ diff --git a/test/trace/scope-chain-on-duplication-5.swf.trace b/test/trace/scope-chain-on-duplication-5.swf.trace new file mode 100644 index 0000000..bc9adbf --- /dev/null +++ b/test/trace/scope-chain-on-duplication-5.swf.trace @@ -0,0 +1,4 @@ +undefined +undefined +true +true diff --git a/test/trace/scope-chain-on-duplication-6.swf b/test/trace/scope-chain-on-duplication-6.swf new file mode 100644 index 0000000..4210882 Binary files /dev/null and b/test/trace/scope-chain-on-duplication-6.swf differ diff --git a/test/trace/scope-chain-on-duplication-6.swf.trace b/test/trace/scope-chain-on-duplication-6.swf.trace new file mode 100644 index 0000000..aa9dc9a --- /dev/null +++ b/test/trace/scope-chain-on-duplication-6.swf.trace @@ -0,0 +1,4 @@ +Hello there +Hello there +false +false diff --git a/test/trace/scope-chain-on-duplication-7.swf b/test/trace/scope-chain-on-duplication-7.swf new file mode 100644 index 0000000..fbb8b86 Binary files /dev/null and b/test/trace/scope-chain-on-duplication-7.swf differ diff --git a/test/trace/scope-chain-on-duplication-7.swf.trace b/test/trace/scope-chain-on-duplication-7.swf.trace new file mode 100644 index 0000000..aa9dc9a --- /dev/null +++ b/test/trace/scope-chain-on-duplication-7.swf.trace @@ -0,0 +1,4 @@ +Hello there +Hello there +false +false diff --git a/test/trace/scope-chain-on-duplication-8.swf b/test/trace/scope-chain-on-duplication-8.swf new file mode 100644 index 0000000..6cdea54 Binary files /dev/null and b/test/trace/scope-chain-on-duplication-8.swf differ diff --git a/test/trace/scope-chain-on-duplication-8.swf.trace b/test/trace/scope-chain-on-duplication-8.swf.trace new file mode 100644 index 0000000..aa9dc9a --- /dev/null +++ b/test/trace/scope-chain-on-duplication-8.swf.trace @@ -0,0 +1,4 @@ +Hello there +Hello there +false +false diff --git a/test/trace/scope-chain-on-duplication.as b/test/trace/scope-chain-on-duplication.as new file mode 100644 index 0000000..f02068d --- /dev/null +++ b/test/trace/scope-chain-on-duplication.as @@ -0,0 +1,25 @@ +// makeswf -v 7 -s 200x150 -r 1 -o scope-chain-on-duplication.swf scope-chain-on-duplication.as +// taken with permission from http://www.timotheegroleau.com/Flash/articles/scope_chain.htm + +addFunc = function(obj) { + var aVariable = new Object(); + aVariable.txt = "Hello there"; + + obj.theFunc = function() { + return aVariable; + }; +}; + +o1 = new Object(); +o2 = new Object(); + +addFunc(o1); +addFunc(o2); + +trace(o1.theFunc().txt); // Hello there +trace(o2.theFunc().txt); // Hello there + +trace(o1.theFunc == o2.theFunc) ; // false +trace(o1.theFunc() == o2.theFunc()) ; // false + +loadMovie ("FSCommand:quit", ""); diff --git a/test/trace/scope-chain-scope-and-prototype-chain-5.swf b/test/trace/scope-chain-scope-and-prototype-chain-5.swf new file mode 100644 index 0000000..469163c Binary files /dev/null and b/test/trace/scope-chain-scope-and-prototype-chain-5.swf differ diff --git a/test/trace/scope-chain-scope-and-prototype-chain-5.swf.trace b/test/trace/scope-chain-scope-and-prototype-chain-5.swf.trace new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/test/trace/scope-chain-scope-and-prototype-chain-5.swf.trace @@ -0,0 +1 @@ +5 diff --git a/test/trace/scope-chain-scope-and-prototype-chain-6.swf b/test/trace/scope-chain-scope-and-prototype-chain-6.swf new file mode 100644 index 0000000..f8dbc7f Binary files /dev/null and b/test/trace/scope-chain-scope-and-prototype-chain-6.swf differ diff --git a/test/trace/scope-chain-scope-and-prototype-chain-6.swf.trace b/test/trace/scope-chain-scope-and-prototype-chain-6.swf.trace new file mode 100644 index 0000000..1e8b314 --- /dev/null +++ b/test/trace/scope-chain-scope-and-prototype-chain-6.swf.trace @@ -0,0 +1 @@ +6 diff --git a/test/trace/scope-chain-scope-and-prototype-chain-7.swf b/test/trace/scope-chain-scope-and-prototype-chain-7.swf new file mode 100644 index 0000000..145e1b0 Binary files /dev/null and b/test/trace/scope-chain-scope-and-prototype-chain-7.swf differ diff --git a/test/trace/scope-chain-scope-and-prototype-chain-7.swf.trace b/test/trace/scope-chain-scope-and-prototype-chain-7.swf.trace new file mode 100644 index 0000000..1e8b314 --- /dev/null +++ b/test/trace/scope-chain-scope-and-prototype-chain-7.swf.trace @@ -0,0 +1 @@ +6 diff --git a/test/trace/scope-chain-scope-and-prototype-chain-8.swf b/test/trace/scope-chain-scope-and-prototype-chain-8.swf new file mode 100644 index 0000000..06d454c Binary files /dev/null and b/test/trace/scope-chain-scope-and-prototype-chain-8.swf differ diff --git a/test/trace/scope-chain-scope-and-prototype-chain-8.swf.trace b/test/trace/scope-chain-scope-and-prototype-chain-8.swf.trace new file mode 100644 index 0000000..1e8b314 --- /dev/null +++ b/test/trace/scope-chain-scope-and-prototype-chain-8.swf.trace @@ -0,0 +1 @@ +6 diff --git a/test/trace/scope-chain-scope-and-prototype-chain.as b/test/trace/scope-chain-scope-and-prototype-chain.as new file mode 100644 index 0000000..558c2bb --- /dev/null +++ b/test/trace/scope-chain-scope-and-prototype-chain.as @@ -0,0 +1,16 @@ +// makeswf -v 7 -s 200x150 -r 1 -o scope-chain-scope-and-prototype-chain.swf scope-chain-scope-and-prototype-chain.as +// taken with permission from http://www.timotheegroleau.com/Flash/articles/scope_chain.htm + +a = 5; +addFunc = function(obj) { + var __proto__ = new Object(); + __proto__.a = 6; + obj.meth = function() { + trace(a); + }; +}; +o = {}; +addFunc(o); +o.meth(); // 6 + +loadMovie ("FSCommand:quit", ""); diff --git a/test/trace/scope-chain-this-2-5.swf b/test/trace/scope-chain-this-2-5.swf new file mode 100644 index 0000000..cb20464 Binary files /dev/null and b/test/trace/scope-chain-this-2-5.swf differ diff --git a/test/trace/scope-chain-this-2-5.swf.trace b/test/trace/scope-chain-this-2-5.swf.trace new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/test/trace/scope-chain-this-2-5.swf.trace @@ -0,0 +1 @@ +5 diff --git a/test/trace/scope-chain-this-2-6.swf b/test/trace/scope-chain-this-2-6.swf new file mode 100644 index 0000000..f7dabe5 Binary files /dev/null and b/test/trace/scope-chain-this-2-6.swf differ diff --git a/test/trace/scope-chain-this-2-6.swf.trace b/test/trace/scope-chain-this-2-6.swf.trace new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/test/trace/scope-chain-this-2-6.swf.trace @@ -0,0 +1 @@ +5 diff --git a/test/trace/scope-chain-this-2-7.swf b/test/trace/scope-chain-this-2-7.swf new file mode 100644 index 0000000..ab17892 Binary files /dev/null and b/test/trace/scope-chain-this-2-7.swf differ diff --git a/test/trace/scope-chain-this-2-7.swf.trace b/test/trace/scope-chain-this-2-7.swf.trace new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/test/trace/scope-chain-this-2-7.swf.trace @@ -0,0 +1 @@ +5 diff --git a/test/trace/scope-chain-this-2-8.swf b/test/trace/scope-chain-this-2-8.swf new file mode 100644 index 0000000..61f65d4 Binary files /dev/null and b/test/trace/scope-chain-this-2-8.swf differ diff --git a/test/trace/scope-chain-this-2-8.swf.trace b/test/trace/scope-chain-this-2-8.swf.trace new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/test/trace/scope-chain-this-2-8.swf.trace @@ -0,0 +1 @@ +5 diff --git a/test/trace/scope-chain-this-2.as b/test/trace/scope-chain-this-2.as new file mode 100644 index 0000000..3405a36 --- /dev/null +++ b/test/trace/scope-chain-this-2.as @@ -0,0 +1,14 @@ +// makeswf -v 7 -s 200x150 -r 1 -o scope-chain-this-2.swf scope-chain-this-2.as +// taken with permission from http://www.timotheegroleau.com/Flash/articles/scope_chain.htm + +a = 4; +test = function() { + var a = 5; + var getRef = function() { + trace(this.a); + }; + getRef(); // 5 +}; +test(); + +loadMovie ("FSCommand:quit", ""); diff --git a/test/trace/scope-chain-this-5.swf b/test/trace/scope-chain-this-5.swf new file mode 100644 index 0000000..74ee05e Binary files /dev/null and b/test/trace/scope-chain-this-5.swf differ diff --git a/test/trace/scope-chain-this-5.swf.trace b/test/trace/scope-chain-this-5.swf.trace new file mode 100644 index 0000000..baf1966 --- /dev/null +++ b/test/trace/scope-chain-this-5.swf.trace @@ -0,0 +1,2 @@ +6 +7 diff --git a/test/trace/scope-chain-this-6.swf b/test/trace/scope-chain-this-6.swf new file mode 100644 index 0000000..0b33b9a Binary files /dev/null and b/test/trace/scope-chain-this-6.swf differ diff --git a/test/trace/scope-chain-this-6.swf.trace b/test/trace/scope-chain-this-6.swf.trace new file mode 100644 index 0000000..baf1966 --- /dev/null +++ b/test/trace/scope-chain-this-6.swf.trace @@ -0,0 +1,2 @@ +6 +7 diff --git a/test/trace/scope-chain-this-7.swf b/test/trace/scope-chain-this-7.swf new file mode 100644 index 0000000..bfa7f2e Binary files /dev/null and b/test/trace/scope-chain-this-7.swf differ diff --git a/test/trace/scope-chain-this-7.swf.trace b/test/trace/scope-chain-this-7.swf.trace new file mode 100644 index 0000000..baf1966 --- /dev/null +++ b/test/trace/scope-chain-this-7.swf.trace @@ -0,0 +1,2 @@ +6 +7 diff --git a/test/trace/scope-chain-this-8.swf b/test/trace/scope-chain-this-8.swf new file mode 100644 index 0000000..94859a2 Binary files /dev/null and b/test/trace/scope-chain-this-8.swf differ diff --git a/test/trace/scope-chain-this-8.swf.trace b/test/trace/scope-chain-this-8.swf.trace new file mode 100644 index 0000000..baf1966 --- /dev/null +++ b/test/trace/scope-chain-this-8.swf.trace @@ -0,0 +1,2 @@ +6 +7 diff --git a/test/trace/scope-chain-this.as b/test/trace/scope-chain-this.as new file mode 100644 index 0000000..c8e8593 --- /dev/null +++ b/test/trace/scope-chain-this.as @@ -0,0 +1,20 @@ +// makeswf -v 7 -s 200x150 -r 1 -o scope-chain-this.swf scope-chain-this.as +// taken with permission from http://www.timotheegroleau.com/Flash/articles/scope_chain.htm + +a = 5; +test = function() { + trace(this.a); +}; + +obj = new Object(); +obj.a = 6; +obj.meth = test; + +obj2 = new Object(); +obj2.a = 7; +obj2.meth = test; + +obj.meth(); // 6 +obj2.meth(); // 7 + +loadMovie ("FSCommand:quit", ""); diff --git a/test/trace/scope-chain-what-is-5.swf b/test/trace/scope-chain-what-is-5.swf new file mode 100644 index 0000000..1007b6b Binary files /dev/null and b/test/trace/scope-chain-what-is-5.swf differ diff --git a/test/trace/scope-chain-what-is-5.swf.trace b/test/trace/scope-chain-what-is-5.swf.trace new file mode 100644 index 0000000..6e20af9 --- /dev/null +++ b/test/trace/scope-chain-what-is-5.swf.trace @@ -0,0 +1,3 @@ +6 +5 +undefined diff --git a/test/trace/scope-chain-what-is-6.swf b/test/trace/scope-chain-what-is-6.swf new file mode 100644 index 0000000..cffdc31 Binary files /dev/null and b/test/trace/scope-chain-what-is-6.swf differ diff --git a/test/trace/scope-chain-what-is-6.swf.trace b/test/trace/scope-chain-what-is-6.swf.trace new file mode 100644 index 0000000..62d6c89 --- /dev/null +++ b/test/trace/scope-chain-what-is-6.swf.trace @@ -0,0 +1,3 @@ +6 +5 +4 diff --git a/test/trace/scope-chain-what-is-7.swf b/test/trace/scope-chain-what-is-7.swf new file mode 100644 index 0000000..d5523d9 Binary files /dev/null and b/test/trace/scope-chain-what-is-7.swf differ diff --git a/test/trace/scope-chain-what-is-7.swf.trace b/test/trace/scope-chain-what-is-7.swf.trace new file mode 100644 index 0000000..62d6c89 --- /dev/null +++ b/test/trace/scope-chain-what-is-7.swf.trace @@ -0,0 +1,3 @@ +6 +5 +4 diff --git a/test/trace/scope-chain-what-is-8.swf b/test/trace/scope-chain-what-is-8.swf new file mode 100644 index 0000000..d0d67a8 Binary files /dev/null and b/test/trace/scope-chain-what-is-8.swf differ diff --git a/test/trace/scope-chain-what-is-8.swf.trace b/test/trace/scope-chain-what-is-8.swf.trace new file mode 100644 index 0000000..62d6c89 --- /dev/null +++ b/test/trace/scope-chain-what-is-8.swf.trace @@ -0,0 +1,3 @@ +6 +5 +4 diff --git a/test/trace/scope-chain-what-is.as b/test/trace/scope-chain-what-is.as new file mode 100644 index 0000000..d59fe62 --- /dev/null +++ b/test/trace/scope-chain-what-is.as @@ -0,0 +1,16 @@ +// makeswf -v 7 -s 200x150 -r 1 -o scope-chain-what-is.swf scope-chain-what-is.as +// taken with permission from http://www.timotheegroleau.com/Flash/articles/scope_chain.htm + +_global.a = 4; +a = 5; +obj = new Object(); +obj.a = 6; +with(obj) { + trace(a); // 6 + delete a; + trace(a); // 5 + delete a; + trace(a); // 4 +}; + +loadMovie ("FSCommand:quit", ""); diff --git a/test/trace/scope-chain-with-and-scope-chain-5.swf b/test/trace/scope-chain-with-and-scope-chain-5.swf new file mode 100644 index 0000000..e155281 Binary files /dev/null and b/test/trace/scope-chain-with-and-scope-chain-5.swf differ diff --git a/test/trace/scope-chain-with-and-scope-chain-5.swf.trace b/test/trace/scope-chain-with-and-scope-chain-5.swf.trace new file mode 100644 index 0000000..3233477 --- /dev/null +++ b/test/trace/scope-chain-with-and-scope-chain-5.swf.trace @@ -0,0 +1,2 @@ +5 +undefined diff --git a/test/trace/scope-chain-with-and-scope-chain-6.swf b/test/trace/scope-chain-with-and-scope-chain-6.swf new file mode 100644 index 0000000..9b6988e Binary files /dev/null and b/test/trace/scope-chain-with-and-scope-chain-6.swf differ diff --git a/test/trace/scope-chain-with-and-scope-chain-6.swf.trace b/test/trace/scope-chain-with-and-scope-chain-6.swf.trace new file mode 100644 index 0000000..fd3c81a --- /dev/null +++ b/test/trace/scope-chain-with-and-scope-chain-6.swf.trace @@ -0,0 +1,2 @@ +5 +5 diff --git a/test/trace/scope-chain-with-and-scope-chain-7.swf b/test/trace/scope-chain-with-and-scope-chain-7.swf new file mode 100644 index 0000000..549a80a Binary files /dev/null and b/test/trace/scope-chain-with-and-scope-chain-7.swf differ diff --git a/test/trace/scope-chain-with-and-scope-chain-7.swf.trace b/test/trace/scope-chain-with-and-scope-chain-7.swf.trace new file mode 100644 index 0000000..fd3c81a --- /dev/null +++ b/test/trace/scope-chain-with-and-scope-chain-7.swf.trace @@ -0,0 +1,2 @@ +5 +5 diff --git a/test/trace/scope-chain-with-and-scope-chain-8.swf b/test/trace/scope-chain-with-and-scope-chain-8.swf new file mode 100644 index 0000000..81ff4eb Binary files /dev/null and b/test/trace/scope-chain-with-and-scope-chain-8.swf differ diff --git a/test/trace/scope-chain-with-and-scope-chain-8.swf.trace b/test/trace/scope-chain-with-and-scope-chain-8.swf.trace new file mode 100644 index 0000000..fd3c81a --- /dev/null +++ b/test/trace/scope-chain-with-and-scope-chain-8.swf.trace @@ -0,0 +1,2 @@ +5 +5 diff --git a/test/trace/scope-chain-with-and-scope-chain.as b/test/trace/scope-chain-with-and-scope-chain.as new file mode 100644 index 0000000..43baa36 --- /dev/null +++ b/test/trace/scope-chain-with-and-scope-chain.as @@ -0,0 +1,14 @@ +// makeswf -v 7 -s 200x150 -r 1 -o scope-chain-with-and-scope-chain.swf scope-chain-with-and-scope-chain.as +// taken with permission from http://www.timotheegroleau.com/Flash/articles/scope_chain.htm + +o1 = {a:5}; +o2 = {}; +with (o1) { + trace(a); // 5 + o2.aMethod = function() { + trace(a); + }; +}; +o2.aMethod(); // undefined + +loadMovie ("FSCommand:quit", ""); diff-tree 87e4fa70d0d8cb93ec124fe97e5781794a8a2d7e (from ef4b8c89c3e50cdd36402301e9aad38270accf24) Author: Benjamin Otte <otte at gnome.org> Date: Thu Sep 13 20:42:54 2007 +0200 it's better to initialize correctly than to delete later ;) diff --git a/libswfdec/swfdec_as_function.c b/libswfdec/swfdec_as_function.c index b00f765..6cc40a4 100644 --- a/libswfdec/swfdec_as_function.c +++ b/libswfdec/swfdec_as_function.c @@ -242,16 +242,15 @@ swfdec_as_function_init_context (SwfdecA proto = swfdec_as_object_new_empty (context); if (!proto) return; - context->Function_prototype = proto; + if (version > 5) + context->Function_prototype = proto; SWFDEC_AS_VALUE_SET_OBJECT (&val, proto); - swfdec_as_object_set_variable_and_flags (function, SWFDEC_AS_STR___proto__, - &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT); swfdec_as_object_set_variable_and_flags (function, SWFDEC_AS_STR_prototype, &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT); + swfdec_as_object_set_variable_and_flags (function, SWFDEC_AS_STR___proto__, + &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT); SWFDEC_AS_VALUE_SET_OBJECT (&val, function); swfdec_as_object_set_variable_and_flags (proto, SWFDEC_AS_STR_constructor, &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT); - if (version <= 5) - context->Function_prototype = NULL; }
Apparently Analagous Threads
- Changes to 'refs/tags/0.5.3'
- Branch 'as' - 8 commits - libswfdec/Makefile.am libswfdec/swfdec_as_context.c libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_number.c libswfdec/swfdec_as_scope.h
- Branch 'as' - 4 commits - test/trace
- Branch 'as' - 13 commits - libswfdec/swfdec_as_context.c libswfdec/swfdec_as_context.h libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h
- 4 commits - libswfdec/swfdec_script.c test/image test/trace