diff --git a/core/src/avm2/amf.rs b/core/src/avm2/amf.rs index 0303d6abb82a..393d58205584 100644 --- a/core/src/avm2/amf.rs +++ b/core/src/avm2/amf.rs @@ -202,11 +202,15 @@ pub fn recursive_serialize<'gc>( ) -> Result<(), Error<'gc>> { if let Some(static_properties) = static_properties { let vtable = obj.vtable(); + // TODO: respect versioning let mut props = vtable.public_properties(); // Flash appears to use vtable iteration order, but we sort ours // to make our test output consistent. props.sort_by_key(|(name, _)| name.to_utf8_lossy().to_string()); for (name, prop) in props { + if let Property::Method { .. } = prop { + continue; + } if let Property::Virtual { get, set } = prop { if !(get.is_some() && set.is_some()) { continue; diff --git a/tests/tests/swfs/avm2/bytearray_method_serialization/Test.as b/tests/tests/swfs/avm2/bytearray_method_serialization/Test.as new file mode 100644 index 000000000000..483cc9ba2c25 --- /dev/null +++ b/tests/tests/swfs/avm2/bytearray_method_serialization/Test.as @@ -0,0 +1,19 @@ +// compiled with mxmlc (and modified to SWF v9) + +import flash.utils.ByteArray; +import flash.geom.Point; + +var p = new Point(4.5, 5.5); +var b = new ByteArray(); +b.writeObject(p); +trace(b.length); + +package { + import flash.display.MovieClip; + + public class Test extends MovieClip { + public function Test() { + return; + } + } +} diff --git a/tests/tests/swfs/avm2/bytearray_method_serialization/output.txt b/tests/tests/swfs/avm2/bytearray_method_serialization/output.txt new file mode 100644 index 000000000000..7273c0fa8c52 --- /dev/null +++ b/tests/tests/swfs/avm2/bytearray_method_serialization/output.txt @@ -0,0 +1 @@ +25 diff --git a/tests/tests/swfs/avm2/bytearray_method_serialization/test.swf b/tests/tests/swfs/avm2/bytearray_method_serialization/test.swf new file mode 100644 index 000000000000..0a52f3c4b47d Binary files /dev/null and b/tests/tests/swfs/avm2/bytearray_method_serialization/test.swf differ diff --git a/tests/tests/swfs/avm2/bytearray_method_serialization/test.toml b/tests/tests/swfs/avm2/bytearray_method_serialization/test.toml new file mode 100644 index 000000000000..dbee897f5863 --- /dev/null +++ b/tests/tests/swfs/avm2/bytearray_method_serialization/test.toml @@ -0,0 +1 @@ +num_frames = 1