avm2: Skip attempting to serialize methods

This commit is contained in:
Adrian Wielgosik 2024-09-06 18:02:45 +02:00 committed by TÖRÖK Attila
parent 43f5aaaab9
commit 7d07eb2b52
5 changed files with 25 additions and 0 deletions

View File

@ -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;

View File

@ -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;
}
}
}

View File

@ -0,0 +1 @@
25

Binary file not shown.

View File

@ -0,0 +1 @@
num_frames = 1