Skip to content

Commit 198e40f

Browse files
committed
avm2: Changed return values of a bunch of stubs per PR feedbck
1 parent 8e917c4 commit 198e40f

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

core/src/avm2/globals/flash/display/displayobjectcontainer.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ use crate::avm2::class::Class;
55
use crate::avm2::method::{Method, NativeMethodImpl};
66
use crate::avm2::object::{Object, TObject};
77
use crate::avm2::value::Value;
8-
use crate::avm2::Error;
98
use crate::avm2::Multiname;
109
use crate::avm2::Namespace;
1110
use crate::avm2::QName;
11+
use crate::avm2::{ArrayObject, ArrayStorage, Error};
1212
use crate::context::UpdateContext;
1313
use crate::display_object::{DisplayObject, TDisplayObject, TDisplayObjectContainer};
1414
use crate::{avm2_stub_getter, avm2_stub_method, avm2_stub_setter};
@@ -569,7 +569,7 @@ pub fn get_objects_under_point<'gc>(
569569
"flash.display.DisplayObjectContainer",
570570
"getObjectsUnderPoint"
571571
);
572-
Ok(Value::Undefined)
572+
Ok(ArrayObject::from_storage(activation, ArrayStorage::new(0))?.into())
573573
}
574574

575575
pub fn are_inaccessible_objects_under_point<'gc>(
@@ -582,7 +582,7 @@ pub fn are_inaccessible_objects_under_point<'gc>(
582582
"flash.display.DisplayObjectContainer",
583583
"areInaccessibleObjectsUnderPoint"
584584
);
585-
Ok(Value::Undefined)
585+
Ok(false.into())
586586
}
587587

588588
pub fn mouse_children<'gc>(
@@ -619,7 +619,7 @@ pub fn tab_children<'gc>(
619619
avm2_stub_getter!(
620620
activation,
621621
"flash.display.DisplayObjectContainer",
622-
"areInaccessibleObjectsUnderPoint"
622+
"tabChildren"
623623
);
624624

625625
Ok(true.into())
@@ -633,10 +633,10 @@ pub fn set_tab_children<'gc>(
633633
avm2_stub_setter!(
634634
activation,
635635
"flash.display.DisplayObjectContainer",
636-
"areInaccessibleObjectsUnderPoint"
636+
"tabChildren"
637637
);
638638

639-
Ok(true.into())
639+
Ok(Value::Undefined)
640640
}
641641

642642
/// Construct `DisplayObjectContainer`'s class.

core/src/avm2/globals/flash/media/soundmixer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub fn are_sounds_inaccessible<'gc>(
125125
"flash.media.SoundMixer",
126126
"areSoundsInaccessible"
127127
);
128-
Ok(Value::Undefined)
128+
Ok(false.into())
129129
}
130130

131131
/// Implements `SoundMixer.computeSpectrum`

core/src/avm2/globals/flash/text/font.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ use crate::avm2::class::{Class, ClassAttributes};
55
use crate::avm2::method::{Method, NativeMethodImpl};
66
use crate::avm2::object::{Object, TObject};
77
use crate::avm2::value::Value;
8-
use crate::avm2::Error;
98
use crate::avm2::Multiname;
109
use crate::avm2::Namespace;
1110
use crate::avm2::QName;
11+
use crate::avm2::{ArrayObject, ArrayStorage, Error};
1212
use crate::avm2_stub_getter;
1313
use crate::character::Character;
1414
use crate::string::AvmString;
@@ -163,7 +163,7 @@ pub fn enumerate_fonts<'gc>(
163163
_args: &[Value<'gc>],
164164
) -> Result<Value<'gc>, Error<'gc>> {
165165
avm2_stub_getter!(activation, "flash.text.Font", "enumerateFonts");
166-
Ok(Value::Undefined)
166+
Ok(ArrayObject::from_storage(activation, ArrayStorage::new(0))?.into())
167167
}
168168

169169
/// `Font.registerFont`

core/src/avm2/globals/flash/text/static_text.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ pub fn get_text<'gc>(
1919
_args: &[Value<'gc>],
2020
) -> Result<Value<'gc>, Error<'gc>> {
2121
avm2_stub_getter!(activation, "flash.text.StaticText", "text");
22-
Ok(Value::Undefined)
22+
Ok("".into())
2323
}

core/src/avm2/globals/flash/utils/proxy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ pub fn is_attribute<'gc>(
1313
) -> Result<Value<'gc>, Error<'gc>> {
1414
// yes, this is supposed to be implemented
1515
avm2_stub_method!(activation, "flash.utils.Proxy", "isAttribute");
16-
Ok(Value::Undefined)
16+
Ok(false.into())
1717
}

0 commit comments

Comments
 (0)