diff --git a/core/src/avm2/globals/flash/display/loaderinfo.rs b/core/src/avm2/globals/flash/display/loaderinfo.rs index 4a0061d33..e1ea98bab 100644 --- a/core/src/avm2/globals/flash/display/loaderinfo.rs +++ b/core/src/avm2/globals/flash/display/loaderinfo.rs @@ -122,6 +122,25 @@ pub fn content<'gc>( Ok(Value::Undefined) } +/// `contentType` getter +pub fn content_type<'gc>( + _activation: &mut Activation<'_, 'gc, '_>, + this: Option>, + _args: &[Value<'gc>], +) -> Result, Error> { + if let Some(this) = this { + if let Some(loader_stream) = this.as_loader_stream() { + match &*loader_stream { + LoaderStream::SWF(_, _) => { + return Ok("application/x-shockwave-flash".into()); + } + } + } + } + + Ok(Value::Undefined) +} + /// Derive `LoaderInfoObject` impls. pub fn loaderinfo_deriver<'gc>( base_proto: Object<'gc>, @@ -166,6 +185,10 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc> QName::new(Namespace::public(), "content"), Method::from_builtin(content), )); + write.define_instance_trait(Trait::from_getter( + QName::new(Namespace::public(), "contentType"), + Method::from_builtin(content_type), + )); class }