Embed `UpdateContext` in `Activation` directly.
The process of constructing an `Activation` now involves calling `UpdateContext.reborrow`, which "sheds" a lifetime by copying all of the borrows into a new "owned" context with that lifetime. Likewise, to call out to functions that don't need an `Activation`, just borrow the context out of the current activation. You can also construct child-frame activations by reborrowing the parent activation's context.
This commit is contained in:
parent
7c7b019087
commit
a19595c8b4
|
@ -172,7 +172,7 @@ impl<'gc> Avm1<'gc> {
|
|||
}
|
||||
|
||||
let mut parent_activation = Activation::from_nothing(
|
||||
context,
|
||||
context.reborrow(),
|
||||
ActivationIdentifier::root("[Actions Parent]"),
|
||||
swf_version,
|
||||
self.global_object_cell(),
|
||||
|
@ -217,7 +217,7 @@ impl<'gc> Avm1<'gc> {
|
|||
function: F,
|
||||
) -> R
|
||||
where
|
||||
for<'c> F: FnOnce(&mut Activation<'c, '_, 'gc, '_>) -> R,
|
||||
for<'b> F: FnOnce(&mut Activation<'b, 'gc, '_>) -> R,
|
||||
{
|
||||
let clip_obj = match active_clip.object() {
|
||||
Value::Object(o) => o,
|
||||
|
@ -232,7 +232,7 @@ impl<'gc> Avm1<'gc> {
|
|||
Scope::new(global_scope, scope::ScopeClass::Target, clip_obj),
|
||||
);
|
||||
let mut activation = Activation::from_action(
|
||||
action_context,
|
||||
action_context.reborrow(),
|
||||
ActivationIdentifier::root("[Display Object]"),
|
||||
swf_version,
|
||||
child_scope,
|
||||
|
@ -260,7 +260,7 @@ impl<'gc> Avm1<'gc> {
|
|||
}
|
||||
|
||||
let mut parent_activation = Activation::from_nothing(
|
||||
context,
|
||||
context.reborrow(),
|
||||
ActivationIdentifier::root("[Init Parent]"),
|
||||
swf_version,
|
||||
self.global_object_cell(),
|
||||
|
@ -314,7 +314,7 @@ impl<'gc> Avm1<'gc> {
|
|||
}
|
||||
|
||||
let mut activation = Activation::from_nothing(
|
||||
context,
|
||||
context.reborrow(),
|
||||
ActivationIdentifier::root(name.to_owned()),
|
||||
swf_version,
|
||||
self.global_object_cell(),
|
||||
|
@ -341,7 +341,7 @@ impl<'gc> Avm1<'gc> {
|
|||
let global = self.global_object();
|
||||
|
||||
let mut activation = Activation::from_nothing(
|
||||
context,
|
||||
context.reborrow(),
|
||||
ActivationIdentifier::root("[System Listeners]"),
|
||||
swf_version,
|
||||
self.global_object_cell(),
|
||||
|
@ -431,7 +431,7 @@ impl<'gc> Avm1<'gc> {
|
|||
pub const fn set_show_debug_output(&self, _visible: bool) {}
|
||||
}
|
||||
|
||||
pub fn root_error_handler<'gc>(activation: &mut Activation<'_, '_, 'gc, '_>, error: Error<'gc>) {
|
||||
pub fn root_error_handler<'gc>(activation: &mut Activation<'_, 'gc, '_>, error: Error<'gc>) {
|
||||
if let Error::ThrownValue(error) = &error {
|
||||
let string = error
|
||||
.coerce_to_string(activation)
|
||||
|
@ -459,7 +459,7 @@ fn skip_actions(reader: &mut Reader<'_>, num_actions_to_skip: u8) {
|
|||
/// Runs via the `startDrag` method or `StartDrag` AVM1 action.
|
||||
pub fn start_drag<'gc>(
|
||||
display_object: DisplayObject<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) {
|
||||
let lock_center = args
|
||||
|
|
|
@ -178,7 +178,7 @@ unsafe impl<'gc> gc_arena::Collect for ActivationIdentifier<'gc> {
|
|||
|
||||
#[derive(Collect)]
|
||||
#[collect(unsafe_drop)]
|
||||
pub struct Activation<'a, 'b: 'a, 'gc: 'b, 'gc_context: 'a> {
|
||||
pub struct Activation<'a, 'gc: 'a, 'gc_context: 'a> {
|
||||
/// Represents the SWF version of a given function.
|
||||
///
|
||||
/// Certain AVM1 operations change behavior based on the version of the SWF
|
||||
|
@ -219,7 +219,7 @@ pub struct Activation<'a, 'b: 'a, 'gc: 'b, 'gc_context: 'a> {
|
|||
/// This can be changed with `tellTarget` (via `ActionSetTarget` and `ActionSetTarget2`).
|
||||
target_clip: Option<DisplayObject<'gc>>,
|
||||
|
||||
pub context: &'a mut UpdateContext<'b, 'gc, 'gc_context>,
|
||||
pub context: UpdateContext<'a, 'gc, 'gc_context>,
|
||||
|
||||
/// An identifier to refer to this activation by, when debugging.
|
||||
/// This is often the name of a function (if known), or some static name to indicate where
|
||||
|
@ -227,16 +227,16 @@ pub struct Activation<'a, 'b: 'a, 'gc: 'b, 'gc_context: 'a> {
|
|||
pub id: ActivationIdentifier<'a>,
|
||||
}
|
||||
|
||||
impl Drop for Activation<'_, '_, '_, '_> {
|
||||
impl Drop for Activation<'_, '_, '_> {
|
||||
fn drop(&mut self) {
|
||||
avm_debug!(self.context.avm1, "END {}", self.id);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'b: 'a, 'gc: 'b, 'gc_context: 'a> Activation<'a, 'b, 'gc, 'gc_context> {
|
||||
impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn from_action(
|
||||
context: &'a mut UpdateContext<'b, 'gc, 'gc_context>,
|
||||
context: UpdateContext<'a, 'gc, 'gc_context>,
|
||||
id: ActivationIdentifier<'a>,
|
||||
swf_version: u8,
|
||||
scope: GcCell<'gc, Scope<'gc>>,
|
||||
|
@ -261,16 +261,16 @@ impl<'a, 'b: 'a, 'gc: 'b, 'gc_context: 'a> Activation<'a, 'b, 'gc, 'gc_context>
|
|||
}
|
||||
|
||||
/// Create a new activation to run a block of code with a given scope.
|
||||
pub fn with_new_scope<'c, S: Into<Cow<'static, str>>>(
|
||||
&'c mut self,
|
||||
pub fn with_new_scope<'b, S: Into<Cow<'static, str>>>(
|
||||
&'b mut self,
|
||||
name: S,
|
||||
scope: GcCell<'gc, Scope<'gc>>,
|
||||
) -> Activation<'c, 'b, 'gc, 'gc_context> {
|
||||
) -> Activation<'b, 'gc, 'gc_context> {
|
||||
let id = self.id.child(name);
|
||||
avm_debug!(self.context.avm1, "START {}", id);
|
||||
Activation {
|
||||
id,
|
||||
context: self.context,
|
||||
context: self.context.reborrow(),
|
||||
swf_version: self.swf_version,
|
||||
scope,
|
||||
constant_pool: self.constant_pool,
|
||||
|
@ -287,7 +287,7 @@ impl<'a, 'b: 'a, 'gc: 'b, 'gc_context: 'a> Activation<'a, 'b, 'gc, 'gc_context>
|
|||
/// This is used by tests and by callback methods (`onEnterFrame`) to create a base
|
||||
/// activation frame with access to the global context.
|
||||
pub fn from_nothing(
|
||||
context: &'a mut UpdateContext<'b, 'gc, 'gc_context>,
|
||||
context: UpdateContext<'a, 'gc, 'gc_context>,
|
||||
id: ActivationIdentifier<'a>,
|
||||
swf_version: u8,
|
||||
globals: Object<'gc>,
|
||||
|
@ -324,7 +324,7 @@ impl<'a, 'b: 'a, 'gc: 'b, 'gc_context: 'a> Activation<'a, 'b, 'gc, 'gc_context>
|
|||
code: SwfSlice,
|
||||
) -> Result<ReturnType<'gc>, Error<'gc>> {
|
||||
let mut parent_activation = Activation::from_nothing(
|
||||
self.context,
|
||||
self.context.reborrow(),
|
||||
self.id.child("[Actions Parent]"),
|
||||
swf_version,
|
||||
self.context.avm1.globals,
|
||||
|
@ -364,7 +364,7 @@ impl<'a, 'b: 'a, 'gc: 'b, 'gc_context: 'a> Activation<'a, 'b, 'gc, 'gc_context>
|
|||
function: F,
|
||||
) -> R
|
||||
where
|
||||
for<'c> F: FnOnce(&mut Activation<'c, '_, 'gc, '_>) -> R,
|
||||
for<'c> F: FnOnce(&mut Activation<'c, 'gc, '_>) -> R,
|
||||
{
|
||||
let clip_obj = match active_clip.object() {
|
||||
Value::Object(o) => o,
|
||||
|
@ -380,7 +380,7 @@ impl<'a, 'b: 'a, 'gc: 'b, 'gc_context: 'a> Activation<'a, 'b, 'gc, 'gc_context>
|
|||
);
|
||||
let constant_pool = self.context.avm1.constant_pool;
|
||||
let mut activation = Activation::from_action(
|
||||
self.context,
|
||||
self.context.reborrow(),
|
||||
self.id.child(name),
|
||||
swf_version,
|
||||
child_scope,
|
||||
|
@ -723,7 +723,7 @@ impl<'a, 'b: 'a, 'gc: 'b, 'gc_context: 'a> Activation<'a, 'b, 'gc, 'gc_context>
|
|||
|
||||
if let Some((clip, frame)) = call_frame {
|
||||
if frame <= u32::from(std::u16::MAX) {
|
||||
for action in clip.actions_on_frame(self.context, frame as u16) {
|
||||
for action in clip.actions_on_frame(&mut self.context, frame as u16) {
|
||||
let _ = self.run_child_frame_for_action(
|
||||
"[Frame Call]",
|
||||
clip.into(),
|
||||
|
@ -1280,7 +1280,7 @@ impl<'a, 'b: 'a, 'gc: 'b, 'gc_context: 'a> Activation<'a, 'b, 'gc, 'gc_context>
|
|||
if let Some(clip) = self.target_clip() {
|
||||
if let Some(clip) = clip.as_movie_clip() {
|
||||
// The frame on the stack is 0-based, not 1-based.
|
||||
clip.goto_frame(self.context, frame + 1, true);
|
||||
clip.goto_frame(&mut self.context, frame + 1, true);
|
||||
} else {
|
||||
avm_error!(self, "GotoFrame failed: Target is not a MovieClip");
|
||||
}
|
||||
|
@ -1320,7 +1320,7 @@ impl<'a, 'b: 'a, 'gc: 'b, 'gc_context: 'a> Activation<'a, 'b, 'gc, 'gc_context>
|
|||
if let Some(clip) = self.target_clip() {
|
||||
if let Some(clip) = clip.as_movie_clip() {
|
||||
if let Some(frame) = clip.frame_label_to_number(label) {
|
||||
clip.goto_frame(self.context, frame, true);
|
||||
clip.goto_frame(&mut self.context, frame, true);
|
||||
} else {
|
||||
avm_warn!(self, "GoToLabel: Frame label '{}' not found", label);
|
||||
}
|
||||
|
@ -1533,7 +1533,7 @@ impl<'a, 'b: 'a, 'gc: 'b, 'gc_context: 'a> Activation<'a, 'b, 'gc, 'gc_context>
|
|||
fn action_next_frame(&mut self) -> Result<FrameControl<'gc>, Error<'gc>> {
|
||||
if let Some(clip) = self.target_clip() {
|
||||
if let Some(clip) = clip.as_movie_clip() {
|
||||
clip.next_frame(self.context);
|
||||
clip.next_frame(&mut self.context);
|
||||
} else {
|
||||
avm_warn!(self, "NextFrame: Target is not a MovieClip");
|
||||
}
|
||||
|
@ -1602,7 +1602,7 @@ impl<'a, 'b: 'a, 'gc: 'b, 'gc_context: 'a> Activation<'a, 'b, 'gc, 'gc_context>
|
|||
fn action_play(&mut self) -> Result<FrameControl<'gc>, Error<'gc>> {
|
||||
if let Some(clip) = self.target_clip() {
|
||||
if let Some(clip) = clip.as_movie_clip() {
|
||||
clip.play(self.context)
|
||||
clip.play(&mut self.context)
|
||||
} else {
|
||||
avm_warn!(self, "Play: Target is not a MovieClip");
|
||||
}
|
||||
|
@ -1615,7 +1615,7 @@ impl<'a, 'b: 'a, 'gc: 'b, 'gc_context: 'a> Activation<'a, 'b, 'gc, 'gc_context>
|
|||
fn action_prev_frame(&mut self) -> Result<FrameControl<'gc>, Error<'gc>> {
|
||||
if let Some(clip) = self.target_clip() {
|
||||
if let Some(clip) = clip.as_movie_clip() {
|
||||
clip.prev_frame(self.context);
|
||||
clip.prev_frame(&mut self.context);
|
||||
} else {
|
||||
avm_warn!(self, "PrevFrame: Target is not a MovieClip");
|
||||
}
|
||||
|
@ -1692,7 +1692,8 @@ impl<'a, 'b: 'a, 'gc: 'b, 'gc_context: 'a> Activation<'a, 'b, 'gc, 'gc_context>
|
|||
let target_clip = self.resolve_target_display_object(start_clip, target)?;
|
||||
|
||||
if let Some(target_clip) = target_clip.and_then(|o| o.as_movie_clip()) {
|
||||
let _ = globals::movie_clip::remove_movie_clip_with_bias(target_clip, self.context, 0);
|
||||
let _ =
|
||||
globals::movie_clip::remove_movie_clip_with_bias(target_clip, &mut self.context, 0);
|
||||
} else {
|
||||
avm_warn!(self, "RemoveSprite: Source is not a movie clip");
|
||||
}
|
||||
|
@ -1869,7 +1870,7 @@ impl<'a, 'b: 'a, 'gc: 'b, 'gc_context: 'a> Activation<'a, 'b, 'gc, 'gc_context>
|
|||
fn action_stop(&mut self) -> Result<FrameControl<'gc>, Error<'gc>> {
|
||||
if let Some(clip) = self.target_clip() {
|
||||
if let Some(clip) = clip.as_movie_clip() {
|
||||
clip.stop(self.context);
|
||||
clip.stop(&mut self.context);
|
||||
} else {
|
||||
avm_warn!(self, "Stop: Target is not a MovieClip");
|
||||
}
|
||||
|
@ -2119,7 +2120,7 @@ impl<'a, 'b: 'a, 'gc: 'b, 'gc_context: 'a> Activation<'a, 'b, 'gc, 'gc_context>
|
|||
if let Some((catch_vars, actions)) = &try_block.catch {
|
||||
if let Err(Error::ThrownValue(value)) = &result {
|
||||
let mut activation = Activation::from_action(
|
||||
self.context,
|
||||
self.context.reborrow(),
|
||||
self.id.child("[Catch]"),
|
||||
self.swf_version,
|
||||
self.scope,
|
||||
|
@ -2624,7 +2625,7 @@ impl<'a, 'b: 'a, 'gc: 'b, 'gc_context: 'a> Activation<'a, 'b, 'gc, 'gc_context>
|
|||
|
||||
level.set_depth(self.context.gc_context, level_id as i32);
|
||||
self.context.levels.insert(level_id, level);
|
||||
level.post_instantiation(self.context, level, None, false);
|
||||
level.post_instantiation(&mut self.context, level, None, false);
|
||||
|
||||
level
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ impl<'a> VariableDumper<'a> {
|
|||
pub fn dump<'gc>(
|
||||
value: &Value<'gc>,
|
||||
indent: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> String {
|
||||
let mut dumper = VariableDumper::new(indent);
|
||||
dumper.print_value(value, activation);
|
||||
|
@ -83,7 +83,7 @@ impl<'a> VariableDumper<'a> {
|
|||
pub fn print_object<'gc>(
|
||||
&mut self,
|
||||
object: &Object<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) {
|
||||
let (id, new) = self.object_id(object);
|
||||
self.output.push_str("[object #");
|
||||
|
@ -99,7 +99,7 @@ impl<'a> VariableDumper<'a> {
|
|||
&mut self,
|
||||
object: &Object<'gc>,
|
||||
key: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) {
|
||||
match object.get(&key, activation) {
|
||||
Ok(value) => {
|
||||
|
@ -116,7 +116,7 @@ impl<'a> VariableDumper<'a> {
|
|||
pub fn print_properties<'gc>(
|
||||
&mut self,
|
||||
object: &Object<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) {
|
||||
let keys = object.get_keys(activation);
|
||||
if keys.is_empty() {
|
||||
|
@ -142,7 +142,7 @@ impl<'a> VariableDumper<'a> {
|
|||
pub fn print_value<'gc>(
|
||||
&mut self,
|
||||
value: &Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) {
|
||||
match value {
|
||||
Value::Undefined => self.output.push_str("undefined"),
|
||||
|
@ -163,7 +163,7 @@ impl<'a> VariableDumper<'a> {
|
|||
header: &str,
|
||||
name: &str,
|
||||
object: &Object<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) {
|
||||
let keys = object.get_keys(activation);
|
||||
if keys.is_empty() {
|
||||
|
|
|
@ -17,7 +17,7 @@ pub fn parse(url: &str) -> Option<&str> {
|
|||
/// TODO: FSCommand URL handling
|
||||
pub fn handle<'gc>(
|
||||
fscommand: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
avm_warn!(activation, "Unhandled FSCommand: {}", fscommand);
|
||||
|
||||
|
|
|
@ -29,11 +29,8 @@ use swf::avm1::types::FunctionParam;
|
|||
/// resolve on the AVM stack, as if you had called a non-native function. If
|
||||
/// your function yields `None`, you must ensure that the top-most activation
|
||||
/// in the AVM1 runtime will return with the value of this function.
|
||||
pub type NativeFunction<'gc> = fn(
|
||||
&mut Activation<'_, '_, 'gc, '_>,
|
||||
Object<'gc>,
|
||||
&[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>>;
|
||||
pub type NativeFunction<'gc> =
|
||||
fn(&mut Activation<'_, 'gc, '_>, Object<'gc>, &[Value<'gc>]) -> Result<Value<'gc>, Error<'gc>>;
|
||||
|
||||
/// Indicates the reason for an execution
|
||||
#[derive(Debug, Clone)]
|
||||
|
@ -233,7 +230,7 @@ impl<'gc> Executable<'gc> {
|
|||
pub fn exec(
|
||||
&self,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
base_proto: Option<Object<'gc>>,
|
||||
args: &[Value<'gc>],
|
||||
|
@ -311,7 +308,7 @@ impl<'gc> Executable<'gc> {
|
|||
};
|
||||
|
||||
let mut frame = Activation::from_action(
|
||||
activation.context,
|
||||
activation.context.reborrow(),
|
||||
activation.id.function(
|
||||
name,
|
||||
reason,
|
||||
|
@ -534,7 +531,7 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
|
|||
fn get_local(
|
||||
&self,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
self.base.get_local(name, activation, this)
|
||||
|
@ -544,7 +541,7 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
|
|||
&self,
|
||||
name: &str,
|
||||
value: Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
self.base.set(name, value, activation)
|
||||
}
|
||||
|
@ -552,7 +549,7 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
|
|||
fn call(
|
||||
&self,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
base_proto: Option<Object<'gc>>,
|
||||
args: &[Value<'gc>],
|
||||
|
@ -574,7 +571,7 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
|
|||
|
||||
fn construct_on_existing(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
mut this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<(), Error<'gc>> {
|
||||
|
@ -612,7 +609,7 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
|
|||
|
||||
fn construct(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let prototype = self
|
||||
|
@ -627,7 +624,7 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
|
|||
&self,
|
||||
name: &str,
|
||||
value: Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Option<Object<'gc>> {
|
||||
self.base.call_setter(name, value, activation)
|
||||
}
|
||||
|
@ -635,7 +632,7 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
|
|||
#[allow(clippy::new_ret_no_self)]
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
prototype: Object<'gc>,
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObject::object(activation.context.gc_context, Some(prototype));
|
||||
|
@ -654,7 +651,7 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
|
|||
Ok(fn_object.into())
|
||||
}
|
||||
|
||||
fn delete(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn delete(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.base.delete(activation, name)
|
||||
}
|
||||
|
||||
|
@ -701,7 +698,7 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
|
|||
|
||||
fn add_property_with_case(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
name: &str,
|
||||
get: Object<'gc>,
|
||||
|
@ -714,7 +711,7 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
|
|||
|
||||
fn set_watcher(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
name: Cow<str>,
|
||||
callback: Object<'gc>,
|
||||
|
@ -726,34 +723,30 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
|
|||
|
||||
fn remove_watcher(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
name: Cow<str>,
|
||||
) -> bool {
|
||||
self.base.remove_watcher(activation, gc_context, name)
|
||||
}
|
||||
|
||||
fn has_property(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn has_property(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.base.has_property(activation, name)
|
||||
}
|
||||
|
||||
fn has_own_property(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn has_own_property(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.base.has_own_property(activation, name)
|
||||
}
|
||||
|
||||
fn has_own_virtual(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn has_own_virtual(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.base.has_own_virtual(activation, name)
|
||||
}
|
||||
|
||||
fn is_property_enumerable(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
name: &str,
|
||||
) -> bool {
|
||||
fn is_property_enumerable(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.base.is_property_enumerable(activation, name)
|
||||
}
|
||||
|
||||
fn get_keys(&self, activation: &mut Activation<'_, '_, 'gc, '_>) -> Vec<String> {
|
||||
fn get_keys(&self, activation: &mut Activation<'_, 'gc, '_>) -> Vec<String> {
|
||||
self.base.get_keys(activation)
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ mod text_format;
|
|||
mod xml;
|
||||
|
||||
pub fn random<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -57,7 +57,7 @@ pub fn random<'gc>(
|
|||
}
|
||||
|
||||
pub fn is_finite<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -70,7 +70,7 @@ pub fn is_finite<'gc>(
|
|||
}
|
||||
|
||||
pub fn is_nan<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -82,7 +82,7 @@ pub fn is_nan<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_infinity<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -94,7 +94,7 @@ pub fn get_infinity<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_nan<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -106,7 +106,7 @@ pub fn get_nan<'gc>(
|
|||
}
|
||||
|
||||
pub fn set_interval<'a, 'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
|
@ -115,7 +115,7 @@ pub fn set_interval<'a, 'gc>(
|
|||
}
|
||||
|
||||
pub fn set_timeout<'a, 'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
|
@ -124,7 +124,7 @@ pub fn set_timeout<'a, 'gc>(
|
|||
}
|
||||
|
||||
pub fn create_timer<'a, 'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
|
@ -167,7 +167,7 @@ pub fn create_timer<'a, 'gc>(
|
|||
}
|
||||
|
||||
pub fn clear_interval<'a, 'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
|
@ -184,7 +184,7 @@ pub fn clear_interval<'a, 'gc>(
|
|||
}
|
||||
|
||||
pub fn update_after_event<'a, 'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -645,7 +645,7 @@ pub fn create_globals<'gc>(
|
|||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn setup<'gc>(activation: &mut Activation<'_, '_, 'gc, '_>) -> Object<'gc> {
|
||||
fn setup<'gc>(activation: &mut Activation<'_, 'gc, '_>) -> Object<'gc> {
|
||||
create_globals(activation.context.gc_context).1
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ const DEFAULT_ORDERING: Ordering = Ordering::Equal;
|
|||
|
||||
// Compare function used by sort and sortOn.
|
||||
type CompareFn<'a, 'gc> =
|
||||
Box<dyn 'a + FnMut(&mut Activation<'_, '_, 'gc, '_>, &Value<'gc>, &Value<'gc>) -> Ordering>;
|
||||
Box<dyn 'a + FnMut(&mut Activation<'_, 'gc, '_>, &Value<'gc>, &Value<'gc>) -> Ordering>;
|
||||
|
||||
pub fn create_array_object<'gc>(
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
|
@ -83,7 +83,7 @@ pub fn create_array_object<'gc>(
|
|||
|
||||
/// Implements `Array` constructor
|
||||
pub fn constructor<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -121,7 +121,7 @@ pub fn constructor<'gc>(
|
|||
|
||||
/// Implements `Array` function
|
||||
pub fn array_function<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -156,7 +156,7 @@ pub fn array_function<'gc>(
|
|||
}
|
||||
|
||||
pub fn push<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -176,7 +176,7 @@ pub fn push<'gc>(
|
|||
}
|
||||
|
||||
pub fn unshift<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -208,7 +208,7 @@ pub fn unshift<'gc>(
|
|||
}
|
||||
|
||||
pub fn shift<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -234,7 +234,7 @@ pub fn shift<'gc>(
|
|||
}
|
||||
|
||||
pub fn pop<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -255,7 +255,7 @@ pub fn pop<'gc>(
|
|||
}
|
||||
|
||||
pub fn reverse<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -270,7 +270,7 @@ pub fn reverse<'gc>(
|
|||
}
|
||||
|
||||
pub fn join<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -307,7 +307,7 @@ fn make_index_absolute(mut index: i32, length: usize) -> usize {
|
|||
}
|
||||
|
||||
pub fn slice<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -344,7 +344,7 @@ pub fn slice<'gc>(
|
|||
}
|
||||
|
||||
pub fn splice<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -422,7 +422,7 @@ pub fn splice<'gc>(
|
|||
}
|
||||
|
||||
pub fn concat<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -490,7 +490,7 @@ pub fn concat<'gc>(
|
|||
}
|
||||
|
||||
pub fn to_string<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -498,7 +498,7 @@ pub fn to_string<'gc>(
|
|||
}
|
||||
|
||||
fn sort<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -542,7 +542,7 @@ fn sort<'gc>(
|
|||
}
|
||||
|
||||
fn sort_on<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -622,9 +622,9 @@ fn sort_on<'gc>(
|
|||
}
|
||||
|
||||
fn sort_with_function<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
mut compare_fn: impl FnMut(&mut Activation<'_, '_, 'gc, '_>, &Value<'gc>, &Value<'gc>) -> Ordering,
|
||||
mut compare_fn: impl FnMut(&mut Activation<'_, 'gc, '_>, &Value<'gc>, &Value<'gc>) -> Ordering,
|
||||
flags: i32,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let length = this.length();
|
||||
|
@ -768,7 +768,7 @@ pub fn create_proto<'gc>(
|
|||
}
|
||||
|
||||
fn sort_compare_string<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
a: &Value<'gc>,
|
||||
b: &Value<'gc>,
|
||||
) -> Ordering {
|
||||
|
@ -783,7 +783,7 @@ fn sort_compare_string<'gc>(
|
|||
}
|
||||
|
||||
fn sort_compare_string_ignore_case<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
a: &Value<'gc>,
|
||||
b: &Value<'gc>,
|
||||
) -> Ordering {
|
||||
|
@ -812,7 +812,7 @@ fn sort_compare_numeric(
|
|||
fn sort_compare_fields<'a, 'gc: 'a>(
|
||||
field_names: Vec<String>,
|
||||
mut compare_fns: Vec<CompareFn<'a, 'gc>>,
|
||||
) -> impl 'a + FnMut(&mut Activation<'_, '_, 'gc, '_>, &Value<'gc>, &Value<'gc>) -> Ordering {
|
||||
) -> impl 'a + FnMut(&mut Activation<'_, 'gc, '_>, &Value<'gc>, &Value<'gc>) -> Ordering {
|
||||
use crate::avm1::object::value_object::ValueObject;
|
||||
move |activation, a, b| {
|
||||
for (field_name, compare_fn) in field_names.iter().zip(compare_fns.iter_mut()) {
|
||||
|
@ -833,7 +833,7 @@ fn sort_compare_fields<'a, 'gc: 'a>(
|
|||
|
||||
// Returning an impl Trait here doesn't work yet because of https://github.com/rust-lang/rust/issues/65805 (?)
|
||||
fn sort_compare_custom<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
a: &Value<'gc>,
|
||||
b: &Value<'gc>,
|
||||
|
|
|
@ -28,7 +28,7 @@ impl<'gc> BroadcasterFunctions<'gc> {
|
|||
}
|
||||
|
||||
pub fn add_listener<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -57,7 +57,7 @@ pub fn add_listener<'gc>(
|
|||
}
|
||||
|
||||
pub fn remove_listener<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -102,7 +102,7 @@ pub fn remove_listener<'gc>(
|
|||
}
|
||||
|
||||
pub fn broadcast_message<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -117,7 +117,7 @@ pub fn broadcast_message<'gc>(
|
|||
}
|
||||
|
||||
pub fn broadcast_internal<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
call_args: &[Value<'gc>],
|
||||
method_name: &str,
|
||||
|
@ -138,7 +138,7 @@ pub fn broadcast_internal<'gc>(
|
|||
}
|
||||
|
||||
pub fn initialize<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -10,7 +10,7 @@ use gc_arena::MutationContext;
|
|||
|
||||
/// `Boolean` constructor
|
||||
pub fn constructor<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -30,7 +30,7 @@ pub fn constructor<'gc>(
|
|||
|
||||
/// `Boolean` function
|
||||
pub fn boolean_function<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -87,7 +87,7 @@ pub fn create_proto<'gc>(
|
|||
}
|
||||
|
||||
pub fn to_string<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -103,7 +103,7 @@ pub fn to_string<'gc>(
|
|||
}
|
||||
|
||||
pub fn value_of<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -20,7 +20,7 @@ pub fn create_proto<'gc>(
|
|||
|
||||
/// Implements `Button` constructor.
|
||||
pub fn constructor<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -12,7 +12,7 @@ use enumset::EnumSet;
|
|||
use gc_arena::MutationContext;
|
||||
|
||||
pub fn constructor<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
mut this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -74,7 +74,7 @@ pub fn create_proto<'gc>(
|
|||
|
||||
/// Gets the target display object of this color transform.
|
||||
fn target<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
) -> Result<Option<DisplayObject<'gc>>, Error<'gc>> {
|
||||
// The target path resolves based on the active tellTarget clip of the stack frame.
|
||||
|
@ -91,7 +91,7 @@ fn target<'gc>(
|
|||
}
|
||||
|
||||
fn get_rgb<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -107,7 +107,7 @@ fn get_rgb<'gc>(
|
|||
}
|
||||
|
||||
fn get_transform<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -132,7 +132,7 @@ fn get_transform<'gc>(
|
|||
}
|
||||
|
||||
fn set_rgb<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -157,7 +157,7 @@ fn set_rgb<'gc>(
|
|||
}
|
||||
|
||||
fn set_transform<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -165,7 +165,7 @@ fn set_transform<'gc>(
|
|||
// to the 16-bit range used by the internal representations of the Flash Player.
|
||||
// This will get slightly simpler when we change ColorTransform to the proper representation (see #193).
|
||||
fn set_color_mult<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
transform: Object<'gc>,
|
||||
property: &str,
|
||||
out: &mut f32,
|
||||
|
@ -181,7 +181,7 @@ fn set_transform<'gc>(
|
|||
}
|
||||
|
||||
fn set_color_add<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
transform: Object<'gc>,
|
||||
property: &str,
|
||||
out: &mut f32,
|
||||
|
|
|
@ -26,7 +26,7 @@ macro_rules! with_color_transform {
|
|||
}
|
||||
|
||||
pub fn constructor<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
|
@ -81,7 +81,7 @@ pub fn constructor<'gc>(
|
|||
#[allow(dead_code)]
|
||||
pub fn object_to_color_transform<'gc>(
|
||||
object: Object<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<ColorTransform, Error<'gc>> {
|
||||
let red_multiplier = object
|
||||
.get("redMultiplier", activation)?
|
||||
|
@ -121,7 +121,7 @@ pub fn object_to_color_transform<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_rgb<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -134,7 +134,7 @@ pub fn get_rgb<'gc>(
|
|||
}
|
||||
|
||||
pub fn set_rgb<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
|
@ -165,7 +165,7 @@ macro_rules! color_transform_value_accessor {
|
|||
($([$get_ident: ident, $set_ident: ident],)*) => {
|
||||
$(
|
||||
pub fn $set_ident<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
|
@ -181,7 +181,7 @@ macro_rules! color_transform_value_accessor {
|
|||
}
|
||||
|
||||
pub fn $get_ident<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -244,7 +244,7 @@ pub fn create_proto<'gc>(
|
|||
}
|
||||
|
||||
fn to_string<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
|
@ -267,7 +267,7 @@ fn to_string<'gc>(
|
|||
}
|
||||
|
||||
fn concat<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::avm1::{ScriptObject, Value};
|
|||
use gc_arena::MutationContext;
|
||||
|
||||
pub fn constructor<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -41,7 +41,7 @@ pub fn constructor<'gc>(
|
|||
}
|
||||
|
||||
pub fn copy<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -112,7 +112,7 @@ pub fn copy<'gc>(
|
|||
}
|
||||
|
||||
pub fn hide_builtin_items<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::avm1::{ScriptObject, Value};
|
|||
use gc_arena::MutationContext;
|
||||
|
||||
pub fn constructor<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
|
@ -55,7 +55,7 @@ pub fn constructor<'gc>(
|
|||
}
|
||||
|
||||
pub fn copy<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
|
|
|
@ -24,7 +24,7 @@ macro_rules! with_display_object {
|
|||
$(
|
||||
$object.force_set_function(
|
||||
$name,
|
||||
|activation: &mut Activation<'_, '_, 'gc, '_>, this, args| -> Result<Value<'gc>, Error<'gc>> {
|
||||
|activation: &mut Activation<'_, 'gc, '_>, this, args| -> Result<Value<'gc>, Error<'gc>> {
|
||||
if let Some(display_object) = this.as_display_object() {
|
||||
return $fn(display_object, activation, args);
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ pub fn define_display_object_proto<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_parent<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -123,7 +123,7 @@ pub fn get_parent<'gc>(
|
|||
|
||||
pub fn get_depth<'gc>(
|
||||
display_object: DisplayObject<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
if activation.current_swf_version() >= 6 {
|
||||
|
@ -135,7 +135,7 @@ pub fn get_depth<'gc>(
|
|||
}
|
||||
|
||||
pub fn overwrite_root<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -154,7 +154,7 @@ pub fn overwrite_root<'gc>(
|
|||
}
|
||||
|
||||
pub fn overwrite_global<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -173,7 +173,7 @@ pub fn overwrite_global<'gc>(
|
|||
}
|
||||
|
||||
pub fn overwrite_parent<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -8,7 +8,7 @@ use enumset::EnumSet;
|
|||
use gc_arena::MutationContext;
|
||||
|
||||
pub fn constructor<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
|
@ -44,7 +44,7 @@ pub fn create_proto<'gc>(
|
|||
}
|
||||
|
||||
fn to_string<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
|
|
|
@ -9,7 +9,7 @@ use gc_arena::MutationContext;
|
|||
|
||||
/// Implements `Function`
|
||||
pub fn constructor<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -18,7 +18,7 @@ pub fn constructor<'gc>(
|
|||
|
||||
/// Implements `Function.prototype.call`
|
||||
pub fn call<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
func: Object<'gc>,
|
||||
myargs: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -49,7 +49,7 @@ pub fn call<'gc>(
|
|||
|
||||
/// Implements `Function.prototype.apply`
|
||||
pub fn apply<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
func: Object<'gc>,
|
||||
myargs: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -87,7 +87,7 @@ pub fn apply<'gc>(
|
|||
|
||||
/// Implements `Function.prototype.toString`
|
||||
fn to_string<'gc>(
|
||||
_: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_: &mut Activation<'_, 'gc, '_>,
|
||||
_: Object<'gc>,
|
||||
_: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -8,7 +8,7 @@ use gc_arena::MutationContext;
|
|||
use std::convert::TryFrom;
|
||||
|
||||
pub fn is_down<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -24,7 +24,7 @@ pub fn is_down<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_code<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -12,7 +12,7 @@ use std::borrow::Cow;
|
|||
|
||||
/// Implements `LoadVars`
|
||||
pub fn constructor<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -120,7 +120,7 @@ pub fn create_proto<'gc>(
|
|||
}
|
||||
|
||||
fn add_request_header<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -129,7 +129,7 @@ fn add_request_header<'gc>(
|
|||
}
|
||||
|
||||
fn decode<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -150,7 +150,7 @@ fn decode<'gc>(
|
|||
}
|
||||
|
||||
fn get_bytes_loaded<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -159,7 +159,7 @@ fn get_bytes_loaded<'gc>(
|
|||
}
|
||||
|
||||
fn get_bytes_total<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -168,7 +168,7 @@ fn get_bytes_total<'gc>(
|
|||
}
|
||||
|
||||
fn load<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -183,7 +183,7 @@ fn load<'gc>(
|
|||
}
|
||||
|
||||
fn on_data<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -203,7 +203,7 @@ fn on_data<'gc>(
|
|||
}
|
||||
|
||||
fn on_load<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -212,7 +212,7 @@ fn on_load<'gc>(
|
|||
}
|
||||
|
||||
fn send<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -263,7 +263,7 @@ fn send<'gc>(
|
|||
}
|
||||
|
||||
fn send_and_load<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -286,7 +286,7 @@ fn send_and_load<'gc>(
|
|||
}
|
||||
|
||||
fn to_string<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -317,7 +317,7 @@ fn to_string<'gc>(
|
|||
}
|
||||
|
||||
fn spawn_load_var_fetch<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
loader_object: Object<'gc>,
|
||||
url: &AvmString,
|
||||
send_object: Option<(Object<'gc>, NavigationMethod)>,
|
||||
|
|
|
@ -28,7 +28,7 @@ macro_rules! wrap_std {
|
|||
}
|
||||
|
||||
fn atan2<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -46,7 +46,7 @@ fn atan2<'gc>(
|
|||
}
|
||||
|
||||
fn pow<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -63,7 +63,7 @@ fn pow<'gc>(
|
|||
}
|
||||
|
||||
fn round<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -78,7 +78,7 @@ fn round<'gc>(
|
|||
}
|
||||
|
||||
fn max<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -102,7 +102,7 @@ fn max<'gc>(
|
|||
}
|
||||
|
||||
fn min<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -126,7 +126,7 @@ fn min<'gc>(
|
|||
}
|
||||
|
||||
pub fn random<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -255,7 +255,7 @@ mod tests {
|
|||
use super::*;
|
||||
use crate::avm1::test_utils::with_avm;
|
||||
|
||||
fn setup<'gc>(activation: &mut Activation<'_, '_, 'gc, '_>) -> Object<'gc> {
|
||||
fn setup<'gc>(activation: &mut Activation<'_, 'gc, '_>) -> Object<'gc> {
|
||||
create(
|
||||
activation.context.gc_context,
|
||||
Some(activation.context.avm1.prototypes().object),
|
||||
|
|
|
@ -10,7 +10,7 @@ use swf::{Matrix, Twips};
|
|||
|
||||
pub fn value_to_matrix<'gc>(
|
||||
value: Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Matrix, Error<'gc>> {
|
||||
let a = value
|
||||
.coerce_to_object(activation)
|
||||
|
@ -46,7 +46,7 @@ pub fn value_to_matrix<'gc>(
|
|||
|
||||
pub fn gradient_object_to_matrix<'gc>(
|
||||
object: Object<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Matrix, Error<'gc>> {
|
||||
if object
|
||||
.get("matrixType", activation)?
|
||||
|
@ -73,7 +73,7 @@ pub fn gradient_object_to_matrix<'gc>(
|
|||
|
||||
pub fn object_to_matrix<'gc>(
|
||||
object: Object<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Matrix, Error<'gc>> {
|
||||
let a = object.get("a", activation)?.coerce_to_f64(activation)? as f32;
|
||||
let b = object.get("b", activation)?.coerce_to_f64(activation)? as f32;
|
||||
|
@ -89,7 +89,7 @@ pub fn object_to_matrix<'gc>(
|
|||
#[allow(dead_code)]
|
||||
pub fn matrix_to_object<'gc>(
|
||||
matrix: Matrix,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let args = [
|
||||
matrix.a.into(),
|
||||
|
@ -107,7 +107,7 @@ pub fn matrix_to_object<'gc>(
|
|||
pub fn apply_matrix_to_object<'gc>(
|
||||
matrix: Matrix,
|
||||
object: Object<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
object.set("a", matrix.a.into(), activation)?;
|
||||
object.set("b", matrix.b.into(), activation)?;
|
||||
|
@ -119,7 +119,7 @@ pub fn apply_matrix_to_object<'gc>(
|
|||
}
|
||||
|
||||
fn constructor<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -150,7 +150,7 @@ fn constructor<'gc>(
|
|||
}
|
||||
|
||||
fn identity<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -159,7 +159,7 @@ fn identity<'gc>(
|
|||
}
|
||||
|
||||
fn clone<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -177,7 +177,7 @@ fn clone<'gc>(
|
|||
}
|
||||
|
||||
fn scale<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -197,7 +197,7 @@ fn scale<'gc>(
|
|||
}
|
||||
|
||||
fn rotate<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -213,7 +213,7 @@ fn rotate<'gc>(
|
|||
}
|
||||
|
||||
fn translate<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -236,7 +236,7 @@ fn translate<'gc>(
|
|||
}
|
||||
|
||||
fn concat<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -249,7 +249,7 @@ fn concat<'gc>(
|
|||
}
|
||||
|
||||
fn invert<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -261,7 +261,7 @@ fn invert<'gc>(
|
|||
}
|
||||
|
||||
fn create_box<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -302,7 +302,7 @@ fn create_box<'gc>(
|
|||
}
|
||||
|
||||
fn create_gradient_box<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -343,7 +343,7 @@ fn create_gradient_box<'gc>(
|
|||
}
|
||||
|
||||
fn to_string<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::avm1::{Object, ScriptObject, Value};
|
|||
use gc_arena::MutationContext;
|
||||
|
||||
pub fn show_mouse<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -20,7 +20,7 @@ pub fn show_mouse<'gc>(
|
|||
}
|
||||
|
||||
pub fn hide_mouse<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -23,7 +23,7 @@ use swf::{
|
|||
|
||||
/// Implements `MovieClip`
|
||||
pub fn constructor<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -35,7 +35,7 @@ macro_rules! with_movie_clip {
|
|||
$(
|
||||
$object.force_set_function(
|
||||
$name,
|
||||
|activation: &mut Activation<'_, '_, 'gc, '_>, this, args| -> Result<Value<'gc>, Error<'gc>> {
|
||||
|activation: &mut Activation<'_, 'gc, '_>, this, args| -> Result<Value<'gc>, Error<'gc>> {
|
||||
if let Some(display_object) = this.as_display_object() {
|
||||
if let Some(movie_clip) = display_object.as_movie_clip() {
|
||||
return $fn(movie_clip, activation, args);
|
||||
|
@ -54,7 +54,7 @@ macro_rules! with_movie_clip {
|
|||
#[allow(clippy::comparison_chain)]
|
||||
pub fn hit_test<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
if args.len() > 1 {
|
||||
|
@ -147,7 +147,7 @@ pub fn create_proto<'gc>(
|
|||
|
||||
fn line_style<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
if let Some(width) = args.get(0) {
|
||||
|
@ -203,7 +203,7 @@ fn line_style<'gc>(
|
|||
_ => LineJoinStyle::Round,
|
||||
};
|
||||
movie_clip.set_line_style(
|
||||
activation.context,
|
||||
&mut activation.context,
|
||||
Some(LineStyle {
|
||||
width,
|
||||
color,
|
||||
|
@ -218,14 +218,14 @@ fn line_style<'gc>(
|
|||
}),
|
||||
);
|
||||
} else {
|
||||
movie_clip.set_line_style(activation.context, None);
|
||||
movie_clip.set_line_style(&mut activation.context, None);
|
||||
}
|
||||
Ok(Value::Undefined)
|
||||
}
|
||||
|
||||
fn begin_fill<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
if let Some(rgb) = args.get(0) {
|
||||
|
@ -238,18 +238,18 @@ fn begin_fill<'gc>(
|
|||
/ 100.0
|
||||
* 255.0;
|
||||
movie_clip.set_fill_style(
|
||||
activation.context,
|
||||
&mut activation.context,
|
||||
Some(FillStyle::Color(Color::from_rgb(rgb, alpha as u8))),
|
||||
);
|
||||
} else {
|
||||
movie_clip.set_fill_style(activation.context, None);
|
||||
movie_clip.set_fill_style(&mut activation.context, None);
|
||||
}
|
||||
Ok(Value::Undefined)
|
||||
}
|
||||
|
||||
fn begin_gradient_fill<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
if let (Some(method), Some(colors), Some(alphas), Some(ratios), Some(matrix)) = (
|
||||
|
@ -327,23 +327,23 @@ fn begin_gradient_fill<'gc>(
|
|||
return Ok(Value::Undefined);
|
||||
}
|
||||
};
|
||||
movie_clip.set_fill_style(activation.context, Some(style));
|
||||
movie_clip.set_fill_style(&mut activation.context, Some(style));
|
||||
} else {
|
||||
movie_clip.set_fill_style(activation.context, None);
|
||||
movie_clip.set_fill_style(&mut activation.context, None);
|
||||
}
|
||||
Ok(Value::Undefined)
|
||||
}
|
||||
|
||||
fn move_to<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
if let (Some(x), Some(y)) = (args.get(0), args.get(1)) {
|
||||
let x = x.coerce_to_f64(activation)?;
|
||||
let y = y.coerce_to_f64(activation)?;
|
||||
movie_clip.draw_command(
|
||||
activation.context,
|
||||
&mut activation.context,
|
||||
DrawCommand::MoveTo {
|
||||
x: Twips::from_pixels(x),
|
||||
y: Twips::from_pixels(y),
|
||||
|
@ -355,14 +355,14 @@ fn move_to<'gc>(
|
|||
|
||||
fn line_to<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
if let (Some(x), Some(y)) = (args.get(0), args.get(1)) {
|
||||
let x = x.coerce_to_f64(activation)?;
|
||||
let y = y.coerce_to_f64(activation)?;
|
||||
movie_clip.draw_command(
|
||||
activation.context,
|
||||
&mut activation.context,
|
||||
DrawCommand::LineTo {
|
||||
x: Twips::from_pixels(x),
|
||||
y: Twips::from_pixels(y),
|
||||
|
@ -374,7 +374,7 @@ fn line_to<'gc>(
|
|||
|
||||
fn curve_to<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
if let (Some(x1), Some(y1), Some(x2), Some(y2)) =
|
||||
|
@ -385,7 +385,7 @@ fn curve_to<'gc>(
|
|||
let x2 = x2.coerce_to_f64(activation)?;
|
||||
let y2 = y2.coerce_to_f64(activation)?;
|
||||
movie_clip.draw_command(
|
||||
activation.context,
|
||||
&mut activation.context,
|
||||
DrawCommand::CurveTo {
|
||||
x1: Twips::from_pixels(x1),
|
||||
y1: Twips::from_pixels(y1),
|
||||
|
@ -399,25 +399,25 @@ fn curve_to<'gc>(
|
|||
|
||||
fn end_fill<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
movie_clip.set_fill_style(activation.context, None);
|
||||
movie_clip.set_fill_style(&mut activation.context, None);
|
||||
Ok(Value::Undefined)
|
||||
}
|
||||
|
||||
fn clear<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
movie_clip.clear(activation.context);
|
||||
movie_clip.clear(&mut activation.context);
|
||||
Ok(Value::Undefined)
|
||||
}
|
||||
|
||||
fn attach_movie<'gc>(
|
||||
mut movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let (export_name, new_instance_name, depth) = match &args[0..3] {
|
||||
|
@ -450,14 +450,14 @@ fn attach_movie<'gc>(
|
|||
{
|
||||
// Set name and attach to parent.
|
||||
new_clip.set_name(activation.context.gc_context, &new_instance_name);
|
||||
movie_clip.add_child_from_avm(activation.context, new_clip, depth);
|
||||
movie_clip.add_child_from_avm(&mut activation.context, new_clip, depth);
|
||||
let init_object = if let Some(Value::Object(init_object)) = init_object {
|
||||
Some(init_object.to_owned())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
new_clip.post_instantiation(activation.context, new_clip, init_object, true);
|
||||
new_clip.run_frame(activation.context);
|
||||
new_clip.post_instantiation(&mut activation.context, new_clip, init_object, true);
|
||||
new_clip.run_frame(&mut activation.context);
|
||||
|
||||
Ok(new_clip.object().coerce_to_object(activation).into())
|
||||
} else {
|
||||
|
@ -468,7 +468,7 @@ fn attach_movie<'gc>(
|
|||
|
||||
fn create_empty_movie_clip<'gc>(
|
||||
mut movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let (new_instance_name, depth) = match &args[0..2] {
|
||||
|
@ -493,16 +493,16 @@ fn create_empty_movie_clip<'gc>(
|
|||
|
||||
// Set name and attach to parent.
|
||||
new_clip.set_name(activation.context.gc_context, &new_instance_name);
|
||||
movie_clip.add_child_from_avm(activation.context, new_clip.into(), depth);
|
||||
new_clip.post_instantiation(activation.context, new_clip.into(), None, true);
|
||||
new_clip.run_frame(activation.context);
|
||||
movie_clip.add_child_from_avm(&mut activation.context, new_clip.into(), depth);
|
||||
new_clip.post_instantiation(&mut activation.context, new_clip.into(), None, true);
|
||||
new_clip.run_frame(&mut activation.context);
|
||||
|
||||
Ok(new_clip.object())
|
||||
}
|
||||
|
||||
fn create_text_field<'gc>(
|
||||
mut movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let movie = activation.base_clip().movie().unwrap();
|
||||
|
@ -534,17 +534,17 @@ fn create_text_field<'gc>(
|
|||
.coerce_to_f64(activation)?;
|
||||
|
||||
let mut text_field: DisplayObject<'gc> =
|
||||
EditText::new(activation.context, movie, x, y, width, height).into();
|
||||
EditText::new(&mut activation.context, movie, x, y, width, height).into();
|
||||
text_field.set_name(
|
||||
activation.context.gc_context,
|
||||
&instance_name.coerce_to_string(activation)?,
|
||||
);
|
||||
movie_clip.add_child_from_avm(
|
||||
activation.context,
|
||||
&mut activation.context,
|
||||
text_field,
|
||||
(depth as Depth).wrapping_add(AVM_DEPTH_BIAS),
|
||||
);
|
||||
text_field.post_instantiation(activation.context, text_field, None, true);
|
||||
text_field.post_instantiation(&mut activation.context, text_field, None, true);
|
||||
|
||||
if activation.current_swf_version() >= 8 {
|
||||
//SWF8+ returns the `TextField` instance here
|
||||
|
@ -556,7 +556,7 @@ fn create_text_field<'gc>(
|
|||
|
||||
fn duplicate_movie_clip<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
// duplicateMovieClip method uses biased depth compared to CloneSprite
|
||||
|
@ -565,7 +565,7 @@ fn duplicate_movie_clip<'gc>(
|
|||
|
||||
pub fn duplicate_movie_clip_with_bias<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
depth_bias: i32,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -603,7 +603,7 @@ pub fn duplicate_movie_clip_with_bias<'gc>(
|
|||
{
|
||||
// Set name and attach to parent.
|
||||
new_clip.set_name(activation.context.gc_context, &new_instance_name);
|
||||
parent.add_child_from_avm(activation.context, new_clip, depth);
|
||||
parent.add_child_from_avm(&mut activation.context, new_clip, depth);
|
||||
|
||||
// Copy display properties from previous clip to new clip.
|
||||
new_clip.set_matrix(activation.context.gc_context, &*movie_clip.matrix());
|
||||
|
@ -619,8 +619,8 @@ pub fn duplicate_movie_clip_with_bias<'gc>(
|
|||
// Definitely not ScriptObject properties.
|
||||
|
||||
let init_object = init_object.map(|v| v.coerce_to_object(activation));
|
||||
new_clip.post_instantiation(activation.context, new_clip, init_object, true);
|
||||
new_clip.run_frame(activation.context);
|
||||
new_clip.post_instantiation(&mut activation.context, new_clip, init_object, true);
|
||||
new_clip.run_frame(&mut activation.context);
|
||||
|
||||
Ok(new_clip.object().coerce_to_object(activation).into())
|
||||
} else {
|
||||
|
@ -635,7 +635,7 @@ pub fn duplicate_movie_clip_with_bias<'gc>(
|
|||
|
||||
fn get_bytes_loaded<'gc>(
|
||||
_movie_clip: MovieClip<'gc>,
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
// TODO find a correct value
|
||||
|
@ -644,7 +644,7 @@ fn get_bytes_loaded<'gc>(
|
|||
|
||||
fn get_bytes_total<'gc>(
|
||||
_movie_clip: MovieClip<'gc>,
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
// TODO find a correct value
|
||||
|
@ -653,7 +653,7 @@ fn get_bytes_total<'gc>(
|
|||
|
||||
fn get_next_highest_depth<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
if activation.current_swf_version() >= 7 {
|
||||
|
@ -672,7 +672,7 @@ fn get_next_highest_depth<'gc>(
|
|||
|
||||
fn goto_and_play<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
goto_frame(movie_clip, activation, args, false, 0)
|
||||
|
@ -680,7 +680,7 @@ fn goto_and_play<'gc>(
|
|||
|
||||
fn goto_and_stop<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
goto_frame(movie_clip, activation, args, true, 0)
|
||||
|
@ -688,7 +688,7 @@ fn goto_and_stop<'gc>(
|
|||
|
||||
pub fn goto_frame<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
stop: bool,
|
||||
scene_offset: u16,
|
||||
|
@ -732,7 +732,7 @@ pub fn goto_frame<'gc>(
|
|||
frame = frame.wrapping_add(i32::from(scene_offset));
|
||||
frame = frame.saturating_add(1);
|
||||
if frame > 0 {
|
||||
clip.goto_frame(activation.context, frame as u16, stop);
|
||||
clip.goto_frame(&mut activation.context, frame as u16, stop);
|
||||
}
|
||||
}
|
||||
Ok(Value::Undefined)
|
||||
|
@ -740,38 +740,38 @@ pub fn goto_frame<'gc>(
|
|||
|
||||
fn next_frame<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
movie_clip.next_frame(activation.context);
|
||||
movie_clip.next_frame(&mut activation.context);
|
||||
Ok(Value::Undefined)
|
||||
}
|
||||
|
||||
fn play<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
movie_clip.play(activation.context);
|
||||
movie_clip.play(&mut activation.context);
|
||||
Ok(Value::Undefined)
|
||||
}
|
||||
|
||||
fn prev_frame<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
movie_clip.prev_frame(activation.context);
|
||||
movie_clip.prev_frame(&mut activation.context);
|
||||
Ok(Value::Undefined)
|
||||
}
|
||||
|
||||
fn remove_movie_clip<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
// removeMovieClip method uses biased depth compared to RemoveSprite
|
||||
remove_movie_clip_with_bias(movie_clip, activation.context, AVM_DEPTH_BIAS)
|
||||
remove_movie_clip_with_bias(movie_clip, &mut activation.context, AVM_DEPTH_BIAS)
|
||||
}
|
||||
|
||||
pub fn remove_movie_clip_with_bias<'gc>(
|
||||
|
@ -799,7 +799,7 @@ pub fn remove_movie_clip_with_bias<'gc>(
|
|||
|
||||
fn start_drag<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
crate::avm1::start_drag(movie_clip.into(), activation, args);
|
||||
|
@ -808,16 +808,16 @@ fn start_drag<'gc>(
|
|||
|
||||
fn stop<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
movie_clip.stop(activation.context);
|
||||
movie_clip.stop(&mut activation.context);
|
||||
Ok(Value::Undefined)
|
||||
}
|
||||
|
||||
fn stop_drag<'gc>(
|
||||
_movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
// It doesn't matter which clip we call this on; it simply stops any active drag.
|
||||
|
@ -827,7 +827,7 @@ fn stop_drag<'gc>(
|
|||
|
||||
fn swap_depths<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let arg = args.get(0).cloned().unwrap_or(Value::Undefined);
|
||||
|
@ -863,7 +863,7 @@ fn swap_depths<'gc>(
|
|||
}
|
||||
|
||||
if depth != movie_clip.depth() {
|
||||
parent.swap_child_to_depth(activation.context, movie_clip.into(), depth);
|
||||
parent.swap_child_to_depth(&mut activation.context, movie_clip.into(), depth);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -872,7 +872,7 @@ fn swap_depths<'gc>(
|
|||
|
||||
fn to_string<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
Ok(AvmString::new(activation.context.gc_context, movie_clip.path()).into())
|
||||
|
@ -880,7 +880,7 @@ fn to_string<'gc>(
|
|||
|
||||
fn local_to_global<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
if let Value::Object(point) = args.get(0).unwrap_or(&Value::Undefined) {
|
||||
|
@ -913,7 +913,7 @@ fn local_to_global<'gc>(
|
|||
|
||||
fn get_bounds<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let target = match args.get(0) {
|
||||
|
@ -961,7 +961,7 @@ fn get_bounds<'gc>(
|
|||
|
||||
fn get_rect<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
// TODO: This should get the bounds ignoring strokes. Always equal to or smaller than getBounds.
|
||||
|
@ -972,7 +972,7 @@ fn get_rect<'gc>(
|
|||
#[allow(unused_must_use)] //can't use errors yet
|
||||
pub fn get_url<'a, 'gc>(
|
||||
_movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -1009,7 +1009,7 @@ pub fn get_url<'a, 'gc>(
|
|||
|
||||
fn global_to_local<'gc>(
|
||||
movie_clip: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
if let Value::Object(point) = args.get(0).unwrap_or(&Value::Undefined) {
|
||||
|
@ -1042,7 +1042,7 @@ fn global_to_local<'gc>(
|
|||
|
||||
fn load_movie<'gc>(
|
||||
target: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let url_val = args.get(0).cloned().unwrap_or(Value::Undefined);
|
||||
|
@ -1066,7 +1066,7 @@ fn load_movie<'gc>(
|
|||
|
||||
fn load_variables<'gc>(
|
||||
target: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let url_val = args.get(0).cloned().unwrap_or(Value::Undefined);
|
||||
|
@ -1089,10 +1089,10 @@ fn load_variables<'gc>(
|
|||
|
||||
fn unload_movie<'gc>(
|
||||
mut target: MovieClip<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
target.unload(activation.context);
|
||||
target.unload(&mut activation.context);
|
||||
target.replace_with_movie(activation.context.gc_context, None);
|
||||
|
||||
Ok(Value::Undefined)
|
||||
|
|
|
@ -12,7 +12,7 @@ use enumset::EnumSet;
|
|||
use gc_arena::MutationContext;
|
||||
|
||||
pub fn constructor<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -32,7 +32,7 @@ pub fn constructor<'gc>(
|
|||
}
|
||||
|
||||
pub fn add_listener<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -49,7 +49,7 @@ pub fn add_listener<'gc>(
|
|||
}
|
||||
|
||||
pub fn remove_listener<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -91,7 +91,7 @@ pub fn remove_listener<'gc>(
|
|||
}
|
||||
|
||||
pub fn broadcast_message<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -114,7 +114,7 @@ pub fn broadcast_message<'gc>(
|
|||
}
|
||||
|
||||
pub fn load_clip<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -149,7 +149,7 @@ pub fn load_clip<'gc>(
|
|||
}
|
||||
|
||||
pub fn unload_clip<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -160,7 +160,7 @@ pub fn unload_clip<'gc>(
|
|||
.as_display_object()
|
||||
.and_then(|dobj| dobj.as_movie_clip())
|
||||
{
|
||||
movieclip.unload(activation.context);
|
||||
movieclip.unload(&mut activation.context);
|
||||
movieclip.replace_with_movie(activation.context.gc_context, None);
|
||||
|
||||
return Ok(true.into());
|
||||
|
@ -171,7 +171,7 @@ pub fn unload_clip<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_progress<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -11,7 +11,7 @@ use gc_arena::MutationContext;
|
|||
|
||||
/// `Number` constructor
|
||||
pub fn number<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -31,7 +31,7 @@ pub fn number<'gc>(
|
|||
|
||||
/// `Number` function
|
||||
pub fn number_function<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -127,7 +127,7 @@ pub fn create_proto<'gc>(
|
|||
}
|
||||
|
||||
fn to_string<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -201,7 +201,7 @@ fn to_string<'gc>(
|
|||
}
|
||||
|
||||
fn value_of<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -13,7 +13,7 @@ use std::borrow::Cow;
|
|||
|
||||
/// Implements `Object` constructor
|
||||
pub fn constructor<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -22,7 +22,7 @@ pub fn constructor<'gc>(
|
|||
|
||||
/// Implements `Object` function
|
||||
pub fn object_function<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -35,7 +35,7 @@ pub fn object_function<'gc>(
|
|||
|
||||
/// Implements `Object.prototype.addProperty`
|
||||
pub fn add_property<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -78,7 +78,7 @@ pub fn add_property<'gc>(
|
|||
|
||||
/// Implements `Object.prototype.hasOwnProperty`
|
||||
pub fn has_own_property<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -92,7 +92,7 @@ pub fn has_own_property<'gc>(
|
|||
|
||||
/// Implements `Object.prototype.toString`
|
||||
fn to_string<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_: Object<'gc>,
|
||||
_: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -101,7 +101,7 @@ fn to_string<'gc>(
|
|||
|
||||
/// Implements `Object.prototype.isPropertyEnumerable`
|
||||
fn is_property_enumerable<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -113,7 +113,7 @@ fn is_property_enumerable<'gc>(
|
|||
|
||||
/// Implements `Object.prototype.isPrototypeOf`
|
||||
fn is_prototype_of<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -128,7 +128,7 @@ fn is_prototype_of<'gc>(
|
|||
|
||||
/// Implements `Object.prototype.valueOf`
|
||||
fn value_of<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -137,7 +137,7 @@ fn value_of<'gc>(
|
|||
|
||||
/// Implements `Object.registerClass`
|
||||
pub fn register_class<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -175,7 +175,7 @@ pub fn register_class<'gc>(
|
|||
|
||||
/// Implements `Object.prototype.watch`
|
||||
fn watch<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -206,7 +206,7 @@ fn watch<'gc>(
|
|||
|
||||
/// Implements `Object.prototype.unmwatch`
|
||||
fn unwatch<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
|
@ -304,7 +304,7 @@ pub fn fill_proto<'gc>(
|
|||
/// declare the property flags of a given property. It's not part of
|
||||
/// `Object.prototype`, and I suspect that's a deliberate omission.
|
||||
pub fn as_set_prop_flags<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -11,7 +11,7 @@ use std::f64::NAN;
|
|||
|
||||
pub fn point_to_object<'gc>(
|
||||
point: (f64, f64),
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let args = [point.0.into(), point.1.into()];
|
||||
construct_new_point(&args, activation)
|
||||
|
@ -19,7 +19,7 @@ pub fn point_to_object<'gc>(
|
|||
|
||||
pub fn construct_new_point<'gc>(
|
||||
args: &[Value<'gc>],
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let constructor = activation.context.avm1.prototypes.point_constructor;
|
||||
let object = constructor.construct(activation, &args)?;
|
||||
|
@ -28,7 +28,7 @@ pub fn construct_new_point<'gc>(
|
|||
|
||||
pub fn value_to_point<'gc>(
|
||||
value: Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<(f64, f64), Error<'gc>> {
|
||||
let x = value
|
||||
.coerce_to_object(activation)
|
||||
|
@ -43,7 +43,7 @@ pub fn value_to_point<'gc>(
|
|||
|
||||
pub fn object_to_point<'gc>(
|
||||
object: Object<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<(f64, f64), Error<'gc>> {
|
||||
let x = object.get("x", activation)?.coerce_to_f64(activation)?;
|
||||
let y = object.get("y", activation)?.coerce_to_f64(activation)?;
|
||||
|
@ -51,7 +51,7 @@ pub fn object_to_point<'gc>(
|
|||
}
|
||||
|
||||
fn constructor<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -75,7 +75,7 @@ fn constructor<'gc>(
|
|||
}
|
||||
|
||||
fn clone<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -87,7 +87,7 @@ fn clone<'gc>(
|
|||
}
|
||||
|
||||
fn equals<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -104,7 +104,7 @@ fn equals<'gc>(
|
|||
}
|
||||
|
||||
fn add<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -119,7 +119,7 @@ fn add<'gc>(
|
|||
}
|
||||
|
||||
fn subtract<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -134,7 +134,7 @@ fn subtract<'gc>(
|
|||
}
|
||||
|
||||
fn distance<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -154,7 +154,7 @@ fn distance<'gc>(
|
|||
}
|
||||
|
||||
fn polar<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -171,7 +171,7 @@ fn polar<'gc>(
|
|||
}
|
||||
|
||||
fn interpolate<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -187,7 +187,7 @@ fn interpolate<'gc>(
|
|||
}
|
||||
|
||||
fn to_string<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -206,7 +206,7 @@ fn to_string<'gc>(
|
|||
}
|
||||
|
||||
fn length<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -216,7 +216,7 @@ fn length<'gc>(
|
|||
}
|
||||
|
||||
fn normalize<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -244,7 +244,7 @@ fn normalize<'gc>(
|
|||
}
|
||||
|
||||
fn offset<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -11,7 +11,7 @@ use gc_arena::MutationContext;
|
|||
use std::f64::NAN;
|
||||
|
||||
fn constructor<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -47,7 +47,7 @@ fn constructor<'gc>(
|
|||
}
|
||||
|
||||
fn to_string<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -83,7 +83,7 @@ pub fn create_rectangle_object<'gc>(
|
|||
}
|
||||
|
||||
fn is_empty<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -93,7 +93,7 @@ fn is_empty<'gc>(
|
|||
}
|
||||
|
||||
fn set_empty<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -105,7 +105,7 @@ fn set_empty<'gc>(
|
|||
}
|
||||
|
||||
fn clone<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -121,7 +121,7 @@ fn clone<'gc>(
|
|||
}
|
||||
|
||||
fn contains<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -150,7 +150,7 @@ fn contains<'gc>(
|
|||
}
|
||||
|
||||
fn contains_point<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -171,7 +171,7 @@ fn contains_point<'gc>(
|
|||
}
|
||||
|
||||
fn contains_rectangle<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -203,7 +203,7 @@ fn contains_rectangle<'gc>(
|
|||
}
|
||||
|
||||
fn intersects<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -231,7 +231,7 @@ fn intersects<'gc>(
|
|||
}
|
||||
|
||||
fn union<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -295,7 +295,7 @@ fn union<'gc>(
|
|||
}
|
||||
|
||||
fn inflate<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -323,7 +323,7 @@ fn inflate<'gc>(
|
|||
}
|
||||
|
||||
fn inflate_point<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -345,7 +345,7 @@ fn inflate_point<'gc>(
|
|||
}
|
||||
|
||||
fn offset<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -369,7 +369,7 @@ fn offset<'gc>(
|
|||
}
|
||||
|
||||
fn offset_point<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -387,7 +387,7 @@ fn offset_point<'gc>(
|
|||
}
|
||||
|
||||
fn intersection<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -448,7 +448,7 @@ fn intersection<'gc>(
|
|||
}
|
||||
|
||||
fn equals<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -475,7 +475,7 @@ fn equals<'gc>(
|
|||
}
|
||||
|
||||
fn get_left<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -483,7 +483,7 @@ fn get_left<'gc>(
|
|||
}
|
||||
|
||||
fn set_left<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -500,7 +500,7 @@ fn set_left<'gc>(
|
|||
}
|
||||
|
||||
fn get_top<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -508,7 +508,7 @@ fn get_top<'gc>(
|
|||
}
|
||||
|
||||
fn set_top<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -525,7 +525,7 @@ fn set_top<'gc>(
|
|||
}
|
||||
|
||||
fn get_right<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -535,7 +535,7 @@ fn get_right<'gc>(
|
|||
}
|
||||
|
||||
fn set_right<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -552,7 +552,7 @@ fn set_right<'gc>(
|
|||
}
|
||||
|
||||
fn get_bottom<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -562,7 +562,7 @@ fn get_bottom<'gc>(
|
|||
}
|
||||
|
||||
fn set_bottom<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -579,7 +579,7 @@ fn set_bottom<'gc>(
|
|||
}
|
||||
|
||||
fn get_size<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -590,7 +590,7 @@ fn get_size<'gc>(
|
|||
}
|
||||
|
||||
fn set_size<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -607,7 +607,7 @@ fn set_size<'gc>(
|
|||
}
|
||||
|
||||
fn get_top_left<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -618,7 +618,7 @@ fn get_top_left<'gc>(
|
|||
}
|
||||
|
||||
fn set_top_left<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -649,7 +649,7 @@ fn set_top_left<'gc>(
|
|||
}
|
||||
|
||||
fn get_bottom_right<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -662,7 +662,7 @@ fn get_bottom_right<'gc>(
|
|||
}
|
||||
|
||||
fn set_bottom_right<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -11,7 +11,7 @@ use crate::avm1::object::shared_object::SharedObject;
|
|||
use json::JsonValue;
|
||||
|
||||
pub fn delete_all<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -20,7 +20,7 @@ pub fn delete_all<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_disk_usage<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -32,7 +32,7 @@ pub fn get_disk_usage<'gc>(
|
|||
/// It would be best if this was implemented via serde but due to avm and context it can't
|
||||
/// Undefined fields aren't serialized
|
||||
fn recursive_serialize<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
obj: Object<'gc>,
|
||||
json_obj: &mut JsonValue,
|
||||
) {
|
||||
|
@ -66,7 +66,7 @@ fn recursive_serialize<'gc>(
|
|||
/// Undefined fields aren't deserialized
|
||||
fn recursive_deserialize<'gc>(
|
||||
json_obj: JsonValue,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
object: Object<'gc>,
|
||||
) {
|
||||
for entry in json_obj.entries() {
|
||||
|
@ -132,7 +132,7 @@ fn recursive_deserialize<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_local<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -187,7 +187,7 @@ pub fn get_local<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_remote<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -196,7 +196,7 @@ pub fn get_remote<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_max_size<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -205,7 +205,7 @@ pub fn get_max_size<'gc>(
|
|||
}
|
||||
|
||||
pub fn add_listener<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -214,7 +214,7 @@ pub fn add_listener<'gc>(
|
|||
}
|
||||
|
||||
pub fn remove_listener<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -295,7 +295,7 @@ pub fn create_shared_object_object<'gc>(
|
|||
}
|
||||
|
||||
pub fn clear<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -314,7 +314,7 @@ pub fn clear<'gc>(
|
|||
}
|
||||
|
||||
pub fn close<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -323,7 +323,7 @@ pub fn close<'gc>(
|
|||
}
|
||||
|
||||
pub fn connect<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -332,7 +332,7 @@ pub fn connect<'gc>(
|
|||
}
|
||||
|
||||
pub fn flush<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -352,7 +352,7 @@ pub fn flush<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_size<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -361,7 +361,7 @@ pub fn get_size<'gc>(
|
|||
}
|
||||
|
||||
pub fn send<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -370,7 +370,7 @@ pub fn send<'gc>(
|
|||
}
|
||||
|
||||
pub fn set_fps<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -379,7 +379,7 @@ pub fn set_fps<'gc>(
|
|||
}
|
||||
|
||||
pub fn on_status<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -388,7 +388,7 @@ pub fn on_status<'gc>(
|
|||
}
|
||||
|
||||
pub fn on_sync<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -456,7 +456,7 @@ pub fn create_proto<'gc>(
|
|||
}
|
||||
|
||||
pub fn constructor<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -13,7 +13,7 @@ use gc_arena::MutationContext;
|
|||
|
||||
/// Implements `Sound`
|
||||
pub fn constructor<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -176,7 +176,7 @@ pub fn create_proto<'gc>(
|
|||
}
|
||||
|
||||
fn attach_sound<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -221,7 +221,7 @@ fn attach_sound<'gc>(
|
|||
}
|
||||
|
||||
fn duration<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -237,7 +237,7 @@ fn duration<'gc>(
|
|||
}
|
||||
|
||||
fn get_bytes_loaded<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -250,7 +250,7 @@ fn get_bytes_loaded<'gc>(
|
|||
}
|
||||
|
||||
fn get_bytes_total<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -263,7 +263,7 @@ fn get_bytes_total<'gc>(
|
|||
}
|
||||
|
||||
fn get_pan<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -272,7 +272,7 @@ fn get_pan<'gc>(
|
|||
}
|
||||
|
||||
fn get_transform<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -281,7 +281,7 @@ fn get_transform<'gc>(
|
|||
}
|
||||
|
||||
fn get_volume<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -290,7 +290,7 @@ fn get_volume<'gc>(
|
|||
}
|
||||
|
||||
fn id3<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -301,7 +301,7 @@ fn id3<'gc>(
|
|||
}
|
||||
|
||||
fn load_sound<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -312,7 +312,7 @@ fn load_sound<'gc>(
|
|||
}
|
||||
|
||||
fn position<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -335,7 +335,7 @@ fn position<'gc>(
|
|||
}
|
||||
|
||||
fn set_pan<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -344,7 +344,7 @@ fn set_pan<'gc>(
|
|||
}
|
||||
|
||||
fn set_transform<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -353,7 +353,7 @@ fn set_transform<'gc>(
|
|||
}
|
||||
|
||||
fn set_volume<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -362,7 +362,7 @@ fn set_volume<'gc>(
|
|||
}
|
||||
|
||||
fn start<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -413,7 +413,7 @@ fn start<'gc>(
|
|||
}
|
||||
|
||||
fn stop<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -105,7 +105,7 @@ pub fn create_stage_object<'gc>(
|
|||
}
|
||||
|
||||
fn align<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -114,7 +114,7 @@ fn align<'gc>(
|
|||
}
|
||||
|
||||
fn set_align<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -123,7 +123,7 @@ fn set_align<'gc>(
|
|||
}
|
||||
|
||||
fn height<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -131,7 +131,7 @@ fn height<'gc>(
|
|||
}
|
||||
|
||||
fn scale_mode<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -140,7 +140,7 @@ fn scale_mode<'gc>(
|
|||
}
|
||||
|
||||
fn set_scale_mode<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -149,7 +149,7 @@ fn set_scale_mode<'gc>(
|
|||
}
|
||||
|
||||
fn show_menu<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -158,7 +158,7 @@ fn show_menu<'gc>(
|
|||
}
|
||||
|
||||
fn set_show_menu<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -167,7 +167,7 @@ fn set_show_menu<'gc>(
|
|||
}
|
||||
|
||||
fn width<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -12,7 +12,7 @@ use gc_arena::MutationContext;
|
|||
|
||||
/// `String` constructor
|
||||
pub fn string<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -33,7 +33,7 @@ pub fn string<'gc>(
|
|||
|
||||
/// `String` function
|
||||
pub fn string_function<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -185,7 +185,7 @@ pub fn create_proto<'gc>(
|
|||
}
|
||||
|
||||
fn char_at<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -210,7 +210,7 @@ fn char_at<'gc>(
|
|||
}
|
||||
|
||||
fn char_code_at<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -232,7 +232,7 @@ fn char_code_at<'gc>(
|
|||
}
|
||||
|
||||
fn concat<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -245,7 +245,7 @@ fn concat<'gc>(
|
|||
}
|
||||
|
||||
fn from_char_code<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -263,7 +263,7 @@ fn from_char_code<'gc>(
|
|||
}
|
||||
|
||||
fn index_of<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -310,7 +310,7 @@ fn index_of<'gc>(
|
|||
}
|
||||
|
||||
fn last_index_of<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -361,7 +361,7 @@ fn last_index_of<'gc>(
|
|||
}
|
||||
|
||||
fn slice<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -396,7 +396,7 @@ fn slice<'gc>(
|
|||
}
|
||||
|
||||
fn split<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -436,7 +436,7 @@ fn split<'gc>(
|
|||
}
|
||||
|
||||
fn substr<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -460,7 +460,7 @@ fn substr<'gc>(
|
|||
}
|
||||
|
||||
fn substring<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -491,7 +491,7 @@ fn substring<'gc>(
|
|||
}
|
||||
|
||||
fn to_lower_case<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -508,7 +508,7 @@ fn to_lower_case<'gc>(
|
|||
|
||||
/// `String.toString` / `String.valueOf` impl
|
||||
pub fn to_string_value_of<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -525,7 +525,7 @@ pub fn to_string_value_of<'gc>(
|
|||
}
|
||||
|
||||
fn to_upper_case<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -399,7 +399,7 @@ impl Default for SystemProperties {
|
|||
}
|
||||
|
||||
pub fn set_clipboard<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -415,7 +415,7 @@ pub fn set_clipboard<'gc>(
|
|||
}
|
||||
|
||||
pub fn show_settings<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -438,7 +438,7 @@ pub fn show_settings<'gc>(
|
|||
}
|
||||
|
||||
pub fn set_use_code_page<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -454,7 +454,7 @@ pub fn set_use_code_page<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_use_code_page<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -462,7 +462,7 @@ pub fn get_use_code_page<'gc>(
|
|||
}
|
||||
|
||||
pub fn set_exact_settings<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -478,7 +478,7 @@ pub fn set_exact_settings<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_exact_settings<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -486,7 +486,7 @@ pub fn get_exact_settings<'gc>(
|
|||
}
|
||||
|
||||
pub fn on_status<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -10,7 +10,7 @@ use gc_arena::MutationContext;
|
|||
macro_rules! capabilities_func {
|
||||
($func_name: ident, $capability: expr) => {
|
||||
pub fn $func_name<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -22,7 +22,7 @@ macro_rules! capabilities_func {
|
|||
macro_rules! inverse_capabilities_func {
|
||||
($func_name: ident, $capability: expr) => {
|
||||
pub fn $func_name<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -74,7 +74,7 @@ inverse_capabilities_func!(get_is_av_hardware_disabled, SystemCapabilities::AvHa
|
|||
inverse_capabilities_func!(get_is_windowless_disabled, SystemCapabilities::WindowLess);
|
||||
|
||||
pub fn get_player_type<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -86,7 +86,7 @@ pub fn get_player_type<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_screen_color<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -98,7 +98,7 @@ pub fn get_screen_color<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_language<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -115,7 +115,7 @@ pub fn get_language<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_screen_resolution_x<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -123,7 +123,7 @@ pub fn get_screen_resolution_x<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_screen_resolution_y<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -131,7 +131,7 @@ pub fn get_screen_resolution_y<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_pixel_aspect_ratio<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -139,7 +139,7 @@ pub fn get_pixel_aspect_ratio<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_screen_dpi<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -147,7 +147,7 @@ pub fn get_screen_dpi<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_manufacturer<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -163,7 +163,7 @@ pub fn get_manufacturer<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_os_name<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -175,7 +175,7 @@ pub fn get_os_name<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_version<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -190,7 +190,7 @@ pub fn get_version<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_server_string<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -202,7 +202,7 @@ pub fn get_server_string<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_cpu_architecture<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -214,7 +214,7 @@ pub fn get_cpu_architecture<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_max_idc_level<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -9,7 +9,7 @@ use gc_arena::MutationContext;
|
|||
use std::convert::Into;
|
||||
|
||||
fn on_ime_composition<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -17,7 +17,7 @@ fn on_ime_composition<'gc>(
|
|||
}
|
||||
|
||||
fn do_conversion<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -25,7 +25,7 @@ fn do_conversion<'gc>(
|
|||
}
|
||||
|
||||
fn get_conversion_mode<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -33,7 +33,7 @@ fn get_conversion_mode<'gc>(
|
|||
}
|
||||
|
||||
fn get_enabled<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -41,7 +41,7 @@ fn get_enabled<'gc>(
|
|||
}
|
||||
|
||||
fn set_composition_string<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -49,7 +49,7 @@ fn set_composition_string<'gc>(
|
|||
}
|
||||
|
||||
fn set_conversion_mode<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -57,7 +57,7 @@ fn set_conversion_mode<'gc>(
|
|||
}
|
||||
|
||||
fn set_enabled<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -9,7 +9,7 @@ use gc_arena::MutationContext;
|
|||
use std::convert::Into;
|
||||
|
||||
fn allow_domain<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -18,7 +18,7 @@ fn allow_domain<'gc>(
|
|||
}
|
||||
|
||||
fn allow_insecure_domain<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -30,7 +30,7 @@ fn allow_insecure_domain<'gc>(
|
|||
}
|
||||
|
||||
fn load_policy_file<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -42,7 +42,7 @@ fn load_policy_file<'gc>(
|
|||
}
|
||||
|
||||
fn escape_domain<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -51,7 +51,7 @@ fn escape_domain<'gc>(
|
|||
}
|
||||
|
||||
fn get_sandbox_type<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -63,7 +63,7 @@ fn get_sandbox_type<'gc>(
|
|||
}
|
||||
|
||||
fn get_choose_local_swf_path<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -75,7 +75,7 @@ fn get_choose_local_swf_path<'gc>(
|
|||
}
|
||||
|
||||
fn policy_file_resolver<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -11,7 +11,7 @@ use gc_arena::MutationContext;
|
|||
|
||||
/// Implements `TextField`
|
||||
pub fn constructor<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -19,7 +19,7 @@ pub fn constructor<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_text<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -32,7 +32,7 @@ pub fn get_text<'gc>(
|
|||
}
|
||||
|
||||
pub fn set_text<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -41,7 +41,7 @@ pub fn set_text<'gc>(
|
|||
if let Some(value) = args.get(0) {
|
||||
if let Err(err) = text_field.set_text(
|
||||
value.coerce_to_string(activation)?.to_string(),
|
||||
activation.context,
|
||||
&mut activation.context,
|
||||
) {
|
||||
avm_error!(activation, "Error when setting TextField.text: {}", err);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ pub fn set_text<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_html<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -66,7 +66,7 @@ pub fn get_html<'gc>(
|
|||
}
|
||||
|
||||
pub fn set_html<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -74,7 +74,7 @@ pub fn set_html<'gc>(
|
|||
if let Some(text_field) = display_object.as_edit_text() {
|
||||
if let Some(value) = args.get(0) {
|
||||
text_field.set_is_html(
|
||||
activation.context,
|
||||
&mut activation.context,
|
||||
value.as_bool(activation.current_swf_version()),
|
||||
);
|
||||
}
|
||||
|
@ -84,13 +84,13 @@ pub fn set_html<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_html_text<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
if let Some(display_object) = this.as_display_object() {
|
||||
if let Some(text_field) = display_object.as_edit_text() {
|
||||
if let Ok(text) = text_field.html_text(activation.context) {
|
||||
if let Ok(text) = text_field.html_text(&mut activation.context) {
|
||||
return Ok(AvmString::new(activation.context.gc_context, text).into());
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ pub fn get_html_text<'gc>(
|
|||
}
|
||||
|
||||
pub fn set_html_text<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -109,7 +109,7 @@ pub fn set_html_text<'gc>(
|
|||
.get(0)
|
||||
.unwrap_or(&Value::Undefined)
|
||||
.coerce_to_string(activation)?;
|
||||
let _ = text_field.set_html_text(text.to_string(), activation.context);
|
||||
let _ = text_field.set_html_text(text.to_string(), &mut activation.context);
|
||||
// Changing the htmlText does NOT update variable bindings (does not call EditText::propagate_text_binding).
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ pub fn set_html_text<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_border<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -131,7 +131,7 @@ pub fn get_border<'gc>(
|
|||
}
|
||||
|
||||
pub fn set_border<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -147,7 +147,7 @@ pub fn set_border<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_embed_fonts<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -161,7 +161,7 @@ pub fn get_embed_fonts<'gc>(
|
|||
}
|
||||
|
||||
pub fn set_embed_fonts<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -169,7 +169,7 @@ pub fn set_embed_fonts<'gc>(
|
|||
if let Some(text_field) = display_object.as_edit_text() {
|
||||
if let Some(value) = args.get(0) {
|
||||
let embed_fonts = value.as_bool(activation.current_swf_version());
|
||||
text_field.set_is_device_font(activation.context, !embed_fonts);
|
||||
text_field.set_is_device_font(&mut activation.context, !embed_fonts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ pub fn set_embed_fonts<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_length<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -194,7 +194,7 @@ macro_rules! with_text_field {
|
|||
$(
|
||||
$object.force_set_function(
|
||||
$name,
|
||||
|activation: &mut Activation<'_, '_, 'gc, '_>, this, args| -> Result<Value<'gc>, Error<'gc>> {
|
||||
|activation: &mut Activation<'_, 'gc, '_>, this, args| -> Result<Value<'gc>, Error<'gc>> {
|
||||
if let Some(display_object) = this.as_display_object() {
|
||||
if let Some(text_field) = display_object.as_edit_text() {
|
||||
return $fn(text_field, activation, args);
|
||||
|
@ -211,7 +211,7 @@ macro_rules! with_text_field {
|
|||
}
|
||||
|
||||
pub fn text_width<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -219,7 +219,7 @@ pub fn text_width<'gc>(
|
|||
.as_display_object()
|
||||
.and_then(|dobj| dobj.as_edit_text())
|
||||
{
|
||||
let metrics = etext.measure_text(activation.context);
|
||||
let metrics = etext.measure_text(&mut activation.context);
|
||||
|
||||
return Ok(metrics.0.to_pixels().into());
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ pub fn text_width<'gc>(
|
|||
}
|
||||
|
||||
pub fn text_height<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -236,7 +236,7 @@ pub fn text_height<'gc>(
|
|||
.as_display_object()
|
||||
.and_then(|dobj| dobj.as_edit_text())
|
||||
{
|
||||
let metrics = etext.measure_text(activation.context);
|
||||
let metrics = etext.measure_text(&mut activation.context);
|
||||
|
||||
return Ok(metrics.1.to_pixels().into());
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ pub fn text_height<'gc>(
|
|||
}
|
||||
|
||||
pub fn multiline<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -260,7 +260,7 @@ pub fn multiline<'gc>(
|
|||
}
|
||||
|
||||
pub fn set_multiline<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -274,14 +274,14 @@ pub fn set_multiline<'gc>(
|
|||
.as_display_object()
|
||||
.and_then(|dobj| dobj.as_edit_text())
|
||||
{
|
||||
etext.set_multiline(is_multiline, activation.context);
|
||||
etext.set_multiline(is_multiline, &mut activation.context);
|
||||
}
|
||||
|
||||
Ok(Value::Undefined)
|
||||
}
|
||||
|
||||
fn variable<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -299,7 +299,7 @@ fn variable<'gc>(
|
|||
}
|
||||
|
||||
fn set_variable<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -319,7 +319,7 @@ fn set_variable<'gc>(
|
|||
}
|
||||
|
||||
pub fn word_wrap<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -334,7 +334,7 @@ pub fn word_wrap<'gc>(
|
|||
}
|
||||
|
||||
pub fn set_word_wrap<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -348,14 +348,14 @@ pub fn set_word_wrap<'gc>(
|
|||
.as_display_object()
|
||||
.and_then(|dobj| dobj.as_edit_text())
|
||||
{
|
||||
etext.set_word_wrap(is_word_wrap, activation.context);
|
||||
etext.set_word_wrap(is_word_wrap, &mut activation.context);
|
||||
}
|
||||
|
||||
Ok(Value::Undefined)
|
||||
}
|
||||
|
||||
pub fn auto_size<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -375,7 +375,7 @@ pub fn auto_size<'gc>(
|
|||
}
|
||||
|
||||
pub fn set_auto_size<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -391,7 +391,7 @@ pub fn set_auto_size<'gc>(
|
|||
Value::Bool(true) => AutoSizeMode::Left,
|
||||
_ => AutoSizeMode::None,
|
||||
},
|
||||
activation.context,
|
||||
&mut activation.context,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -619,7 +619,7 @@ pub fn attach_virtual_properties<'gc>(
|
|||
|
||||
fn get_new_text_format<'gc>(
|
||||
text_field: EditText<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let tf = text_field.new_text_format();
|
||||
|
@ -629,14 +629,14 @@ fn get_new_text_format<'gc>(
|
|||
|
||||
fn set_new_text_format<'gc>(
|
||||
text_field: EditText<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let tf = args.get(0).cloned().unwrap_or(Value::Undefined);
|
||||
|
||||
if let Value::Object(tf) = tf {
|
||||
let tf_parsed = TextFormat::from_avm1_object(tf, activation)?;
|
||||
text_field.set_new_text_format(tf_parsed, activation.context);
|
||||
text_field.set_new_text_format(tf_parsed, &mut activation.context);
|
||||
}
|
||||
|
||||
Ok(Value::Undefined)
|
||||
|
@ -644,7 +644,7 @@ fn set_new_text_format<'gc>(
|
|||
|
||||
fn get_text_format<'gc>(
|
||||
text_field: EditText<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let (from, to) = match (args.get(0), args.get(1)) {
|
||||
|
@ -667,7 +667,7 @@ fn get_text_format<'gc>(
|
|||
|
||||
fn set_text_format<'gc>(
|
||||
text_field: EditText<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let tf = args.last().cloned().unwrap_or(Value::Undefined);
|
||||
|
@ -687,7 +687,7 @@ fn set_text_format<'gc>(
|
|||
_ => (0, text_field.text_length()),
|
||||
};
|
||||
|
||||
text_field.set_text_format(from, to, tf_parsed, activation.context);
|
||||
text_field.set_text_format(from, to, tf_parsed, &mut activation.context);
|
||||
}
|
||||
|
||||
Ok(Value::Undefined)
|
||||
|
@ -695,7 +695,7 @@ fn set_text_format<'gc>(
|
|||
|
||||
fn replace_text<'gc>(
|
||||
text_field: EditText<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let from = args
|
||||
|
@ -715,7 +715,7 @@ fn replace_text<'gc>(
|
|||
.coerce_to_string(activation)?
|
||||
.to_string();
|
||||
|
||||
text_field.replace_text(from as usize, to as usize, &text, activation.context);
|
||||
text_field.replace_text(from as usize, to as usize, &text, &mut activation.context);
|
||||
|
||||
Ok(Value::Undefined)
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ use gc_arena::MutationContext;
|
|||
fn map_defined_to_string<'gc>(
|
||||
name: &str,
|
||||
this: Object<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
val: Option<Value<'gc>>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
let val = match val {
|
||||
|
@ -30,7 +30,7 @@ fn map_defined_to_string<'gc>(
|
|||
fn map_defined_to_number<'gc>(
|
||||
name: &str,
|
||||
this: Object<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
val: Option<Value<'gc>>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
let val = match val {
|
||||
|
@ -48,7 +48,7 @@ fn map_defined_to_number<'gc>(
|
|||
fn map_defined_to_bool<'gc>(
|
||||
name: &str,
|
||||
this: Object<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
val: Option<Value<'gc>>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
let val = match val {
|
||||
|
@ -65,7 +65,7 @@ fn map_defined_to_bool<'gc>(
|
|||
|
||||
/// `TextFormat` constructor
|
||||
pub fn constructor<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -42,7 +42,7 @@ fn is_as2_compatible(node: XMLNode<'_>) -> bool {
|
|||
|
||||
/// XMLNode constructor
|
||||
pub fn xmlnode_constructor<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -74,7 +74,7 @@ pub fn xmlnode_constructor<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_append_child<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -101,7 +101,7 @@ pub fn xmlnode_append_child<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_insert_before<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -131,7 +131,7 @@ pub fn xmlnode_insert_before<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_clone_node<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -153,7 +153,7 @@ pub fn xmlnode_clone_node<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_get_namespace_for_prefix<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -172,7 +172,7 @@ pub fn xmlnode_get_namespace_for_prefix<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_get_prefix_for_namespace<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -191,7 +191,7 @@ pub fn xmlnode_get_prefix_for_namespace<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_has_child_nodes<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -203,7 +203,7 @@ pub fn xmlnode_has_child_nodes<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_remove_node<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -219,7 +219,7 @@ pub fn xmlnode_remove_node<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_to_string<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -240,7 +240,7 @@ pub fn xmlnode_to_string<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_local_name<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -252,7 +252,7 @@ pub fn xmlnode_local_name<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_node_name<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -264,7 +264,7 @@ pub fn xmlnode_node_name<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_node_type<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -283,7 +283,7 @@ pub fn xmlnode_node_type<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_node_value<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -295,7 +295,7 @@ pub fn xmlnode_node_value<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_prefix<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -315,7 +315,7 @@ pub fn xmlnode_prefix<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_child_nodes<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -353,7 +353,7 @@ pub fn xmlnode_child_nodes<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_first_child<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -377,7 +377,7 @@ pub fn xmlnode_first_child<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_last_child<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -401,7 +401,7 @@ pub fn xmlnode_last_child<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_parent_node<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -424,7 +424,7 @@ pub fn xmlnode_parent_node<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_previous_sibling<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -453,7 +453,7 @@ pub fn xmlnode_previous_sibling<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_next_sibling<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -482,7 +482,7 @@ pub fn xmlnode_next_sibling<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_attributes<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -497,7 +497,7 @@ pub fn xmlnode_attributes<'gc>(
|
|||
}
|
||||
|
||||
pub fn xmlnode_namespace_uri<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -767,7 +767,7 @@ pub fn create_xmlnode_proto<'gc>(
|
|||
|
||||
/// XML (document) constructor
|
||||
pub fn xml_constructor<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -804,7 +804,7 @@ pub fn xml_constructor<'gc>(
|
|||
}
|
||||
|
||||
pub fn xml_create_element<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -831,7 +831,7 @@ pub fn xml_create_element<'gc>(
|
|||
}
|
||||
|
||||
pub fn xml_create_text_node<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -858,7 +858,7 @@ pub fn xml_create_text_node<'gc>(
|
|||
}
|
||||
|
||||
pub fn xml_parse_xml<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -894,7 +894,7 @@ pub fn xml_parse_xml<'gc>(
|
|||
}
|
||||
|
||||
pub fn xml_load<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -930,7 +930,7 @@ pub fn xml_load<'gc>(
|
|||
}
|
||||
|
||||
pub fn xml_on_data<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -955,7 +955,7 @@ pub fn xml_on_data<'gc>(
|
|||
}
|
||||
|
||||
pub fn xml_doc_type_decl<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -978,7 +978,7 @@ pub fn xml_doc_type_decl<'gc>(
|
|||
}
|
||||
|
||||
pub fn xml_xml_decl<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -1000,7 +1000,7 @@ pub fn xml_xml_decl<'gc>(
|
|||
}
|
||||
|
||||
pub fn xml_id_map<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
@ -1015,7 +1015,7 @@ pub fn xml_id_map<'gc>(
|
|||
}
|
||||
|
||||
pub fn xml_status<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -65,7 +65,7 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy
|
|||
fn get_local(
|
||||
&self,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>>;
|
||||
|
||||
|
@ -73,7 +73,7 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy
|
|||
fn get(
|
||||
&self,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
if self.has_own_property(activation, name) {
|
||||
self.get_local(name, activation, (*self).into())
|
||||
|
@ -87,7 +87,7 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy
|
|||
&self,
|
||||
name: &str,
|
||||
value: Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<(), Error<'gc>>;
|
||||
|
||||
/// Call the underlying object.
|
||||
|
@ -98,7 +98,7 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy
|
|||
fn call(
|
||||
&self,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
base_proto: Option<Object<'gc>>,
|
||||
args: &[Value<'gc>],
|
||||
|
@ -108,7 +108,7 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy
|
|||
/// Calling this on something other than a constructor will return a new Undefined object.
|
||||
fn construct(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
Ok(Value::Undefined.coerce_to_object(activation))
|
||||
|
@ -117,7 +117,7 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy
|
|||
/// Takes an already existing object and performs this constructor (if valid) on it.
|
||||
fn construct_on_existing(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
mut _this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<(), Error<'gc>> {
|
||||
|
@ -135,7 +135,7 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy
|
|||
&self,
|
||||
name: &str,
|
||||
args: &[Value<'gc>],
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let (method, base_proto) =
|
||||
search_prototype(Some((*self).into()), name, activation, (*self).into())?;
|
||||
|
@ -162,7 +162,7 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy
|
|||
&self,
|
||||
name: &str,
|
||||
value: Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Option<Object<'gc>>;
|
||||
|
||||
/// Construct a host object of some kind and return it's cell.
|
||||
|
@ -174,14 +174,14 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy
|
|||
/// initialize the object.
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
) -> Result<Object<'gc>, Error<'gc>>;
|
||||
|
||||
/// Delete a named property from the object.
|
||||
///
|
||||
/// Returns false if the property cannot be deleted.
|
||||
fn delete(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool;
|
||||
fn delete(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool;
|
||||
|
||||
/// Retrieve the `__proto__` of a given object.
|
||||
///
|
||||
|
@ -262,7 +262,7 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy
|
|||
/// as `__proto__`.
|
||||
fn add_property_with_case(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
name: &str,
|
||||
get: Object<'gc>,
|
||||
|
@ -275,7 +275,7 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy
|
|||
/// The property does not need to exist at the time of this being called.
|
||||
fn set_watcher(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
name: Cow<str>,
|
||||
callback: Object<'gc>,
|
||||
|
@ -288,31 +288,27 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy
|
|||
/// called.
|
||||
fn remove_watcher(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
name: Cow<str>,
|
||||
) -> bool;
|
||||
|
||||
/// Checks if the object has a given named property.
|
||||
fn has_property(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool;
|
||||
fn has_property(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool;
|
||||
|
||||
/// Checks if the object has a given named property on itself (and not,
|
||||
/// say, the object's prototype or superclass)
|
||||
fn has_own_property(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool;
|
||||
fn has_own_property(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool;
|
||||
|
||||
/// Checks if the object has a given named property on itself that is
|
||||
/// virtual.
|
||||
fn has_own_virtual(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool;
|
||||
fn has_own_virtual(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool;
|
||||
|
||||
/// Checks if a named property appears when enumerating the object.
|
||||
fn is_property_enumerable(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
name: &str,
|
||||
) -> bool;
|
||||
fn is_property_enumerable(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool;
|
||||
|
||||
/// Enumerate the object.
|
||||
fn get_keys(&self, activation: &mut Activation<'_, '_, 'gc, '_>) -> Vec<String>;
|
||||
fn get_keys(&self, activation: &mut Activation<'_, 'gc, '_>) -> Vec<String>;
|
||||
|
||||
/// Coerce the object into a string.
|
||||
fn as_string(&self) -> Cow<str>;
|
||||
|
@ -343,7 +339,7 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy
|
|||
/// somehow could this would support that, too.
|
||||
fn is_instance_of(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
constructor: Object<'gc>,
|
||||
prototype: Object<'gc>,
|
||||
) -> Result<bool, Error<'gc>> {
|
||||
|
@ -497,7 +493,7 @@ impl<'gc> Object<'gc> {
|
|||
pub fn search_prototype<'gc>(
|
||||
mut proto: Option<Object<'gc>>,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
) -> Result<(Value<'gc>, Option<Object<'gc>>), Error<'gc>> {
|
||||
let mut depth = 0;
|
||||
|
|
|
@ -98,7 +98,7 @@ impl<'gc> TObject<'gc> for ColorTransformObject<'gc> {
|
|||
&self,
|
||||
name: &str,
|
||||
value: Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
let base = self.0.read().base;
|
||||
base.internal_set(
|
||||
|
@ -117,7 +117,7 @@ impl<'gc> TObject<'gc> for ColorTransformObject<'gc> {
|
|||
#[allow(clippy::new_ret_no_self)]
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
Ok(ColorTransformObject::empty_color_transform_object(
|
||||
|
|
|
@ -4,7 +4,7 @@ macro_rules! impl_custom_object_without_set {
|
|||
fn get_local(
|
||||
&self,
|
||||
name: &str,
|
||||
activation: &mut crate::avm1::Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut crate::avm1::Activation<'_, 'gc, '_>,
|
||||
this: crate::avm1::Object<'gc>,
|
||||
) -> Result<crate::avm1::Value<'gc>, crate::avm1::Error<'gc>> {
|
||||
self.0.read().$field.get_local(name, activation, this)
|
||||
|
@ -13,7 +13,7 @@ macro_rules! impl_custom_object_without_set {
|
|||
fn call(
|
||||
&self,
|
||||
name: &str,
|
||||
activation: &mut crate::avm1::Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut crate::avm1::Activation<'_, 'gc, '_>,
|
||||
this: crate::avm1::Object<'gc>,
|
||||
base_proto: Option<crate::avm1::Object<'gc>>,
|
||||
args: &[crate::avm1::Value<'gc>],
|
||||
|
@ -28,14 +28,14 @@ macro_rules! impl_custom_object_without_set {
|
|||
&self,
|
||||
name: &str,
|
||||
value: crate::avm1::Value<'gc>,
|
||||
activation: &mut crate::avm1::Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut crate::avm1::Activation<'_, 'gc, '_>,
|
||||
) -> Option<crate::avm1::object::Object<'gc>> {
|
||||
self.0.read().$field.call_setter(name, value, activation)
|
||||
}
|
||||
|
||||
fn delete(
|
||||
&self,
|
||||
activation: &mut crate::avm1::Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut crate::avm1::Activation<'_, 'gc, '_>,
|
||||
name: &str,
|
||||
) -> bool {
|
||||
self.0.read().$field.delete(activation, name)
|
||||
|
@ -97,7 +97,7 @@ macro_rules! impl_custom_object_without_set {
|
|||
|
||||
fn add_property_with_case(
|
||||
&self,
|
||||
activation: &mut crate::avm1::Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut crate::avm1::Activation<'_, 'gc, '_>,
|
||||
gc_context: gc_arena::MutationContext<'gc, '_>,
|
||||
name: &str,
|
||||
get: crate::avm1::object::Object<'gc>,
|
||||
|
@ -112,7 +112,7 @@ macro_rules! impl_custom_object_without_set {
|
|||
|
||||
fn has_property(
|
||||
&self,
|
||||
activation: &mut crate::avm1::Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut crate::avm1::Activation<'_, 'gc, '_>,
|
||||
name: &str,
|
||||
) -> bool {
|
||||
self.0.read().$field.has_property(activation, name)
|
||||
|
@ -120,7 +120,7 @@ macro_rules! impl_custom_object_without_set {
|
|||
|
||||
fn has_own_property(
|
||||
&self,
|
||||
activation: &mut crate::avm1::Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut crate::avm1::Activation<'_, 'gc, '_>,
|
||||
name: &str,
|
||||
) -> bool {
|
||||
self.0.read().$field.has_own_property(activation, name)
|
||||
|
@ -128,7 +128,7 @@ macro_rules! impl_custom_object_without_set {
|
|||
|
||||
fn has_own_virtual(
|
||||
&self,
|
||||
activation: &mut crate::avm1::Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut crate::avm1::Activation<'_, 'gc, '_>,
|
||||
name: &str,
|
||||
) -> bool {
|
||||
self.0.read().$field.has_own_virtual(activation, name)
|
||||
|
@ -136,7 +136,7 @@ macro_rules! impl_custom_object_without_set {
|
|||
|
||||
fn is_property_enumerable(
|
||||
&self,
|
||||
activation: &mut crate::avm1::Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut crate::avm1::Activation<'_, 'gc, '_>,
|
||||
name: &str,
|
||||
) -> bool {
|
||||
self.0
|
||||
|
@ -145,10 +145,7 @@ macro_rules! impl_custom_object_without_set {
|
|||
.is_property_enumerable(activation, name)
|
||||
}
|
||||
|
||||
fn get_keys(
|
||||
&self,
|
||||
activation: &mut crate::avm1::Activation<'_, '_, 'gc, '_>,
|
||||
) -> Vec<String> {
|
||||
fn get_keys(&self, activation: &mut crate::avm1::Activation<'_, 'gc, '_>) -> Vec<String> {
|
||||
self.0.read().$field.get_keys(activation)
|
||||
}
|
||||
|
||||
|
@ -221,7 +218,7 @@ macro_rules! impl_custom_object_without_set {
|
|||
|
||||
fn set_watcher(
|
||||
&self,
|
||||
activation: &mut crate::avm1::Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut crate::avm1::Activation<'_, 'gc, '_>,
|
||||
gc_context: gc_arena::MutationContext<'gc, '_>,
|
||||
name: std::borrow::Cow<str>,
|
||||
callback: crate::avm1::object::Object<'gc>,
|
||||
|
@ -235,7 +232,7 @@ macro_rules! impl_custom_object_without_set {
|
|||
|
||||
fn remove_watcher(
|
||||
&self,
|
||||
activation: &mut crate::avm1::Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut crate::avm1::Activation<'_, 'gc, '_>,
|
||||
gc_context: gc_arena::MutationContext<'gc, '_>,
|
||||
name: std::borrow::Cow<str>,
|
||||
) -> bool {
|
||||
|
@ -256,7 +253,7 @@ macro_rules! impl_custom_object {
|
|||
&self,
|
||||
name: &str,
|
||||
value: crate::avm1::Value<'gc>,
|
||||
activation: &mut crate::avm1::Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut crate::avm1::Activation<'_, 'gc, '_>,
|
||||
) -> Result<(), crate::avm1::Error<'gc>> {
|
||||
self.0.read().$field.set(name, value, activation)
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ impl<'gc> Watcher<'gc> {
|
|||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn call(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
|
||||
name: &str,
|
||||
old_value: Value<'gc>,
|
||||
|
@ -254,7 +254,7 @@ impl<'gc> ScriptObject<'gc> {
|
|||
&self,
|
||||
name: &str,
|
||||
mut value: Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
base_proto: Option<Object<'gc>>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
|
@ -395,7 +395,7 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> {
|
|||
fn get_local(
|
||||
&self,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
if name == "__proto__" {
|
||||
|
@ -448,7 +448,7 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> {
|
|||
&self,
|
||||
name: &str,
|
||||
value: Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
self.internal_set(
|
||||
name,
|
||||
|
@ -467,7 +467,7 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> {
|
|||
fn call(
|
||||
&self,
|
||||
_name: &str,
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_base_proto: Option<Object<'gc>>,
|
||||
_args: &[Value<'gc>],
|
||||
|
@ -479,7 +479,7 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> {
|
|||
&self,
|
||||
name: &str,
|
||||
value: Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Option<Object<'gc>> {
|
||||
match self
|
||||
.0
|
||||
|
@ -495,7 +495,7 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> {
|
|||
#[allow(clippy::new_ret_no_self)]
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
match self.0.read().array {
|
||||
|
@ -511,7 +511,7 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> {
|
|||
/// Delete a named property from the object.
|
||||
///
|
||||
/// Returns false if the property cannot be deleted.
|
||||
fn delete(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn delete(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
let mut object = self.0.write(activation.context.gc_context);
|
||||
if let Some(prop) = object.values.get(name, activation.is_case_sensitive()) {
|
||||
if prop.can_delete() {
|
||||
|
@ -544,7 +544,7 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> {
|
|||
|
||||
fn add_property_with_case(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
name: &str,
|
||||
get: Object<'gc>,
|
||||
|
@ -564,7 +564,7 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> {
|
|||
|
||||
fn set_watcher(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
name: Cow<str>,
|
||||
callback: Object<'gc>,
|
||||
|
@ -579,7 +579,7 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> {
|
|||
|
||||
fn remove_watcher(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
name: Cow<str>,
|
||||
) -> bool {
|
||||
|
@ -637,7 +637,7 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> {
|
|||
}
|
||||
|
||||
/// Checks if the object has a given named property.
|
||||
fn has_property(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn has_property(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.has_own_property(activation, name)
|
||||
|| self
|
||||
.proto()
|
||||
|
@ -647,7 +647,7 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> {
|
|||
|
||||
/// Checks if the object has a given named property on itself (and not,
|
||||
/// say, the object's prototype or superclass)
|
||||
fn has_own_property(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn has_own_property(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
if name == "__proto__" {
|
||||
return true;
|
||||
}
|
||||
|
@ -657,7 +657,7 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> {
|
|||
.contains_key(name, activation.is_case_sensitive())
|
||||
}
|
||||
|
||||
fn has_own_virtual(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn has_own_virtual(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
if let Some(slot) = self
|
||||
.0
|
||||
.read()
|
||||
|
@ -671,11 +671,7 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> {
|
|||
}
|
||||
|
||||
/// Checks if a named property appears when enumerating the object.
|
||||
fn is_property_enumerable(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
name: &str,
|
||||
) -> bool {
|
||||
fn is_property_enumerable(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
if let Some(prop) = self
|
||||
.0
|
||||
.read()
|
||||
|
@ -689,7 +685,7 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> {
|
|||
}
|
||||
|
||||
/// Enumerate the object.
|
||||
fn get_keys(&self, activation: &mut Activation<'_, '_, 'gc, '_>) -> Vec<String> {
|
||||
fn get_keys(&self, activation: &mut Activation<'_, 'gc, '_>) -> Vec<String> {
|
||||
let proto_keys = self
|
||||
.proto()
|
||||
.map_or_else(Vec::new, |p| p.get_keys(activation));
|
||||
|
@ -865,7 +861,7 @@ mod tests {
|
|||
|
||||
fn with_object<F, R>(swf_version: u8, test: F) -> R
|
||||
where
|
||||
F: for<'a, 'gc> FnOnce(&mut Activation<'_, '_, 'gc, '_>, Object<'gc>) -> R,
|
||||
F: for<'a, 'gc> FnOnce(&mut Activation<'_, 'gc, '_>, Object<'gc>) -> R,
|
||||
{
|
||||
rootless_arena(|gc_context| {
|
||||
let mut avm = Avm1::new(gc_context, swf_version);
|
||||
|
@ -920,7 +916,7 @@ mod tests {
|
|||
let base_clip = *context.levels.get(&0).unwrap();
|
||||
let swf_version = context.swf.version();
|
||||
let mut activation = Activation::from_nothing(
|
||||
&mut context,
|
||||
context,
|
||||
ActivationIdentifier::root("[Test]"),
|
||||
swf_version,
|
||||
globals,
|
||||
|
|
|
@ -65,7 +65,7 @@ impl<'gc> TObject<'gc> for SharedObject<'gc> {
|
|||
#[allow(clippy::new_ret_no_self)]
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
Ok(SharedObject::empty_shared_obj(
|
||||
|
|
|
@ -128,7 +128,7 @@ impl<'gc> TObject<'gc> for SoundObject<'gc> {
|
|||
#[allow(clippy::new_ret_no_self)]
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
|
||||
_this: Object<'gc>,
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -128,7 +128,7 @@ impl<'gc> TObject<'gc> for StageObject<'gc> {
|
|||
fn get(
|
||||
&self,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let obj = self.0.read();
|
||||
let props = activation.context.avm1.display_properties;
|
||||
|
@ -146,7 +146,7 @@ impl<'gc> TObject<'gc> for StageObject<'gc> {
|
|||
Ok(child.object())
|
||||
} else if let Some(level) =
|
||||
obj.display_object
|
||||
.get_level_by_path(name, activation.context, case_sensitive)
|
||||
.get_level_by_path(name, &mut activation.context, case_sensitive)
|
||||
{
|
||||
// 4) _levelN
|
||||
Ok(level.object())
|
||||
|
@ -160,7 +160,7 @@ impl<'gc> TObject<'gc> for StageObject<'gc> {
|
|||
fn get_local(
|
||||
&self,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
self.0.read().base.get_local(name, activation, this)
|
||||
|
@ -170,7 +170,7 @@ impl<'gc> TObject<'gc> for StageObject<'gc> {
|
|||
&self,
|
||||
name: &str,
|
||||
value: Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
let obj = self.0.read();
|
||||
let props = activation.context.avm1.display_properties;
|
||||
|
@ -183,7 +183,7 @@ impl<'gc> TObject<'gc> for StageObject<'gc> {
|
|||
{
|
||||
let _ = binding.text_field.set_html_text(
|
||||
value.coerce_to_string(activation)?.to_string(),
|
||||
activation.context,
|
||||
&mut activation.context,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ impl<'gc> TObject<'gc> for StageObject<'gc> {
|
|||
fn call(
|
||||
&self,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
base_proto: Option<Object<'gc>>,
|
||||
args: &[Value<'gc>],
|
||||
|
@ -229,7 +229,7 @@ impl<'gc> TObject<'gc> for StageObject<'gc> {
|
|||
&self,
|
||||
name: &str,
|
||||
value: Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Option<Object<'gc>> {
|
||||
self.0.read().base.call_setter(name, value, activation)
|
||||
}
|
||||
|
@ -237,14 +237,14 @@ impl<'gc> TObject<'gc> for StageObject<'gc> {
|
|||
#[allow(clippy::new_ret_no_self)]
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
//TODO: Create a StageObject of some kind
|
||||
self.0.read().base.create_bare_object(activation, this)
|
||||
}
|
||||
|
||||
fn delete(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn delete(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.0.read().base.delete(activation, name)
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ impl<'gc> TObject<'gc> for StageObject<'gc> {
|
|||
|
||||
fn add_property_with_case(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
name: &str,
|
||||
get: Object<'gc>,
|
||||
|
@ -315,7 +315,7 @@ impl<'gc> TObject<'gc> for StageObject<'gc> {
|
|||
|
||||
fn set_watcher(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
name: Cow<str>,
|
||||
callback: Object<'gc>,
|
||||
|
@ -329,7 +329,7 @@ impl<'gc> TObject<'gc> for StageObject<'gc> {
|
|||
|
||||
fn remove_watcher(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
name: Cow<str>,
|
||||
) -> bool {
|
||||
|
@ -339,7 +339,7 @@ impl<'gc> TObject<'gc> for StageObject<'gc> {
|
|||
.remove_watcher(activation, gc_context, name)
|
||||
}
|
||||
|
||||
fn has_property(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn has_property(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
let obj = self.0.read();
|
||||
if obj.base.has_property(activation, name) {
|
||||
return true;
|
||||
|
@ -367,7 +367,7 @@ impl<'gc> TObject<'gc> for StageObject<'gc> {
|
|||
|
||||
if obj
|
||||
.display_object
|
||||
.get_level_by_path(name, activation.context, case_sensitive)
|
||||
.get_level_by_path(name, &mut activation.context, case_sensitive)
|
||||
.is_some()
|
||||
{
|
||||
return true;
|
||||
|
@ -376,24 +376,20 @@ impl<'gc> TObject<'gc> for StageObject<'gc> {
|
|||
false
|
||||
}
|
||||
|
||||
fn has_own_property(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn has_own_property(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
// Note that `hasOwnProperty` does NOT return true for child display objects.
|
||||
self.0.read().base.has_own_property(activation, name)
|
||||
}
|
||||
|
||||
fn has_own_virtual(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn has_own_virtual(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.0.read().base.has_own_virtual(activation, name)
|
||||
}
|
||||
|
||||
fn is_property_enumerable(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
name: &str,
|
||||
) -> bool {
|
||||
fn is_property_enumerable(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.0.read().base.is_property_enumerable(activation, name)
|
||||
}
|
||||
|
||||
fn get_keys(&self, activation: &mut Activation<'_, '_, 'gc, '_>) -> Vec<String> {
|
||||
fn get_keys(&self, activation: &mut Activation<'_, 'gc, '_>) -> Vec<String> {
|
||||
// Keys from the underlying object are listed first, followed by
|
||||
// child display objects in order from highest depth to lowest depth.
|
||||
let obj = self.0.read();
|
||||
|
@ -490,15 +486,15 @@ pub struct DisplayProperty<'gc> {
|
|||
}
|
||||
|
||||
pub type DisplayGetter<'gc> =
|
||||
fn(&mut Activation<'_, '_, 'gc, '_>, DisplayObject<'gc>) -> Result<Value<'gc>, Error<'gc>>;
|
||||
fn(&mut Activation<'_, 'gc, '_>, DisplayObject<'gc>) -> Result<Value<'gc>, Error<'gc>>;
|
||||
|
||||
pub type DisplaySetter<'gc> =
|
||||
fn(&mut Activation<'_, '_, 'gc, '_>, DisplayObject<'gc>, Value<'gc>) -> Result<(), Error<'gc>>;
|
||||
fn(&mut Activation<'_, 'gc, '_>, DisplayObject<'gc>, Value<'gc>) -> Result<(), Error<'gc>>;
|
||||
|
||||
impl<'gc> DisplayProperty<'gc> {
|
||||
pub fn get(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
(self.get)(activation, this)
|
||||
|
@ -506,7 +502,7 @@ impl<'gc> DisplayProperty<'gc> {
|
|||
|
||||
pub fn set(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: DisplayObject<'gc>,
|
||||
value: Value<'gc>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
|
@ -588,14 +584,14 @@ impl<'gc> DisplayPropertyMap<'gc> {
|
|||
}
|
||||
|
||||
fn x<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
Ok(this.x().into())
|
||||
}
|
||||
|
||||
fn set_x<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
mut this: DisplayObject<'gc>,
|
||||
val: Value<'gc>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
|
@ -606,14 +602,14 @@ fn set_x<'gc>(
|
|||
}
|
||||
|
||||
fn y<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
Ok(this.y().into())
|
||||
}
|
||||
|
||||
fn set_y<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
mut this: DisplayObject<'gc>,
|
||||
val: Value<'gc>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
|
@ -624,7 +620,7 @@ fn set_y<'gc>(
|
|||
}
|
||||
|
||||
fn x_scale<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
mut this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let val = this.scale_x(activation.context.gc_context) * 100.0;
|
||||
|
@ -632,7 +628,7 @@ fn x_scale<'gc>(
|
|||
}
|
||||
|
||||
fn set_x_scale<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
mut this: DisplayObject<'gc>,
|
||||
val: Value<'gc>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
|
@ -643,7 +639,7 @@ fn set_x_scale<'gc>(
|
|||
}
|
||||
|
||||
fn y_scale<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
mut this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let scale_y = this.scale_y(activation.context.gc_context) * 100.0;
|
||||
|
@ -651,7 +647,7 @@ fn y_scale<'gc>(
|
|||
}
|
||||
|
||||
fn set_y_scale<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
mut this: DisplayObject<'gc>,
|
||||
val: Value<'gc>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
|
@ -662,7 +658,7 @@ fn set_y_scale<'gc>(
|
|||
}
|
||||
|
||||
fn current_frame<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
Ok(this
|
||||
|
@ -673,7 +669,7 @@ fn current_frame<'gc>(
|
|||
}
|
||||
|
||||
fn total_frames<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
Ok(this
|
||||
|
@ -684,7 +680,7 @@ fn total_frames<'gc>(
|
|||
}
|
||||
|
||||
fn alpha<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let val = this.alpha() * 100.0;
|
||||
|
@ -692,7 +688,7 @@ fn alpha<'gc>(
|
|||
}
|
||||
|
||||
fn set_alpha<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: DisplayObject<'gc>,
|
||||
val: Value<'gc>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
|
@ -703,7 +699,7 @@ fn set_alpha<'gc>(
|
|||
}
|
||||
|
||||
fn visible<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let val = this.visible();
|
||||
|
@ -711,7 +707,7 @@ fn visible<'gc>(
|
|||
}
|
||||
|
||||
fn set_visible<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
mut this: DisplayObject<'gc>,
|
||||
val: Value<'gc>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
|
@ -724,14 +720,14 @@ fn set_visible<'gc>(
|
|||
}
|
||||
|
||||
fn width<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
Ok(this.width().into())
|
||||
}
|
||||
|
||||
fn set_width<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
mut this: DisplayObject<'gc>,
|
||||
val: Value<'gc>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
|
@ -742,14 +738,14 @@ fn set_width<'gc>(
|
|||
}
|
||||
|
||||
fn height<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
Ok(this.height().into())
|
||||
}
|
||||
|
||||
fn set_height<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
mut this: DisplayObject<'gc>,
|
||||
val: Value<'gc>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
|
@ -760,7 +756,7 @@ fn set_height<'gc>(
|
|||
}
|
||||
|
||||
fn rotation<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
mut this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
Ok(this
|
||||
|
@ -770,7 +766,7 @@ fn rotation<'gc>(
|
|||
}
|
||||
|
||||
fn set_rotation<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
mut this: DisplayObject<'gc>,
|
||||
degrees: Value<'gc>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
|
@ -788,14 +784,14 @@ fn set_rotation<'gc>(
|
|||
}
|
||||
|
||||
fn target<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
Ok(AvmString::new(activation.context.gc_context, this.slash_path()).into())
|
||||
}
|
||||
|
||||
fn frames_loaded<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
Ok(this
|
||||
|
@ -806,14 +802,14 @@ fn frames_loaded<'gc>(
|
|||
}
|
||||
|
||||
fn name<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
Ok(AvmString::new(activation.context.gc_context, this.name().to_string()).into())
|
||||
}
|
||||
|
||||
fn set_name<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
mut this: DisplayObject<'gc>,
|
||||
val: Value<'gc>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
|
@ -823,7 +819,7 @@ fn set_name<'gc>(
|
|||
}
|
||||
|
||||
fn drop_target<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
avm_warn!(activation, "Unimplemented property _droptarget");
|
||||
|
@ -831,7 +827,7 @@ fn drop_target<'gc>(
|
|||
}
|
||||
|
||||
fn url<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
Ok(this
|
||||
|
@ -843,7 +839,7 @@ fn url<'gc>(
|
|||
}
|
||||
|
||||
fn high_quality<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
avm_warn!(activation, "Unimplemented property _highquality");
|
||||
|
@ -851,7 +847,7 @@ fn high_quality<'gc>(
|
|||
}
|
||||
|
||||
fn set_high_quality<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: DisplayObject<'gc>,
|
||||
_val: Value<'gc>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
|
@ -860,7 +856,7 @@ fn set_high_quality<'gc>(
|
|||
}
|
||||
|
||||
fn focus_rect<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
avm_warn!(activation, "Unimplemented property _focusrect");
|
||||
|
@ -868,7 +864,7 @@ fn focus_rect<'gc>(
|
|||
}
|
||||
|
||||
fn set_focus_rect<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: DisplayObject<'gc>,
|
||||
_val: Value<'gc>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
|
@ -877,7 +873,7 @@ fn set_focus_rect<'gc>(
|
|||
}
|
||||
|
||||
fn sound_buf_time<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
avm_warn!(activation, "Unimplemented property _soundbuftime");
|
||||
|
@ -885,7 +881,7 @@ fn sound_buf_time<'gc>(
|
|||
}
|
||||
|
||||
fn set_sound_buf_time<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: DisplayObject<'gc>,
|
||||
_val: Value<'gc>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
|
@ -894,7 +890,7 @@ fn set_sound_buf_time<'gc>(
|
|||
}
|
||||
|
||||
fn quality<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
avm_warn!(activation, "Unimplemented property _quality");
|
||||
|
@ -902,7 +898,7 @@ fn quality<'gc>(
|
|||
}
|
||||
|
||||
fn set_quality<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: DisplayObject<'gc>,
|
||||
_val: Value<'gc>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
|
@ -911,7 +907,7 @@ fn set_quality<'gc>(
|
|||
}
|
||||
|
||||
fn x_mouse<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let local = this.global_to_local(*activation.context.mouse_position);
|
||||
|
@ -919,7 +915,7 @@ fn x_mouse<'gc>(
|
|||
}
|
||||
|
||||
fn y_mouse<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: DisplayObject<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let local = this.global_to_local(*activation.context.mouse_position);
|
||||
|
@ -927,7 +923,7 @@ fn y_mouse<'gc>(
|
|||
}
|
||||
|
||||
fn property_coerce_to_number<'gc>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
value: Value<'gc>,
|
||||
) -> Result<Option<f64>, Error<'gc>> {
|
||||
if value != Value::Undefined && value != Value::Null {
|
||||
|
|
|
@ -45,7 +45,7 @@ impl<'gc> SuperObject<'gc> {
|
|||
pub fn from_this_and_base_proto(
|
||||
this: Object<'gc>,
|
||||
base_proto: Object<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Self, Error<'gc>> {
|
||||
Ok(Self(GcCell::allocate(
|
||||
activation.context.gc_context,
|
||||
|
@ -64,7 +64,7 @@ impl<'gc> SuperObject<'gc> {
|
|||
/// Retrieve the constructor associated with the super proto.
|
||||
fn super_constr(
|
||||
self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Option<Object<'gc>>, Error<'gc>> {
|
||||
if let Some(super_proto) = self.super_proto() {
|
||||
Ok(Some(
|
||||
|
@ -82,7 +82,7 @@ impl<'gc> TObject<'gc> for SuperObject<'gc> {
|
|||
fn get_local(
|
||||
&self,
|
||||
_name: &str,
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
Ok(Value::Undefined)
|
||||
|
@ -92,7 +92,7 @@ impl<'gc> TObject<'gc> for SuperObject<'gc> {
|
|||
&self,
|
||||
_name: &str,
|
||||
_value: Value<'gc>,
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
//TODO: What happens if you set `super.__proto__`?
|
||||
Ok(())
|
||||
|
@ -100,7 +100,7 @@ impl<'gc> TObject<'gc> for SuperObject<'gc> {
|
|||
fn call(
|
||||
&self,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_base_proto: Option<Object<'gc>>,
|
||||
args: &[Value<'gc>],
|
||||
|
@ -122,7 +122,7 @@ impl<'gc> TObject<'gc> for SuperObject<'gc> {
|
|||
&self,
|
||||
name: &str,
|
||||
args: &[Value<'gc>],
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let child = self.0.read().child;
|
||||
let super_proto = self.super_proto();
|
||||
|
@ -141,7 +141,7 @@ impl<'gc> TObject<'gc> for SuperObject<'gc> {
|
|||
&self,
|
||||
name: &str,
|
||||
value: Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Option<Object<'gc>> {
|
||||
self.0.read().child.call_setter(name, value, activation)
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ impl<'gc> TObject<'gc> for SuperObject<'gc> {
|
|||
#[allow(clippy::new_ret_no_self)]
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
if let Some(proto) = self.proto() {
|
||||
|
@ -161,7 +161,7 @@ impl<'gc> TObject<'gc> for SuperObject<'gc> {
|
|||
}
|
||||
}
|
||||
|
||||
fn delete(&self, _activation: &mut Activation<'_, '_, 'gc, '_>, _name: &str) -> bool {
|
||||
fn delete(&self, _activation: &mut Activation<'_, 'gc, '_>, _name: &str) -> bool {
|
||||
//`super` cannot have properties deleted from it
|
||||
false
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ impl<'gc> TObject<'gc> for SuperObject<'gc> {
|
|||
|
||||
fn add_property_with_case(
|
||||
&self,
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_gc_context: MutationContext<'gc, '_>,
|
||||
_name: &str,
|
||||
_get: Object<'gc>,
|
||||
|
@ -221,7 +221,7 @@ impl<'gc> TObject<'gc> for SuperObject<'gc> {
|
|||
|
||||
fn set_watcher(
|
||||
&self,
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_gc_context: MutationContext<'gc, '_>,
|
||||
_name: Cow<str>,
|
||||
_callback: Object<'gc>,
|
||||
|
@ -232,7 +232,7 @@ impl<'gc> TObject<'gc> for SuperObject<'gc> {
|
|||
|
||||
fn remove_watcher(
|
||||
&self,
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_gc_context: MutationContext<'gc, '_>,
|
||||
_name: Cow<str>,
|
||||
) -> bool {
|
||||
|
@ -240,27 +240,23 @@ impl<'gc> TObject<'gc> for SuperObject<'gc> {
|
|||
false
|
||||
}
|
||||
|
||||
fn has_property(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn has_property(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.0.read().child.has_property(activation, name)
|
||||
}
|
||||
|
||||
fn has_own_property(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn has_own_property(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.0.read().child.has_own_property(activation, name)
|
||||
}
|
||||
|
||||
fn has_own_virtual(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn has_own_virtual(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.0.read().child.has_own_virtual(activation, name)
|
||||
}
|
||||
|
||||
fn is_property_enumerable(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
name: &str,
|
||||
) -> bool {
|
||||
fn is_property_enumerable(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.0.read().child.is_property_enumerable(activation, name)
|
||||
}
|
||||
|
||||
fn get_keys(&self, _activation: &mut Activation<'_, '_, 'gc, '_>) -> Vec<String> {
|
||||
fn get_keys(&self, _activation: &mut Activation<'_, 'gc, '_>) -> Vec<String> {
|
||||
vec![]
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ impl<'gc> ValueObject<'gc> {
|
|||
///
|
||||
/// If a class exists for a given value type, this function automatically
|
||||
/// selects the correct prototype for it from the system prototypes list.
|
||||
pub fn boxed(activation: &mut Activation<'_, '_, 'gc, '_>, value: Value<'gc>) -> Object<'gc> {
|
||||
pub fn boxed(activation: &mut Activation<'_, 'gc, '_>, value: Value<'gc>) -> Object<'gc> {
|
||||
if let Value::Object(ob) = value {
|
||||
ob
|
||||
} else {
|
||||
|
@ -119,7 +119,7 @@ impl<'gc> TObject<'gc> for ValueObject<'gc> {
|
|||
#[allow(clippy::new_ret_no_self)]
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
Ok(ValueObject::empty_box(
|
||||
|
|
|
@ -60,7 +60,7 @@ impl<'gc> TObject<'gc> for XMLAttributesObject<'gc> {
|
|||
fn get_local(
|
||||
&self,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
Ok(self
|
||||
|
@ -74,7 +74,7 @@ impl<'gc> TObject<'gc> for XMLAttributesObject<'gc> {
|
|||
&self,
|
||||
name: &str,
|
||||
value: Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
self.node().set_attribute_value(
|
||||
activation.context.gc_context,
|
||||
|
@ -86,7 +86,7 @@ impl<'gc> TObject<'gc> for XMLAttributesObject<'gc> {
|
|||
fn call(
|
||||
&self,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
base_proto: Option<Object<'gc>>,
|
||||
args: &[Value<'gc>],
|
||||
|
@ -98,7 +98,7 @@ impl<'gc> TObject<'gc> for XMLAttributesObject<'gc> {
|
|||
&self,
|
||||
name: &str,
|
||||
value: Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Option<Object<'gc>> {
|
||||
self.base().call_setter(name, value, activation)
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ impl<'gc> TObject<'gc> for XMLAttributesObject<'gc> {
|
|||
#[allow(clippy::new_ret_no_self)]
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
//TODO: `new xmlnode.attributes()` returns undefined, not an object
|
||||
|
@ -114,7 +114,7 @@ impl<'gc> TObject<'gc> for XMLAttributesObject<'gc> {
|
|||
Ok(Value::Undefined.coerce_to_object(activation))
|
||||
}
|
||||
|
||||
fn delete(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn delete(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.node()
|
||||
.delete_attribute(activation.context.gc_context, &XMLName::from_str(name));
|
||||
self.base().delete(activation, name)
|
||||
|
@ -134,7 +134,7 @@ impl<'gc> TObject<'gc> for XMLAttributesObject<'gc> {
|
|||
|
||||
fn add_property_with_case(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
name: &str,
|
||||
get: Object<'gc>,
|
||||
|
@ -147,7 +147,7 @@ impl<'gc> TObject<'gc> for XMLAttributesObject<'gc> {
|
|||
|
||||
fn set_watcher(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
name: Cow<str>,
|
||||
callback: Object<'gc>,
|
||||
|
@ -159,7 +159,7 @@ impl<'gc> TObject<'gc> for XMLAttributesObject<'gc> {
|
|||
|
||||
fn remove_watcher(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
name: Cow<str>,
|
||||
) -> bool {
|
||||
|
@ -196,29 +196,25 @@ impl<'gc> TObject<'gc> for XMLAttributesObject<'gc> {
|
|||
self.base().set_proto(gc_context, prototype);
|
||||
}
|
||||
|
||||
fn has_property(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn has_property(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.base().has_property(activation, name)
|
||||
}
|
||||
|
||||
fn has_own_property(&self, _activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn has_own_property(&self, _activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.node()
|
||||
.attribute_value(&XMLName::from_str(name))
|
||||
.is_some()
|
||||
}
|
||||
|
||||
fn has_own_virtual(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn has_own_virtual(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.base().has_own_virtual(activation, name)
|
||||
}
|
||||
|
||||
fn is_property_enumerable(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
name: &str,
|
||||
) -> bool {
|
||||
fn is_property_enumerable(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.base().is_property_enumerable(activation, name)
|
||||
}
|
||||
|
||||
fn get_keys(&self, activation: &mut Activation<'_, '_, 'gc, '_>) -> Vec<String> {
|
||||
fn get_keys(&self, activation: &mut Activation<'_, 'gc, '_>) -> Vec<String> {
|
||||
self.base().get_keys(activation)
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ impl<'gc> TObject<'gc> for XMLIDMapObject<'gc> {
|
|||
fn get_local(
|
||||
&self,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
if let Some(mut node) = self.document().get_node_by_id(name) {
|
||||
|
@ -79,14 +79,14 @@ impl<'gc> TObject<'gc> for XMLIDMapObject<'gc> {
|
|||
&self,
|
||||
name: &str,
|
||||
value: Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
self.base().set(name, value, activation)
|
||||
}
|
||||
fn call(
|
||||
&self,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
base_proto: Option<Object<'gc>>,
|
||||
args: &[Value<'gc>],
|
||||
|
@ -98,7 +98,7 @@ impl<'gc> TObject<'gc> for XMLIDMapObject<'gc> {
|
|||
&self,
|
||||
name: &str,
|
||||
value: Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Option<Object<'gc>> {
|
||||
self.base().call_setter(name, value, activation)
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ impl<'gc> TObject<'gc> for XMLIDMapObject<'gc> {
|
|||
#[allow(clippy::new_ret_no_self)]
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
//TODO: `new xmlnode.attributes()` returns undefined, not an object
|
||||
|
@ -114,7 +114,7 @@ impl<'gc> TObject<'gc> for XMLIDMapObject<'gc> {
|
|||
Ok(Value::Undefined.coerce_to_object(activation))
|
||||
}
|
||||
|
||||
fn delete(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn delete(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.base().delete(activation, name)
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ impl<'gc> TObject<'gc> for XMLIDMapObject<'gc> {
|
|||
|
||||
fn add_property_with_case(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
name: &str,
|
||||
get: Object<'gc>,
|
||||
|
@ -145,7 +145,7 @@ impl<'gc> TObject<'gc> for XMLIDMapObject<'gc> {
|
|||
|
||||
fn set_watcher(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
name: Cow<str>,
|
||||
callback: Object<'gc>,
|
||||
|
@ -157,7 +157,7 @@ impl<'gc> TObject<'gc> for XMLIDMapObject<'gc> {
|
|||
|
||||
fn remove_watcher(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
name: Cow<str>,
|
||||
) -> bool {
|
||||
|
@ -194,28 +194,24 @@ impl<'gc> TObject<'gc> for XMLIDMapObject<'gc> {
|
|||
self.base().set_proto(gc_context, prototype);
|
||||
}
|
||||
|
||||
fn has_property(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn has_property(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.base().has_property(activation, name)
|
||||
}
|
||||
|
||||
fn has_own_property(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn has_own_property(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.document().get_node_by_id(name).is_some()
|
||||
|| self.base().has_own_property(activation, name)
|
||||
}
|
||||
|
||||
fn has_own_virtual(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
fn has_own_virtual(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.base().has_own_virtual(activation, name)
|
||||
}
|
||||
|
||||
fn is_property_enumerable(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
name: &str,
|
||||
) -> bool {
|
||||
fn is_property_enumerable(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
self.base().is_property_enumerable(activation, name)
|
||||
}
|
||||
|
||||
fn get_keys(&self, activation: &mut Activation<'_, '_, 'gc, '_>) -> Vec<String> {
|
||||
fn get_keys(&self, activation: &mut Activation<'_, 'gc, '_>) -> Vec<String> {
|
||||
let mut keys = self.base().get_keys(activation);
|
||||
keys.extend(self.document().get_node_ids().into_iter());
|
||||
keys
|
||||
|
|
|
@ -77,7 +77,7 @@ impl<'gc> TObject<'gc> for XMLObject<'gc> {
|
|||
#[allow(clippy::new_ret_no_self)]
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
Ok(XMLObject::empty_node(
|
||||
|
|
|
@ -239,7 +239,7 @@ impl<'gc> Scope<'gc> {
|
|||
pub fn resolve(
|
||||
&self,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
if self.locals().has_property(activation, name) {
|
||||
|
@ -254,7 +254,7 @@ impl<'gc> Scope<'gc> {
|
|||
}
|
||||
|
||||
/// Check if a particular property in the scope chain is defined.
|
||||
pub fn is_defined(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
pub fn is_defined(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
if self.locals().has_property(activation, name) {
|
||||
return true;
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ impl<'gc> Scope<'gc> {
|
|||
&self,
|
||||
name: &str,
|
||||
value: Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
) -> Result<(), Error<'gc>> {
|
||||
if self.class == ScopeClass::Target || self.locals().has_property(activation, name) {
|
||||
|
@ -307,7 +307,7 @@ impl<'gc> Scope<'gc> {
|
|||
}
|
||||
|
||||
/// Delete a value from scope
|
||||
pub fn delete(&self, activation: &mut Activation<'_, '_, 'gc, '_>, name: &str) -> bool {
|
||||
pub fn delete(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool {
|
||||
if self.locals().has_property(activation, name) {
|
||||
return self.locals().delete(activation, name);
|
||||
}
|
||||
|
|
|
@ -20,11 +20,11 @@ use std::sync::Arc;
|
|||
|
||||
pub fn with_avm<F>(swf_version: u8, test: F)
|
||||
where
|
||||
F: for<'a, 'gc> FnOnce(&mut Activation<'_, '_, 'gc, '_>, Object<'gc>) -> Result<(), Error<'gc>>,
|
||||
F: for<'a, 'gc> FnOnce(&mut Activation<'_, 'gc, '_>, Object<'gc>) -> Result<(), Error<'gc>>,
|
||||
{
|
||||
fn in_the_arena<'a, 'gc: 'a, F>(swf_version: u8, test: F, gc_context: MutationContext<'gc, '_>)
|
||||
where
|
||||
F: FnOnce(&mut Activation<'_, '_, 'gc, '_>, Object<'gc>) -> Result<(), Error<'gc>>,
|
||||
F: FnOnce(&mut Activation<'_, 'gc, '_>, Object<'gc>) -> Result<(), Error<'gc>>,
|
||||
{
|
||||
let mut avm1 = Avm1::new(gc_context, swf_version);
|
||||
let swf = Arc::new(SwfMovie::empty(swf_version));
|
||||
|
@ -72,11 +72,11 @@ where
|
|||
root.set_name(context.gc_context, "");
|
||||
|
||||
fn run_test<'a, 'gc: 'a, F>(
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
root: DisplayObject<'gc>,
|
||||
test: F,
|
||||
) where
|
||||
F: FnOnce(&mut Activation<'_, '_, 'gc, '_>, Object<'gc>) -> Result<(), Error<'gc>>,
|
||||
F: FnOnce(&mut Activation<'_, 'gc, '_>, Object<'gc>) -> Result<(), Error<'gc>>,
|
||||
{
|
||||
let this = root.object().coerce_to_object(activation);
|
||||
let result = test(activation, this);
|
||||
|
@ -89,7 +89,7 @@ where
|
|||
let base_clip = *context.levels.get(&0).unwrap();
|
||||
let swf_version = context.swf.version();
|
||||
let mut activation = Activation::from_nothing(
|
||||
&mut context,
|
||||
context,
|
||||
ActivationIdentifier::root("[Test]"),
|
||||
swf_version,
|
||||
globals,
|
||||
|
|
|
@ -38,7 +38,7 @@ impl<'gc> Timers<'gc> {
|
|||
}
|
||||
|
||||
let mut activation = Activation::from_nothing(
|
||||
context,
|
||||
context.reborrow(),
|
||||
ActivationIdentifier::root("[Timer Callback]"),
|
||||
context.swf.header().version,
|
||||
context.avm1.global_object_cell(),
|
||||
|
|
|
@ -133,7 +133,7 @@ impl<'gc> Value<'gc> {
|
|||
/// * In SWF6 and lower, `undefined` is coerced to `0.0` (like `false`)
|
||||
/// rather than `NaN` as required by spec.
|
||||
/// * In SWF5 and lower, hexadecimal is unsupported.
|
||||
fn primitive_as_number(&self, activation: &mut Activation<'_, '_, 'gc, '_>) -> f64 {
|
||||
fn primitive_as_number(&self, activation: &mut Activation<'_, 'gc, '_>) -> f64 {
|
||||
match self {
|
||||
Value::Undefined if activation.current_swf_version() < 7 => 0.0,
|
||||
Value::Null if activation.current_swf_version() < 7 => 0.0,
|
||||
|
@ -197,7 +197,7 @@ impl<'gc> Value<'gc> {
|
|||
/// ECMA-262 2nd edition s. 9.3 ToNumber
|
||||
pub fn coerce_to_f64(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<f64, Error<'gc>> {
|
||||
Ok(match self {
|
||||
Value::Object(_) => self
|
||||
|
@ -220,7 +220,7 @@ impl<'gc> Value<'gc> {
|
|||
/// return `undefined` rather than yielding a runtime error.
|
||||
pub fn to_primitive_num(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
Ok(match self {
|
||||
Value::Object(object) => object.call_method("valueOf", &[], activation)?,
|
||||
|
@ -233,7 +233,7 @@ impl<'gc> Value<'gc> {
|
|||
pub fn abstract_lt(
|
||||
&self,
|
||||
other: Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let prim_self = self.to_primitive_num(activation)?;
|
||||
let prim_other = other.to_primitive_num(activation)?;
|
||||
|
@ -272,7 +272,7 @@ impl<'gc> Value<'gc> {
|
|||
pub fn abstract_eq(
|
||||
&self,
|
||||
other: Value<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
coerced: bool,
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
match (self, &other) {
|
||||
|
@ -376,7 +376,7 @@ impl<'gc> Value<'gc> {
|
|||
#[allow(dead_code)]
|
||||
pub fn coerce_to_u16(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<u16, Error<'gc>> {
|
||||
self.coerce_to_f64(activation).map(f64_to_wrapping_u16)
|
||||
}
|
||||
|
@ -387,7 +387,7 @@ impl<'gc> Value<'gc> {
|
|||
#[allow(dead_code)]
|
||||
pub fn coerce_to_i16(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<i16, Error<'gc>> {
|
||||
self.coerce_to_f64(activation).map(f64_to_wrapping_i16)
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ impl<'gc> Value<'gc> {
|
|||
#[allow(dead_code)]
|
||||
pub fn coerce_to_i32(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<i32, Error<'gc>> {
|
||||
self.coerce_to_f64(activation).map(f64_to_wrapping_i32)
|
||||
}
|
||||
|
@ -410,7 +410,7 @@ impl<'gc> Value<'gc> {
|
|||
#[allow(dead_code)]
|
||||
pub fn coerce_to_u32(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<u32, Error<'gc>> {
|
||||
self.coerce_to_f64(activation).map(f64_to_wrapping_u32)
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ impl<'gc> Value<'gc> {
|
|||
/// Coerce a value to a string.
|
||||
pub fn coerce_to_string(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<AvmString<'gc>, Error<'gc>> {
|
||||
Ok(match self {
|
||||
Value::Object(object) => match object.call_method("toString", &[], activation)? {
|
||||
|
@ -471,14 +471,14 @@ impl<'gc> Value<'gc> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn coerce_to_object(&self, activation: &mut Activation<'_, '_, 'gc, '_>) -> Object<'gc> {
|
||||
pub fn coerce_to_object(&self, activation: &mut Activation<'_, 'gc, '_>) -> Object<'gc> {
|
||||
ValueObject::boxed(activation, self.to_owned())
|
||||
}
|
||||
|
||||
pub fn call(
|
||||
&self,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
base_proto: Option<Object<'gc>>,
|
||||
args: &[Value<'gc>],
|
||||
|
@ -585,7 +585,7 @@ mod test {
|
|||
assert_eq!(vglobal.to_primitive_num(activation).unwrap(), undefined);
|
||||
|
||||
fn value_of_impl<'gc>(
|
||||
_activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
_activation: &mut Activation<'_, 'gc, '_>,
|
||||
_: Object<'gc>,
|
||||
_: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
|
|
|
@ -14,7 +14,7 @@ use crate::prelude::*;
|
|||
use crate::tag_utils::{SwfMovie, SwfSlice};
|
||||
use crate::transform::TransformStack;
|
||||
use core::fmt;
|
||||
use gc_arena::{Collect, MutationContext};
|
||||
use gc_arena::{Collect, CollectionContext, MutationContext};
|
||||
use rand::rngs::SmallRng;
|
||||
use std::collections::{BTreeMap, HashMap, VecDeque};
|
||||
use std::sync::{Arc, Mutex, Weak};
|
||||
|
@ -119,6 +119,79 @@ pub struct UpdateContext<'a, 'gc, 'gc_context> {
|
|||
pub avm1: &'a mut Avm1<'gc>,
|
||||
}
|
||||
|
||||
unsafe impl<'a, 'gc, 'gc_context> Collect for UpdateContext<'a, 'gc, 'gc_context> {
|
||||
fn trace(&self, cc: CollectionContext) {
|
||||
self.action_queue.trace(cc);
|
||||
self.background_color.trace(cc);
|
||||
self.library.trace(cc);
|
||||
self.player_version.trace(cc);
|
||||
self.needs_render.trace(cc);
|
||||
self.swf.trace(cc);
|
||||
self.audio.trace(cc);
|
||||
self.navigator.trace(cc);
|
||||
self.renderer.trace(cc);
|
||||
self.input.trace(cc);
|
||||
self.storage.trace(cc);
|
||||
self.rng.trace(cc);
|
||||
self.levels.trace(cc);
|
||||
self.system_prototypes.trace(cc);
|
||||
self.mouse_hovered_object.trace(cc);
|
||||
self.mouse_position.trace(cc);
|
||||
self.drag_object.trace(cc);
|
||||
self.load_manager.trace(cc);
|
||||
self.system.trace(cc);
|
||||
self.instance_counter.trace(cc);
|
||||
self.shared_objects.trace(cc);
|
||||
self.unbound_text_fields.trace(cc);
|
||||
self.timers.trace(cc);
|
||||
self.avm1.trace(cc);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'gc, 'gc_context> UpdateContext<'a, 'gc, 'gc_context> {
|
||||
/// Transform a borrowed update context into an owned update context with
|
||||
/// a shorter internal lifetime.
|
||||
///
|
||||
/// This is particularly useful for structures that may wish to hold an
|
||||
/// update context without adding further lifetimes for it's borrowing.
|
||||
/// Please note that you will not be able to use the original update
|
||||
/// context until this reborrowed copy has fallen out of scope.
|
||||
pub fn reborrow<'b>(&'b self) -> UpdateContext<'b, 'gc, 'gc_context>
|
||||
where
|
||||
'a: 'b,
|
||||
{
|
||||
UpdateContext {
|
||||
action_queue: self.action_queue,
|
||||
background_color: self.background_color,
|
||||
gc_context: self.gc_context,
|
||||
library: self.library,
|
||||
player_version: self.player_version,
|
||||
needs_render: self.needs_render,
|
||||
swf: self.swf,
|
||||
audio: self.audio,
|
||||
navigator: self.navigator,
|
||||
renderer: self.renderer,
|
||||
input: self.input,
|
||||
storage: self.storage,
|
||||
rng: self.rng,
|
||||
levels: self.levels,
|
||||
system_prototypes: self.system_prototypes,
|
||||
mouse_hovered_object: self.mouse_hovered_object,
|
||||
mouse_position: self.mouse_position,
|
||||
drag_object: self.drag_object,
|
||||
stage_size: self.stage_size,
|
||||
player: self.player,
|
||||
load_manager: self.load_manager,
|
||||
system: self.system,
|
||||
instance_counter: self.instance_counter,
|
||||
shared_objects: self.shared_objects,
|
||||
unbound_text_fields: self.unbound_text_fields,
|
||||
timers: self.timers,
|
||||
avm1: self.avm1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A queued ActionScript call.
|
||||
pub struct QueuedActions<'gc> {
|
||||
/// The movie clip this ActionScript is running on.
|
||||
|
|
|
@ -909,7 +909,7 @@ pub trait TDisplayObject<'gc>: 'gc + Collect + Debug + Into<DisplayObject<'gc>>
|
|||
}
|
||||
}
|
||||
|
||||
fn bind_text_field_variables(&self, activation: &mut Activation<'_, '_, 'gc, '_>) {
|
||||
fn bind_text_field_variables(&self, activation: &mut Activation<'_, 'gc, '_>) {
|
||||
// Check all unbound text fields to see if they apply to this object.
|
||||
// TODO: Replace with `Vec::drain_filter` when stable.
|
||||
let mut i = 0;
|
||||
|
|
|
@ -500,11 +500,7 @@ impl<'gc> EditText<'gc> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn set_variable(
|
||||
self,
|
||||
variable: Option<String>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
) {
|
||||
pub fn set_variable(self, variable: Option<String>, activation: &mut Activation<'_, 'gc, '_>) {
|
||||
// Clear previous binding.
|
||||
if let Some(stage_object) = self
|
||||
.0
|
||||
|
@ -529,7 +525,7 @@ impl<'gc> EditText<'gc> {
|
|||
.initial_text
|
||||
.clone()
|
||||
.unwrap_or_default();
|
||||
let _ = self.set_text(text, activation.context);
|
||||
let _ = self.set_text(text, &mut activation.context);
|
||||
|
||||
self.0.write(activation.context.gc_context).variable = variable;
|
||||
self.try_bind_text_field_variable(activation, true);
|
||||
|
@ -704,7 +700,7 @@ impl<'gc> EditText<'gc> {
|
|||
/// This is called when the text field is created, and, if the text field is in the unbound list, anytime a display object is created.
|
||||
pub fn try_bind_text_field_variable(
|
||||
self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
set_initial_value: bool,
|
||||
) -> bool {
|
||||
let mut bound = false;
|
||||
|
@ -737,7 +733,7 @@ impl<'gc> EditText<'gc> {
|
|||
.coerce_to_string(activation)
|
||||
.unwrap_or_default()
|
||||
.to_string(),
|
||||
activation.context,
|
||||
&mut activation.context,
|
||||
);
|
||||
} else {
|
||||
// Otherwise, we initialize the proprty with the text field's text, if it's non-empty.
|
||||
|
@ -782,7 +778,7 @@ impl<'gc> EditText<'gc> {
|
|||
|
||||
/// Propagates a text change to the bound display object.
|
||||
///
|
||||
pub fn propagate_text_binding(self, activation: &mut Activation<'_, '_, 'gc, '_>) {
|
||||
pub fn propagate_text_binding(self, activation: &mut Activation<'_, 'gc, '_>) {
|
||||
if !self.0.read().firing_variable_binding {
|
||||
self.0
|
||||
.write(activation.context.gc_context)
|
||||
|
@ -797,7 +793,7 @@ impl<'gc> EditText<'gc> {
|
|||
activation.resolve_variable_path(self.parent().unwrap(), &variable_path)
|
||||
{
|
||||
let text = if self.0.read().is_html {
|
||||
let html_tree = self.html_tree(activation.context).as_node();
|
||||
let html_tree = self.html_tree(&mut activation.context).as_node();
|
||||
let html_string_result = html_tree.into_string(&mut |_node| true);
|
||||
html_string_result.unwrap_or_default()
|
||||
} else {
|
||||
|
|
|
@ -1071,7 +1071,7 @@ impl<'gc> TDisplayObject<'gc> for MovieClip<'gc> {
|
|||
}
|
||||
|
||||
let mut activation = Activation::from_nothing(
|
||||
context,
|
||||
context.reborrow(),
|
||||
ActivationIdentifier::root("[Mouse Pick]"),
|
||||
context.swf.version(),
|
||||
context.avm1.global_object_cell(),
|
||||
|
@ -1134,7 +1134,7 @@ impl<'gc> TDisplayObject<'gc> for MovieClip<'gc> {
|
|||
// If we are not, then this must be queued to be ran first-thing
|
||||
if instantiated_from_avm && self.0.read().avm1_constructor.is_some() {
|
||||
let mut activation = Activation::from_nothing(
|
||||
context,
|
||||
context.reborrow(),
|
||||
ActivationIdentifier::root("[Construct]"),
|
||||
context.swf.version(),
|
||||
context.avm1.global_object_cell(),
|
||||
|
@ -1173,7 +1173,7 @@ impl<'gc> TDisplayObject<'gc> for MovieClip<'gc> {
|
|||
);
|
||||
if let Some(init_object) = init_object {
|
||||
let mut activation = Activation::from_nothing(
|
||||
context,
|
||||
context.reborrow(),
|
||||
ActivationIdentifier::root("[Init]"),
|
||||
context.swf.version(),
|
||||
context.avm1.global_object_cell(),
|
||||
|
|
|
@ -87,7 +87,7 @@ pub struct TextFormat {
|
|||
fn getstr_from_avm1_object<'gc>(
|
||||
object: Object<'gc>,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Option<String>, crate::avm1::error::Error<'gc>> {
|
||||
Ok(match object.get(name, activation)? {
|
||||
Value::Undefined => None,
|
||||
|
@ -99,7 +99,7 @@ fn getstr_from_avm1_object<'gc>(
|
|||
fn getfloat_from_avm1_object<'gc>(
|
||||
object: Object<'gc>,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Option<f64>, crate::avm1::error::Error<'gc>> {
|
||||
Ok(match object.get(name, activation)? {
|
||||
Value::Undefined => None,
|
||||
|
@ -111,7 +111,7 @@ fn getfloat_from_avm1_object<'gc>(
|
|||
fn getbool_from_avm1_object<'gc>(
|
||||
object: Object<'gc>,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Option<bool>, crate::avm1::error::Error<'gc>> {
|
||||
Ok(match object.get(name, activation)? {
|
||||
Value::Undefined => None,
|
||||
|
@ -123,7 +123,7 @@ fn getbool_from_avm1_object<'gc>(
|
|||
fn getfloatarray_from_avm1_object<'gc>(
|
||||
object: Object<'gc>,
|
||||
name: &str,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Option<Vec<f64>>, crate::avm1::error::Error<'gc>> {
|
||||
Ok(match object.get(name, activation)? {
|
||||
Value::Undefined => None,
|
||||
|
@ -195,7 +195,7 @@ impl TextFormat {
|
|||
/// Construct a `TextFormat` from an object that is
|
||||
pub fn from_avm1_object<'gc>(
|
||||
object1: Object<'gc>,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Self, crate::avm1::error::Error<'gc>> {
|
||||
Ok(Self {
|
||||
font: getstr_from_avm1_object(object1, "font", activation)?,
|
||||
|
@ -347,7 +347,7 @@ impl TextFormat {
|
|||
/// Construct a `TextFormat` AVM1 object from this text format object.
|
||||
pub fn as_avm1_object<'gc>(
|
||||
&self,
|
||||
activation: &mut Activation<'_, '_, 'gc, '_>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Object<'gc>, crate::avm1::error::Error<'gc>> {
|
||||
let object = ScriptObject::object(
|
||||
activation.context.gc_context,
|
||||
|
|
|
@ -56,10 +56,9 @@ pub enum Error {
|
|||
}
|
||||
|
||||
pub type FormLoadHandler<'gc> =
|
||||
fn(&mut Activation<'_, '_, 'gc, '_>, Object<'gc>, data: &[u8]) -> Result<(), Error>;
|
||||
fn(&mut Activation<'_, 'gc, '_>, Object<'gc>, data: &[u8]) -> Result<(), Error>;
|
||||
|
||||
pub type FormErrorHandler<'gc> =
|
||||
fn(&mut Activation<'_, '_, 'gc, '_>, Object<'gc>) -> Result<(), Error>;
|
||||
pub type FormErrorHandler<'gc> = fn(&mut Activation<'_, 'gc, '_>, Object<'gc>) -> Result<(), Error>;
|
||||
|
||||
impl From<crate::avm1::error::Error<'_>> for Error {
|
||||
fn from(error: crate::avm1::error::Error<'_>) -> Self {
|
||||
|
@ -598,7 +597,7 @@ impl<'gc> Loader<'gc> {
|
|||
};
|
||||
|
||||
let mut activation = Activation::from_nothing(
|
||||
uc,
|
||||
uc.reborrow(),
|
||||
ActivationIdentifier::root("[Form Loader]"),
|
||||
uc.swf.version(),
|
||||
uc.avm1.global_object_cell(),
|
||||
|
@ -648,7 +647,7 @@ impl<'gc> Loader<'gc> {
|
|||
};
|
||||
|
||||
let mut activation = Activation::from_nothing(
|
||||
uc,
|
||||
uc.reborrow(),
|
||||
ActivationIdentifier::root("[Form Loader]"),
|
||||
uc.swf.version(),
|
||||
uc.avm1.global_object_cell(),
|
||||
|
|
|
@ -331,7 +331,7 @@ impl Player {
|
|||
|
||||
// Set the version parameter on the root.
|
||||
let mut activation = Activation::from_nothing(
|
||||
context,
|
||||
context.reborrow(),
|
||||
ActivationIdentifier::root("[Version Setter]"),
|
||||
context.swf.version(),
|
||||
context.avm1.global_object_cell(),
|
||||
|
@ -454,7 +454,7 @@ impl Player {
|
|||
let mut dumper = VariableDumper::new(" ");
|
||||
|
||||
let mut activation = Activation::from_nothing(
|
||||
context,
|
||||
context.reborrow(),
|
||||
ActivationIdentifier::root("[Variable Dumper]"),
|
||||
context.swf.version(),
|
||||
context.avm1.global_object_cell(),
|
||||
|
@ -843,7 +843,7 @@ impl Player {
|
|||
events,
|
||||
} => {
|
||||
let mut activation = Activation::from_nothing(
|
||||
context,
|
||||
context.reborrow(),
|
||||
ActivationIdentifier::root("[Construct]"),
|
||||
context.swf.version(),
|
||||
context.avm1.global_object_cell(),
|
||||
|
@ -1112,7 +1112,7 @@ impl Player {
|
|||
pub fn flush_shared_objects(&mut self) {
|
||||
self.update(|_avm2, context| {
|
||||
let mut activation = Activation::from_nothing(
|
||||
context,
|
||||
context.reborrow(),
|
||||
ActivationIdentifier::root("[Flush]"),
|
||||
context.swf.version(),
|
||||
context.avm1.global_object_cell(),
|
||||
|
|
Loading…
Reference in New Issue