diff --git a/core/src/avm2/globals/flash/net/local_connection.rs b/core/src/avm2/globals/flash/net/local_connection.rs index 85453fee1..15d35274b 100644 --- a/core/src/avm2/globals/flash/net/local_connection.rs +++ b/core/src/avm2/globals/flash/net/local_connection.rs @@ -40,7 +40,7 @@ pub fn send<'gc>( if matches!(args.get_value(0), Value::Null) { return Err(Error::AvmError(type_error( activation, - &format!("Error #2007: Parameter connectionName must be non-null."), + "Error #2007: Parameter connectionName must be non-null.", 2007, )?)); } @@ -48,7 +48,7 @@ pub fn send<'gc>( if matches!(args.get_value(1), Value::Null) { return Err(Error::AvmError(type_error( activation, - &format!("Error #2007: Parameter methodName must be non-null."), + "Error #2007: Parameter methodName must be non-null.", 2007, )?)); } @@ -66,6 +66,7 @@ pub fn send<'gc>( ], )?; + // FIXME: Adding the event listener after calling `send` works in FP. Avm2::dispatch_event(&mut activation.context, event, this); Ok(Value::Undefined) diff --git a/tests/tests/swfs/avm2/localconnection_send/output.txt b/tests/tests/swfs/avm2/localconnection_send/output.txt new file mode 100644 index 000000000..e475e0c51 --- /dev/null +++ b/tests/tests/swfs/avm2/localconnection_send/output.txt @@ -0,0 +1,4 @@ +TypeError: Error #2007: Parameter connectionName must be non-null. +TypeError: Error #2007: Parameter connectionName must be non-null. +TypeError: Error #2007: Parameter methodName must be non-null. +[StatusEvent type="status" bubbles=false cancelable=false eventPhase=2 code=null level="error"] diff --git a/tests/tests/swfs/avm2/localconnection_send/test.swf b/tests/tests/swfs/avm2/localconnection_send/test.swf new file mode 100644 index 000000000..f11658a83 Binary files /dev/null and b/tests/tests/swfs/avm2/localconnection_send/test.swf differ diff --git a/tests/tests/swfs/avm2/localconnection_send/test.toml b/tests/tests/swfs/avm2/localconnection_send/test.toml new file mode 100644 index 000000000..dbee897f5 --- /dev/null +++ b/tests/tests/swfs/avm2/localconnection_send/test.toml @@ -0,0 +1 @@ +num_frames = 1