diff --git a/core/src/avm1/function.rs b/core/src/avm1/function.rs index 25e2d7177..9384ff6fb 100644 --- a/core/src/avm1/function.rs +++ b/core/src/avm1/function.rs @@ -736,18 +736,18 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> { .add_property_with_case(activation, name, get, set, attributes) } - fn set_watcher( + fn watch( &self, activation: &mut Activation<'_, 'gc, '_>, name: Cow, callback: Object<'gc>, user_data: Value<'gc>, ) { - self.base.set_watcher(activation, name, callback, user_data); + self.base.watch(activation, name, callback, user_data); } - fn remove_watcher(&self, activation: &mut Activation<'_, 'gc, '_>, name: Cow) -> bool { - self.base.remove_watcher(activation, name) + fn unwatch(&self, activation: &mut Activation<'_, 'gc, '_>, name: Cow) -> bool { + self.base.unwatch(activation, name) } fn has_property(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool { diff --git a/core/src/avm1/globals/object.rs b/core/src/avm1/globals/object.rs index f22a202f6..92952a0de 100644 --- a/core/src/avm1/globals/object.rs +++ b/core/src/avm1/globals/object.rs @@ -213,7 +213,7 @@ fn watch<'gc>( } let user_data = args.get(2).cloned().unwrap_or(Value::Undefined); - this.set_watcher(activation, Cow::Borrowed(&name), callback, user_data); + this.watch(activation, Cow::Borrowed(&name), callback, user_data); Ok(true.into()) } @@ -230,7 +230,7 @@ fn unwatch<'gc>( return Ok(false.into()); }; - let result = this.remove_watcher(activation, Cow::Borrowed(&name)); + let result = this.unwatch(activation, Cow::Borrowed(&name)); Ok(result.into()) } diff --git a/core/src/avm1/object.rs b/core/src/avm1/object.rs index 956dc5947..c35181532 100644 --- a/core/src/avm1/object.rs +++ b/core/src/avm1/object.rs @@ -357,7 +357,7 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into> + Clone + Copy /// Set the 'watcher' of a given property. /// /// The property does not need to exist at the time of this being called. - fn set_watcher( + fn watch( &self, activation: &mut Activation<'_, 'gc, '_>, name: Cow, @@ -369,7 +369,7 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into> + Clone + Copy /// /// The return value will indicate if there was a watcher present before this method was /// called. - fn remove_watcher(&self, activation: &mut Activation<'_, 'gc, '_>, name: Cow) -> bool; + fn unwatch(&self, activation: &mut Activation<'_, 'gc, '_>, name: Cow) -> bool; /// Checks if the object has a given named property. fn has_property(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool; diff --git a/core/src/avm1/object/array_object.rs b/core/src/avm1/object/array_object.rs index df7de23d3..f458c9109 100644 --- a/core/src/avm1/object/array_object.rs +++ b/core/src/avm1/object/array_object.rs @@ -183,20 +183,18 @@ impl<'gc> TObject<'gc> for ArrayObject<'gc> { .add_property_with_case(activation, name, get, set, attributes) } - fn set_watcher( + fn watch( &self, activation: &mut Activation<'_, 'gc, '_>, name: Cow, callback: Object<'gc>, user_data: Value<'gc>, ) { - self.0 - .read() - .set_watcher(activation, name, callback, user_data); + self.0.read().watch(activation, name, callback, user_data); } - fn remove_watcher(&self, activation: &mut Activation<'_, 'gc, '_>, name: Cow) -> bool { - self.0.read().remove_watcher(activation, name) + fn unwatch(&self, activation: &mut Activation<'_, 'gc, '_>, name: Cow) -> bool { + self.0.read().unwatch(activation, name) } fn define_value( diff --git a/core/src/avm1/object/custom_object.rs b/core/src/avm1/object/custom_object.rs index 0dcbdf222..57036ce2a 100644 --- a/core/src/avm1/object/custom_object.rs +++ b/core/src/avm1/object/custom_object.rs @@ -251,7 +251,7 @@ macro_rules! impl_custom_object { self.0.read().$field.delete_element(activation, index) } - fn set_watcher( + fn watch( &self, activation: &mut crate::avm1::Activation<'_, 'gc, '_>, name: std::borrow::Cow, @@ -261,15 +261,15 @@ macro_rules! impl_custom_object { self.0 .read() .$field - .set_watcher(activation, name, callback, user_data); + .watch(activation, name, callback, user_data); } - fn remove_watcher( + fn unwatch( &self, activation: &mut crate::avm1::Activation<'_, 'gc, '_>, name: std::borrow::Cow, ) -> bool { - self.0.read().$field.remove_watcher(activation, name) + self.0.read().$field.unwatch(activation, name) } }; } diff --git a/core/src/avm1/object/script_object.rs b/core/src/avm1/object/script_object.rs index 482bddbee..4c04ce4e3 100644 --- a/core/src/avm1/object/script_object.rs +++ b/core/src/avm1/object/script_object.rs @@ -369,7 +369,7 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> { ); } - fn set_watcher( + fn watch( &self, activation: &mut Activation<'_, 'gc, '_>, name: Cow, @@ -383,7 +383,7 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> { ); } - fn remove_watcher(&self, activation: &mut Activation<'_, 'gc, '_>, name: Cow) -> bool { + fn unwatch(&self, activation: &mut Activation<'_, 'gc, '_>, name: Cow) -> bool { let old = self .0 .write(activation.context.gc_context) diff --git a/core/src/avm1/object/stage_object.rs b/core/src/avm1/object/stage_object.rs index 1182afafd..1384402fc 100644 --- a/core/src/avm1/object/stage_object.rs +++ b/core/src/avm1/object/stage_object.rs @@ -333,7 +333,7 @@ impl<'gc> TObject<'gc> for StageObject<'gc> { .add_property_with_case(activation, name, get, set, attributes) } - fn set_watcher( + fn watch( &self, activation: &mut Activation<'_, 'gc, '_>, name: Cow, @@ -343,11 +343,11 @@ impl<'gc> TObject<'gc> for StageObject<'gc> { self.0 .read() .base - .set_watcher(activation, name, callback, user_data); + .watch(activation, name, callback, user_data); } - fn remove_watcher(&self, activation: &mut Activation<'_, 'gc, '_>, name: Cow) -> bool { - self.0.read().base.remove_watcher(activation, name) + fn unwatch(&self, activation: &mut Activation<'_, 'gc, '_>, name: Cow) -> bool { + self.0.read().base.unwatch(activation, name) } fn has_property(&self, activation: &mut Activation<'_, 'gc, '_>, name: &str) -> bool { diff --git a/core/src/avm1/object/super_object.rs b/core/src/avm1/object/super_object.rs index 64e369963..5c706ab35 100644 --- a/core/src/avm1/object/super_object.rs +++ b/core/src/avm1/object/super_object.rs @@ -213,7 +213,7 @@ impl<'gc> TObject<'gc> for SuperObject<'gc> { //`super` cannot have properties defined on it } - fn set_watcher( + fn watch( &self, _activation: &mut Activation<'_, 'gc, '_>, _name: Cow, @@ -223,7 +223,7 @@ impl<'gc> TObject<'gc> for SuperObject<'gc> { //`super` cannot have properties defined on it } - fn remove_watcher(&self, _activation: &mut Activation<'_, 'gc, '_>, _name: Cow) -> bool { + fn unwatch(&self, _activation: &mut Activation<'_, 'gc, '_>, _name: Cow) -> bool { //`super` cannot have properties defined on it false } diff --git a/core/src/avm1/object/xml_attributes_object.rs b/core/src/avm1/object/xml_attributes_object.rs index a849b4d61..be960755b 100644 --- a/core/src/avm1/object/xml_attributes_object.rs +++ b/core/src/avm1/object/xml_attributes_object.rs @@ -142,19 +142,18 @@ impl<'gc> TObject<'gc> for XmlAttributesObject<'gc> { .add_property_with_case(activation, name, get, set, attributes) } - fn set_watcher( + fn watch( &self, activation: &mut Activation<'_, 'gc, '_>, name: Cow, callback: Object<'gc>, user_data: Value<'gc>, ) { - self.base() - .set_watcher(activation, name, callback, user_data); + self.base().watch(activation, name, callback, user_data); } - fn remove_watcher(&self, activation: &mut Activation<'_, 'gc, '_>, name: Cow) -> bool { - self.base().remove_watcher(activation, name) + fn unwatch(&self, activation: &mut Activation<'_, 'gc, '_>, name: Cow) -> bool { + self.base().unwatch(activation, name) } fn define_value( diff --git a/core/src/avm1/object/xml_idmap_object.rs b/core/src/avm1/object/xml_idmap_object.rs index f6f9310b5..ad36e5a43 100644 --- a/core/src/avm1/object/xml_idmap_object.rs +++ b/core/src/avm1/object/xml_idmap_object.rs @@ -143,19 +143,18 @@ impl<'gc> TObject<'gc> for XmlIdMapObject<'gc> { .add_property_with_case(activation, name, get, set, attributes) } - fn set_watcher( + fn watch( &self, activation: &mut Activation<'_, 'gc, '_>, name: Cow, callback: Object<'gc>, user_data: Value<'gc>, ) { - self.base() - .set_watcher(activation, name, callback, user_data); + self.base().watch(activation, name, callback, user_data); } - fn remove_watcher(&self, activation: &mut Activation<'_, 'gc, '_>, name: Cow) -> bool { - self.base().remove_watcher(activation, name) + fn unwatch(&self, activation: &mut Activation<'_, 'gc, '_>, name: Cow) -> bool { + self.base().unwatch(activation, name) } fn define_value(