From 44fd13c6544fa14f581273a50b843f7da781ebf4 Mon Sep 17 00:00:00 2001 From: relrelb Date: Sat, 5 Feb 2022 14:44:47 +0200 Subject: [PATCH] avm1: Fix builtins' attributes Fixes #5827. --- core/src/avm1/globals/bevel_filter.rs | 2 +- core/src/avm1/globals/bitmap_filter.rs | 2 +- core/src/avm1/globals/blur_filter.rs | 2 +- core/src/avm1/globals/boolean.rs | 4 +- core/src/avm1/globals/button.rs | 7 +- core/src/avm1/globals/color_matrix_filter.rs | 2 +- core/src/avm1/globals/color_transform.rs | 7 +- core/src/avm1/globals/convolution_filter.rs | 2 +- .../avm1/globals/displacement_map_filter.rs | 2 +- core/src/avm1/globals/drop_shadow_filter.rs | 2 +- core/src/avm1/globals/error.rs | 2 +- core/src/avm1/globals/external_interface.rs | 2 + core/src/avm1/globals/function.rs | 4 +- core/src/avm1/globals/glow_filter.rs | 2 +- .../src/avm1/globals/gradient_bevel_filter.rs | 2 +- core/src/avm1/globals/gradient_glow_filter.rs | 2 +- core/src/avm1/globals/matrix.rs | 2 +- core/src/avm1/globals/movie_clip.rs | 78 +++++++++---------- core/src/avm1/globals/movie_clip_loader.rs | 6 +- core/src/avm1/globals/number.rs | 4 +- core/src/avm1/globals/object.rs | 1 + core/src/avm1/globals/rectangle.rs | 14 ++-- core/src/avm1/globals/shared_object.rs | 25 +++--- core/src/avm1/globals/stage.rs | 13 ++-- core/src/avm1/globals/string.rs | 29 +++---- core/src/avm1/globals/text_field.rs | 62 +++++++-------- core/src/avm1/globals/xml.rs | 6 +- core/src/avm1/globals/xml_node.rs | 26 +++---- 28 files changed, 158 insertions(+), 154 deletions(-) diff --git a/core/src/avm1/globals/bevel_filter.rs b/core/src/avm1/globals/bevel_filter.rs index 0e197d92d..0dcfbddde 100644 --- a/core/src/avm1/globals/bevel_filter.rs +++ b/core/src/avm1/globals/bevel_filter.rs @@ -1,4 +1,4 @@ -//! flash.filter.BevelFilter object +//! flash.filters.BevelFilter object use crate::avm1::activation::Activation; use crate::avm1::error::Error; diff --git a/core/src/avm1/globals/bitmap_filter.rs b/core/src/avm1/globals/bitmap_filter.rs index 3a8a9e7ae..d6a563a26 100644 --- a/core/src/avm1/globals/bitmap_filter.rs +++ b/core/src/avm1/globals/bitmap_filter.rs @@ -1,4 +1,4 @@ -//! flash.filter.BitmapFilter object +//! flash.filters.BitmapFilter object use crate::avm1::activation::Activation; use crate::avm1::error::Error; diff --git a/core/src/avm1/globals/blur_filter.rs b/core/src/avm1/globals/blur_filter.rs index 9e41137f9..4b41bc372 100644 --- a/core/src/avm1/globals/blur_filter.rs +++ b/core/src/avm1/globals/blur_filter.rs @@ -1,4 +1,4 @@ -//! flash.filter.BlurFilter object +//! flash.filters.BlurFilter object use crate::avm1::activation::Activation; use crate::avm1::error::Error; diff --git a/core/src/avm1/globals/boolean.rs b/core/src/avm1/globals/boolean.rs index 84668ed45..1d287ab3c 100644 --- a/core/src/avm1/globals/boolean.rs +++ b/core/src/avm1/globals/boolean.rs @@ -10,8 +10,8 @@ use crate::string::AvmString; use gc_arena::MutationContext; const PROTO_DECLS: &[Declaration] = declare_properties! { - "toString" => method(to_string); - "valueOf" => method(value_of); + "toString" => method(to_string; DONT_ENUM | DONT_DELETE); + "valueOf" => method(value_of; DONT_ENUM | DONT_DELETE); }; /// `Boolean` constructor diff --git a/core/src/avm1/globals/button.rs b/core/src/avm1/globals/button.rs index e0f01bd45..42831671f 100644 --- a/core/src/avm1/globals/button.rs +++ b/core/src/avm1/globals/button.rs @@ -1,4 +1,4 @@ -//! Button/SimpleButton prototype +//! Button prototype use crate::avm1::activation::Activation; use crate::avm1::error::Error; @@ -7,6 +7,7 @@ use crate::avm1::property_decl::{define_properties_on, Declaration}; use crate::avm1::{Object, ScriptObject, TObject, Value}; use crate::display_object::{Avm1Button, TDisplayObject}; use gc_arena::MutationContext; + macro_rules! button_getter { ($name:ident) => { |activation, this, _args| { @@ -35,8 +36,8 @@ macro_rules! button_setter { } const PROTO_DECLS: &[Declaration] = declare_properties! { - "enabled" => property(button_getter!(enabled), button_setter!(set_enabled); DONT_ENUM | DONT_DELETE); - "useHandCursor" => property(button_getter!(use_hand_cursor), button_setter!(set_use_hand_cursor); DONT_ENUM | DONT_DELETE); + "enabled" => property(button_getter!(enabled), button_setter!(set_enabled)); + "useHandCursor" => property(button_getter!(use_hand_cursor), button_setter!(set_use_hand_cursor)); }; pub fn create_proto<'gc>( diff --git a/core/src/avm1/globals/color_matrix_filter.rs b/core/src/avm1/globals/color_matrix_filter.rs index 01f50bd9e..eed357579 100644 --- a/core/src/avm1/globals/color_matrix_filter.rs +++ b/core/src/avm1/globals/color_matrix_filter.rs @@ -1,4 +1,4 @@ -//! flash.filter.ColorMatrixFilter object +//! flash.filters.ColorMatrixFilter object use crate::avm1::activation::Activation; use crate::avm1::error::Error; diff --git a/core/src/avm1/globals/color_transform.rs b/core/src/avm1/globals/color_transform.rs index a0f2e7f38..9b0da8a1d 100644 --- a/core/src/avm1/globals/color_transform.rs +++ b/core/src/avm1/globals/color_transform.rs @@ -1,14 +1,13 @@ -//! ColorTransform object +//! flash.geom.ColorTransform object use crate::avm1::activation::Activation; use crate::avm1::error::Error; +use crate::avm1::object::color_transform_object::ColorTransformObject; use crate::avm1::property_decl::{define_properties_on, Declaration}; use crate::avm1::{Object, TObject, Value}; +use crate::color_transform::ColorTransform; use crate::string::AvmString; use gc_arena::MutationContext; - -use crate::avm1::object::color_transform_object::ColorTransformObject; -use crate::color_transform::ColorTransform; use swf::Fixed8; const PROTO_DECLS: &[Declaration] = declare_properties! { diff --git a/core/src/avm1/globals/convolution_filter.rs b/core/src/avm1/globals/convolution_filter.rs index a187df182..58ea24d13 100644 --- a/core/src/avm1/globals/convolution_filter.rs +++ b/core/src/avm1/globals/convolution_filter.rs @@ -1,4 +1,4 @@ -//! flash.filter.ConvolutionFilter object +//! flash.filters.ConvolutionFilter object use crate::avm1::activation::Activation; use crate::avm1::error::Error; diff --git a/core/src/avm1/globals/displacement_map_filter.rs b/core/src/avm1/globals/displacement_map_filter.rs index c7c12bd32..872c03622 100644 --- a/core/src/avm1/globals/displacement_map_filter.rs +++ b/core/src/avm1/globals/displacement_map_filter.rs @@ -1,4 +1,4 @@ -//! flash.filter.DisplacementMapFilter object +//! flash.filters.DisplacementMapFilter object use crate::avm1::activation::Activation; use crate::avm1::error::Error; diff --git a/core/src/avm1/globals/drop_shadow_filter.rs b/core/src/avm1/globals/drop_shadow_filter.rs index 9a9848ef9..6cc87fb92 100644 --- a/core/src/avm1/globals/drop_shadow_filter.rs +++ b/core/src/avm1/globals/drop_shadow_filter.rs @@ -1,4 +1,4 @@ -//! flash.filter.DropShadowFilter object +//! flash.filters.DropShadowFilter object use crate::avm1::activation::Activation; use crate::avm1::error::Error; diff --git a/core/src/avm1/globals/error.rs b/core/src/avm1/globals/error.rs index 11ccbcf2f..f916270eb 100644 --- a/core/src/avm1/globals/error.rs +++ b/core/src/avm1/globals/error.rs @@ -9,7 +9,7 @@ use gc_arena::MutationContext; const PROTO_DECLS: &[Declaration] = declare_properties! { "message" => string("Error"); "name" => string("Error"); - "toString" => method(to_string; DONT_DELETE); + "toString" => method(to_string); }; pub fn constructor<'gc>( diff --git a/core/src/avm1/globals/external_interface.rs b/core/src/avm1/globals/external_interface.rs index a71d85375..a71135857 100644 --- a/core/src/avm1/globals/external_interface.rs +++ b/core/src/avm1/globals/external_interface.rs @@ -1,3 +1,5 @@ +//! flash.external.ExternalInterface object + use crate::avm1::activation::Activation; use crate::avm1::error::Error; use crate::avm1::property_decl::{define_properties_on, Declaration}; diff --git a/core/src/avm1/globals/function.rs b/core/src/avm1/globals/function.rs index 482c0139a..6fc2be841 100644 --- a/core/src/avm1/globals/function.rs +++ b/core/src/avm1/globals/function.rs @@ -8,8 +8,8 @@ use crate::avm1::{Object, ScriptObject, TObject, Value}; use gc_arena::MutationContext; const PROTO_DECLS: &[Declaration] = declare_properties! { - "call" => method(call); - "apply" => method(apply); + "call" => method(call; DONT_ENUM | DONT_DELETE); + "apply" => method(apply; DONT_ENUM | DONT_DELETE); }; /// Implements `new Function()` diff --git a/core/src/avm1/globals/glow_filter.rs b/core/src/avm1/globals/glow_filter.rs index 86160666e..e9e5cf32a 100644 --- a/core/src/avm1/globals/glow_filter.rs +++ b/core/src/avm1/globals/glow_filter.rs @@ -1,4 +1,4 @@ -//! flash.filter.GlowFilter object +//! flash.filters.GlowFilter object use crate::avm1::activation::Activation; use crate::avm1::error::Error; diff --git a/core/src/avm1/globals/gradient_bevel_filter.rs b/core/src/avm1/globals/gradient_bevel_filter.rs index 6b5935b5e..3a168ff86 100644 --- a/core/src/avm1/globals/gradient_bevel_filter.rs +++ b/core/src/avm1/globals/gradient_bevel_filter.rs @@ -1,4 +1,4 @@ -//! flash.filter.GradientBevelFilter object +//! flash.filters.GradientBevelFilter object use crate::avm1::activation::Activation; use crate::avm1::error::Error; diff --git a/core/src/avm1/globals/gradient_glow_filter.rs b/core/src/avm1/globals/gradient_glow_filter.rs index 855e683f6..09ca8a2c5 100644 --- a/core/src/avm1/globals/gradient_glow_filter.rs +++ b/core/src/avm1/globals/gradient_glow_filter.rs @@ -1,4 +1,4 @@ -//! flash.filter.GradientGlowFilter object +//! flash.filters.GradientGlowFilter object use crate::avm1::activation::Activation; use crate::avm1::error::Error; diff --git a/core/src/avm1/globals/matrix.rs b/core/src/avm1/globals/matrix.rs index ca916492f..866fcb3c5 100644 --- a/core/src/avm1/globals/matrix.rs +++ b/core/src/avm1/globals/matrix.rs @@ -1,4 +1,4 @@ -//! flash.geom.Matrix +//! flash.geom.Matrix object use crate::avm1::activation::Activation; use crate::avm1::error::Error; diff --git a/core/src/avm1/globals/movie_clip.rs b/core/src/avm1/globals/movie_clip.rs index 26367360d..e3f44e65f 100644 --- a/core/src/avm1/globals/movie_clip.rs +++ b/core/src/avm1/globals/movie_clip.rs @@ -63,45 +63,45 @@ macro_rules! mc_setter { } const PROTO_DECLS: &[Declaration] = declare_properties! { - "attachMovie" => method(mc_method!(attach_movie); DONT_ENUM | DONT_DELETE | READ_ONLY); - "createEmptyMovieClip" => method(mc_method!(create_empty_movie_clip); DONT_ENUM | DONT_DELETE | READ_ONLY); - "createTextField" => method(mc_method!(create_text_field); DONT_ENUM | DONT_DELETE | READ_ONLY); - "duplicateMovieClip" => method(mc_method!(duplicate_movie_clip); DONT_ENUM | DONT_DELETE | READ_ONLY); - "getBounds" => method(mc_method!(get_bounds); DONT_ENUM | DONT_DELETE | READ_ONLY); - "getBytesLoaded" => method(mc_method!(get_bytes_loaded); DONT_ENUM | DONT_DELETE | READ_ONLY); - "getBytesTotal" => method(mc_method!(get_bytes_total); DONT_ENUM | DONT_DELETE | READ_ONLY); - "getInstanceAtDepth" => method(mc_method!(get_instance_at_depth); DONT_ENUM | DONT_DELETE | READ_ONLY); - "getNextHighestDepth" => method(mc_method!(get_next_highest_depth); DONT_ENUM | DONT_DELETE | READ_ONLY); - "getRect" => method(mc_method!(get_rect); DONT_ENUM | DONT_DELETE | READ_ONLY); - "getURL" => method(mc_method!(get_url); DONT_ENUM | DONT_DELETE | READ_ONLY); - "globalToLocal" => method(mc_method!(global_to_local); DONT_ENUM | DONT_DELETE | READ_ONLY); - "gotoAndPlay" => method(mc_method!(goto_and_play); DONT_ENUM | DONT_DELETE | READ_ONLY); - "gotoAndStop" => method(mc_method!(goto_and_stop); DONT_ENUM | DONT_DELETE | READ_ONLY); - "hitTest" => method(mc_method!(hit_test); DONT_ENUM | DONT_DELETE | READ_ONLY); - "loadMovie" => method(mc_method!(load_movie); DONT_ENUM | DONT_DELETE | READ_ONLY); - "loadVariables" => method(mc_method!(load_variables); DONT_ENUM | DONT_DELETE | READ_ONLY); - "localToGlobal" => method(mc_method!(local_to_global); DONT_ENUM | DONT_DELETE | READ_ONLY); - "nextFrame" => method(mc_method!(next_frame); DONT_ENUM | DONT_DELETE | READ_ONLY); - "play" => method(mc_method!(play); DONT_ENUM | DONT_DELETE | READ_ONLY); - "prevFrame" => method(mc_method!(prev_frame); DONT_ENUM | DONT_DELETE | READ_ONLY); - "setMask" => method(mc_method!(set_mask); DONT_ENUM | DONT_DELETE | READ_ONLY); - "startDrag" => method(mc_method!(start_drag); DONT_ENUM | DONT_DELETE | READ_ONLY); - "stop" => method(mc_method!(stop); DONT_ENUM | DONT_DELETE | READ_ONLY); - "stopDrag" => method(mc_method!(stop_drag); DONT_ENUM | DONT_DELETE | READ_ONLY); - "swapDepths" => method(mc_method!(swap_depths); DONT_ENUM | DONT_DELETE | READ_ONLY); - "unloadMovie" => method(mc_method!(unload_movie); DONT_ENUM | DONT_DELETE | READ_ONLY); - "beginFill" => method(mc_method!(begin_fill); DONT_ENUM | DONT_DELETE | READ_ONLY); - "beginBitmapFill" => method(mc_method!(begin_bitmap_fill); DONT_ENUM | DONT_DELETE | READ_ONLY); - "beginGradientFill" => method(mc_method!(begin_gradient_fill); DONT_ENUM | DONT_DELETE | READ_ONLY); - "moveTo" => method(mc_method!(move_to); DONT_ENUM | DONT_DELETE | READ_ONLY); - "lineTo" => method(mc_method!(line_to); DONT_ENUM | DONT_DELETE | READ_ONLY); - "curveTo" => method(mc_method!(curve_to); DONT_ENUM | DONT_DELETE | READ_ONLY); - "endFill" => method(mc_method!(end_fill); DONT_ENUM | DONT_DELETE | READ_ONLY); - "lineStyle" => method(mc_method!(line_style); DONT_ENUM | DONT_DELETE | READ_ONLY); - "clear" => method(mc_method!(clear); DONT_ENUM | DONT_DELETE | READ_ONLY); - "attachBitmap" => method(mc_method!(attach_bitmap); DONT_ENUM | DONT_DELETE | READ_ONLY); - "removeMovieClip" => method(remove_movie_clip; DONT_ENUM | DONT_DELETE | READ_ONLY); - "transform" => property(mc_getter!(transform), mc_setter!(set_transform); DONT_DELETE | DONT_ENUM); + "attachMovie" => method(mc_method!(attach_movie); DONT_ENUM | DONT_DELETE); + "createEmptyMovieClip" => method(mc_method!(create_empty_movie_clip); DONT_ENUM | DONT_DELETE); + "createTextField" => method(mc_method!(create_text_field); DONT_ENUM | DONT_DELETE); + "duplicateMovieClip" => method(mc_method!(duplicate_movie_clip); DONT_ENUM | DONT_DELETE); + "getBounds" => method(mc_method!(get_bounds); DONT_ENUM | DONT_DELETE); + "getBytesLoaded" => method(mc_method!(get_bytes_loaded); DONT_ENUM | DONT_DELETE); + "getBytesTotal" => method(mc_method!(get_bytes_total); DONT_ENUM | DONT_DELETE); + "getInstanceAtDepth" => method(mc_method!(get_instance_at_depth); DONT_ENUM | DONT_DELETE); + "getNextHighestDepth" => method(mc_method!(get_next_highest_depth); DONT_ENUM | DONT_DELETE); + "getRect" => method(mc_method!(get_rect); DONT_ENUM | DONT_DELETE); + "getURL" => method(mc_method!(get_url); DONT_ENUM | DONT_DELETE); + "globalToLocal" => method(mc_method!(global_to_local); DONT_ENUM | DONT_DELETE); + "gotoAndPlay" => method(mc_method!(goto_and_play); DONT_ENUM | DONT_DELETE); + "gotoAndStop" => method(mc_method!(goto_and_stop); DONT_ENUM | DONT_DELETE); + "hitTest" => method(mc_method!(hit_test); DONT_ENUM | DONT_DELETE); + "loadMovie" => method(mc_method!(load_movie); DONT_ENUM | DONT_DELETE); + "loadVariables" => method(mc_method!(load_variables); DONT_ENUM | DONT_DELETE); + "localToGlobal" => method(mc_method!(local_to_global); DONT_ENUM | DONT_DELETE); + "nextFrame" => method(mc_method!(next_frame); DONT_ENUM | DONT_DELETE); + "play" => method(mc_method!(play); DONT_ENUM | DONT_DELETE); + "prevFrame" => method(mc_method!(prev_frame); DONT_ENUM | DONT_DELETE); + "setMask" => method(mc_method!(set_mask); DONT_ENUM | DONT_DELETE); + "startDrag" => method(mc_method!(start_drag); DONT_ENUM | DONT_DELETE); + "stop" => method(mc_method!(stop); DONT_ENUM | DONT_DELETE); + "stopDrag" => method(mc_method!(stop_drag); DONT_ENUM | DONT_DELETE); + "swapDepths" => method(mc_method!(swap_depths); DONT_ENUM | DONT_DELETE); + "unloadMovie" => method(mc_method!(unload_movie); DONT_ENUM | DONT_DELETE); + "beginFill" => method(mc_method!(begin_fill); DONT_ENUM | DONT_DELETE); + "beginBitmapFill" => method(mc_method!(begin_bitmap_fill); DONT_ENUM | DONT_DELETE); + "beginGradientFill" => method(mc_method!(begin_gradient_fill); DONT_ENUM | DONT_DELETE); + "moveTo" => method(mc_method!(move_to); DONT_ENUM | DONT_DELETE); + "lineTo" => method(mc_method!(line_to); DONT_ENUM | DONT_DELETE); + "curveTo" => method(mc_method!(curve_to); DONT_ENUM | DONT_DELETE); + "endFill" => method(mc_method!(end_fill); DONT_ENUM | DONT_DELETE); + "lineStyle" => method(mc_method!(line_style); DONT_ENUM | DONT_DELETE); + "clear" => method(mc_method!(clear); DONT_ENUM | DONT_DELETE); + "attachBitmap" => method(mc_method!(attach_bitmap); DONT_ENUM | DONT_DELETE); + "removeMovieClip" => method(remove_movie_clip; DONT_ENUM | DONT_DELETE); + "transform" => property(mc_getter!(transform), mc_setter!(set_transform); DONT_ENUM); "enabled" => property(mc_getter!(enabled), mc_setter!(set_enabled); DONT_DELETE | DONT_ENUM); "focusEnabled" => property(mc_getter!(focus_enabled), mc_setter!(set_focus_enabled); DONT_DELETE | DONT_ENUM); "_lockroot" => property(mc_getter!(lock_root), mc_setter!(set_lock_root); DONT_DELETE | DONT_ENUM); diff --git a/core/src/avm1/globals/movie_clip_loader.rs b/core/src/avm1/globals/movie_clip_loader.rs index 5d494a270..4b37c7c08 100644 --- a/core/src/avm1/globals/movie_clip_loader.rs +++ b/core/src/avm1/globals/movie_clip_loader.rs @@ -13,9 +13,9 @@ use crate::display_object::{TDisplayObject, TDisplayObjectContainer}; use gc_arena::MutationContext; const PROTO_DECLS: &[Declaration] = declare_properties! { - "loadClip" => method(load_clip); - "unloadClip" => method(unload_clip); - "getProgress" => method(get_progress); + "loadClip" => method(load_clip; DONT_ENUM | DONT_DELETE); + "unloadClip" => method(unload_clip; DONT_ENUM | DONT_DELETE); + "getProgress" => method(get_progress; DONT_ENUM | DONT_DELETE); }; pub fn constructor<'gc>( diff --git a/core/src/avm1/globals/number.rs b/core/src/avm1/globals/number.rs index c7c23b1d5..0f5a38412 100644 --- a/core/src/avm1/globals/number.rs +++ b/core/src/avm1/globals/number.rs @@ -10,8 +10,8 @@ use crate::string::AvmString; use gc_arena::MutationContext; const PROTO_DECLS: &[Declaration] = declare_properties! { - "toString" => method(to_string); - "valueOf" => method(value_of); + "toString" => method(to_string; DONT_ENUM | DONT_DELETE); + "valueOf" => method(value_of; DONT_ENUM | DONT_DELETE); }; const OBJECT_DECLS: &[Declaration] = declare_properties! { diff --git a/core/src/avm1/globals/object.rs b/core/src/avm1/globals/object.rs index 19aa19391..0824a8b4d 100644 --- a/core/src/avm1/globals/object.rs +++ b/core/src/avm1/globals/object.rs @@ -1,4 +1,5 @@ //! Object prototype + use crate::avm1::error::Error; use crate::avm1::function::{Executable, FunctionObject}; use crate::avm1::property::Attribute; diff --git a/core/src/avm1/globals/rectangle.rs b/core/src/avm1/globals/rectangle.rs index 90fead4e6..ae3779435 100644 --- a/core/src/avm1/globals/rectangle.rs +++ b/core/src/avm1/globals/rectangle.rs @@ -25,13 +25,13 @@ const PROTO_DECLS: &[Declaration] = declare_properties! { "offsetPoint" => method(offset_point); "intersection" => method(intersection); "equals" => method(equals); - "left" => property(get_left, set_left; DONT_ENUM | DONT_DELETE); - "top" => property(get_top, set_top; DONT_ENUM | DONT_DELETE); - "right" => property(get_right, set_right; DONT_ENUM | DONT_DELETE); - "bottom" => property(get_bottom, set_bottom; DONT_ENUM | DONT_DELETE); - "size" => property(get_size, set_size; DONT_ENUM | DONT_DELETE); - "topLeft" => property(get_top_left, set_top_left; DONT_ENUM | DONT_DELETE); - "bottomRight" => property(get_bottom_right, set_bottom_right; DONT_ENUM | DONT_DELETE); + "left" => property(get_left, set_left); + "top" => property(get_top, set_top); + "right" => property(get_right, set_right); + "bottom" => property(get_bottom, set_bottom); + "size" => property(get_size, set_size); + "topLeft" => property(get_top_left, set_top_left); + "bottomRight" => property(get_bottom_right, set_bottom_right); }; fn constructor<'gc>( diff --git a/core/src/avm1/globals/shared_object.rs b/core/src/avm1/globals/shared_object.rs index 72b038d33..5332f5cae 100644 --- a/core/src/avm1/globals/shared_object.rs +++ b/core/src/avm1/globals/shared_object.rs @@ -1,5 +1,3 @@ -use std::borrow::Cow; - use crate::avm1::activation::Activation; use crate::avm1::error::Error; use crate::avm1::function::{Executable, FunctionObject}; @@ -14,22 +12,23 @@ use flash_lso::types::Value as AmfValue; use flash_lso::types::{AMFVersion, Element, Lso}; use gc_arena::MutationContext; use json::JsonValue; +use std::borrow::Cow; const PROTO_DECLS: &[Declaration] = declare_properties! { - "clear" => method(clear); - "close" => method(close); - "connect" => method(connect); - "flush" => method(flush); - "getSize" => method(get_size); - "send" => method(send); - "setFps" => method(set_fps); - "onStatus" => method(on_status); - "onSync" => method(on_sync); + "clear" => method(clear; DONT_ENUM | DONT_DELETE); + "close" => method(close; DONT_ENUM | DONT_DELETE); + "connect" => method(connect; DONT_ENUM | DONT_DELETE); + "flush" => method(flush; DONT_ENUM | DONT_DELETE); + "getSize" => method(get_size; DONT_ENUM | DONT_DELETE); + "send" => method(send; DONT_ENUM | DONT_DELETE); + "setFps" => method(set_fps; DONT_ENUM | DONT_DELETE); + "onStatus" => method(on_status; DONT_ENUM | DONT_DELETE); + "onSync" => method(on_sync; DONT_ENUM | DONT_DELETE); }; const OBJECT_DECLS: &[Declaration] = declare_properties! { - "deleteAll" => method(delete_all); - "getDiskUsage" => method(get_disk_usage); + "deleteAll" => method(delete_all; DONT_ENUM); + "getDiskUsage" => method(get_disk_usage; DONT_ENUM); "getLocal" => method(get_local); "getRemote" => method(get_remote); "getMaxSize" => method(get_max_size); diff --git a/core/src/avm1/globals/stage.rs b/core/src/avm1/globals/stage.rs index 4773c588a..976d74c8d 100644 --- a/core/src/avm1/globals/stage.rs +++ b/core/src/avm1/globals/stage.rs @@ -1,6 +1,7 @@ //! Stage object //! //! TODO: This is a very rough stub with not much implementation. + use crate::avm1::activation::Activation; use crate::avm1::error::Error; use crate::avm1::globals::as_broadcaster::BroadcasterFunctions; @@ -11,12 +12,12 @@ use crate::string::{AvmString, WStr, WString}; use gc_arena::MutationContext; const OBJECT_DECLS: &[Declaration] = declare_properties! { - "align" => property(align, set_align; DONT_ENUM | DONT_DELETE); - "height" => property(height; DONT_ENUM | DONT_DELETE | READ_ONLY); - "scaleMode" => property(scale_mode, set_scale_mode; DONT_ENUM | DONT_DELETE); - "displayState" => property(display_state, set_display_state; DONT_ENUM | DONT_DELETE); - "showMenu" => property(show_menu, set_show_menu; DONT_ENUM | DONT_DELETE); - "width" => property(width; DONT_ENUM | DONT_DELETE | READ_ONLY); + "align" => property(align, set_align); + "height" => property(height); + "scaleMode" => property(scale_mode, set_scale_mode); + "displayState" => property(display_state, set_display_state); + "showMenu" => property(show_menu, set_show_menu); + "width" => property(width); }; pub fn create_stage_object<'gc>( diff --git a/core/src/avm1/globals/string.rs b/core/src/avm1/globals/string.rs index 9896ccd63..fcece2f59 100644 --- a/core/src/avm1/globals/string.rs +++ b/core/src/avm1/globals/string.rs @@ -1,4 +1,5 @@ //! `String` class impl + use crate::avm1::activation::Activation; use crate::avm1::error::Error; use crate::avm1::function::{Executable, FunctionObject}; @@ -10,23 +11,23 @@ use crate::string::{utils as string_utils, AvmString, WString}; use gc_arena::MutationContext; const PROTO_DECLS: &[Declaration] = declare_properties! { - "toString" => method(to_string_value_of); - "valueOf" => method(to_string_value_of); - "charAt" => method(char_at; DONT_DELETE | DONT_ENUM); - "charCodeAt" => method(char_code_at; DONT_DELETE | DONT_ENUM); - "concat" => method(concat; DONT_DELETE | DONT_ENUM); - "indexOf" => method(index_of; DONT_DELETE | DONT_ENUM); - "lastIndexOf" => method(last_index_of; DONT_DELETE | DONT_ENUM); - "slice" => method(slice; DONT_DELETE | DONT_ENUM); - "split" => method(split; DONT_DELETE | DONT_ENUM); - "substr" => method(substr; DONT_DELETE | DONT_ENUM); - "substring" => method(substring; DONT_DELETE | DONT_ENUM); - "toLowerCase" => method(to_lower_case; DONT_DELETE | DONT_ENUM); - "toUpperCase" => method(to_upper_case; DONT_DELETE | DONT_ENUM); + "toString" => method(to_string_value_of; DONT_ENUM | DONT_DELETE); + "valueOf" => method(to_string_value_of; DONT_ENUM | DONT_DELETE); + "charAt" => method(char_at; DONT_ENUM | DONT_DELETE); + "charCodeAt" => method(char_code_at; DONT_ENUM | DONT_DELETE); + "concat" => method(concat; DONT_ENUM | DONT_DELETE); + "indexOf" => method(index_of; DONT_ENUM | DONT_DELETE); + "lastIndexOf" => method(last_index_of; DONT_ENUM | DONT_DELETE); + "slice" => method(slice; DONT_ENUM | DONT_DELETE); + "split" => method(split; DONT_ENUM | DONT_DELETE); + "substr" => method(substr; DONT_ENUM | DONT_DELETE); + "substring" => method(substring; DONT_ENUM | DONT_DELETE); + "toLowerCase" => method(to_lower_case; DONT_ENUM | DONT_DELETE); + "toUpperCase" => method(to_upper_case; DONT_ENUM | DONT_DELETE); }; const OBJECT_DECLS: &[Declaration] = declare_properties! { - "fromCharCode" => method(from_char_code; DONT_DELETE | DONT_ENUM); + "fromCharCode" => method(from_char_code; DONT_ENUM | DONT_DELETE); }; /// `String` constructor diff --git a/core/src/avm1/globals/text_field.rs b/core/src/avm1/globals/text_field.rs index 6a0d8acf9..4616d9909 100644 --- a/core/src/avm1/globals/text_field.rs +++ b/core/src/avm1/globals/text_field.rs @@ -52,37 +52,37 @@ macro_rules! tf_setter { } const PROTO_DECLS: &[Declaration] = declare_properties! { - "getNewTextFormat" => method(tf_method!(get_new_text_format); DONT_ENUM | DONT_DELETE | READ_ONLY); - "setNewTextFormat" => method(tf_method!(set_new_text_format); DONT_ENUM | DONT_DELETE | READ_ONLY); - "getTextFormat" => method(tf_method!(get_text_format); DONT_ENUM | DONT_DELETE | READ_ONLY); - "setTextFormat" => method(tf_method!(set_text_format); DONT_ENUM | DONT_DELETE | READ_ONLY); - "replaceSel" => method(tf_method!(replace_sel); DONT_ENUM | DONT_DELETE | READ_ONLY); - "replaceText" => method(tf_method!(replace_text); DONT_ENUM | DONT_DELETE | READ_ONLY); - "removeTextField" => method(tf_method!(remove_text_field); DONT_ENUM | DONT_DELETE | READ_ONLY); - "autoSize" => property(tf_getter!(auto_size), tf_setter!(set_auto_size); DONT_DELETE); - "background" => property(tf_getter!(background), tf_setter!(set_background); DONT_DELETE); - "backgroundColor" => property(tf_getter!(background_color), tf_setter!(set_background_color); DONT_DELETE); - "border" => property(tf_getter!(border), tf_setter!(set_border); DONT_DELETE); - "borderColor" => property(tf_getter!(border_color), tf_setter!(set_border_color); DONT_DELETE); - "bottomScroll" => property(tf_getter!(bottom_scroll); DONT_DELETE | READ_ONLY); - "embedFonts" => property(tf_getter!(embed_fonts), tf_setter!(set_embed_fonts); DONT_DELETE); - "hscroll" => property(tf_getter!(hscroll), tf_setter!(set_hscroll); DONT_DELETE); - "html" => property(tf_getter!(html), tf_setter!(set_html); DONT_DELETE); - "htmlText" => property(tf_getter!(html_text), tf_setter!(set_html_text); DONT_DELETE); - "length" => property(tf_getter!(length); DONT_DELETE | READ_ONLY); - "maxhscroll" => property(tf_getter!(maxhscroll); DONT_DELETE | READ_ONLY); - "maxscroll" => property(tf_getter!(maxscroll); DONT_DELETE | READ_ONLY); - "multiline" => property(tf_getter!(multiline), tf_setter!(set_multiline); DONT_DELETE); - "password" => property(tf_getter!(password), tf_setter!(set_password); DONT_DELETE); - "scroll" => property(tf_getter!(scroll), tf_setter!(set_scroll); DONT_DELETE); - "selectable" => property(tf_getter!(selectable), tf_setter!(set_selectable); DONT_DELETE); - "text" => property(tf_getter!(text), tf_setter!(set_text); DONT_DELETE); - "textColor" => property(tf_getter!(text_color), tf_setter!(set_text_color); DONT_DELETE); - "textHeight" => property(tf_getter!(text_height); DONT_DELETE); - "textWidth" => property(tf_getter!(text_width); DONT_DELETE); - "type" => property(tf_getter!(get_type), tf_setter!(set_type); DONT_DELETE); - "variable" => property(tf_getter!(variable), tf_setter!(set_variable); DONT_DELETE); - "wordWrap" => property(tf_getter!(word_wrap), tf_setter!(set_word_wrap); DONT_DELETE); + "getNewTextFormat" => method(tf_method!(get_new_text_format); DONT_ENUM | DONT_DELETE); + "setNewTextFormat" => method(tf_method!(set_new_text_format); DONT_ENUM | DONT_DELETE); + "getTextFormat" => method(tf_method!(get_text_format); DONT_ENUM | DONT_DELETE); + "setTextFormat" => method(tf_method!(set_text_format); DONT_ENUM | DONT_DELETE); + "replaceSel" => method(tf_method!(replace_sel); DONT_ENUM | DONT_DELETE); + "replaceText" => method(tf_method!(replace_text); DONT_ENUM | DONT_DELETE); + "removeTextField" => method(tf_method!(remove_text_field); DONT_ENUM | DONT_DELETE); + "autoSize" => property(tf_getter!(auto_size), tf_setter!(set_auto_size)); + "background" => property(tf_getter!(background), tf_setter!(set_background)); + "backgroundColor" => property(tf_getter!(background_color), tf_setter!(set_background_color)); + "border" => property(tf_getter!(border), tf_setter!(set_border)); + "borderColor" => property(tf_getter!(border_color), tf_setter!(set_border_color)); + "bottomScroll" => property(tf_getter!(bottom_scroll)); + "embedFonts" => property(tf_getter!(embed_fonts), tf_setter!(set_embed_fonts)); + "hscroll" => property(tf_getter!(hscroll), tf_setter!(set_hscroll)); + "html" => property(tf_getter!(html), tf_setter!(set_html)); + "htmlText" => property(tf_getter!(html_text), tf_setter!(set_html_text)); + "length" => property(tf_getter!(length)); + "maxhscroll" => property(tf_getter!(maxhscroll)); + "maxscroll" => property(tf_getter!(maxscroll)); + "multiline" => property(tf_getter!(multiline), tf_setter!(set_multiline)); + "password" => property(tf_getter!(password), tf_setter!(set_password)); + "scroll" => property(tf_getter!(scroll), tf_setter!(set_scroll)); + "selectable" => property(tf_getter!(selectable), tf_setter!(set_selectable)); + "text" => property(tf_getter!(text), tf_setter!(set_text)); + "textColor" => property(tf_getter!(text_color), tf_setter!(set_text_color)); + "textHeight" => property(tf_getter!(text_height)); + "textWidth" => property(tf_getter!(text_width)); + "type" => property(tf_getter!(get_type), tf_setter!(set_type)); + "variable" => property(tf_getter!(variable), tf_setter!(set_variable)); + "wordWrap" => property(tf_getter!(word_wrap), tf_setter!(set_word_wrap)); }; /// Implements `TextField` diff --git a/core/src/avm1/globals/xml.rs b/core/src/avm1/globals/xml.rs index fa414570e..fc0331d69 100644 --- a/core/src/avm1/globals/xml.rs +++ b/core/src/avm1/globals/xml.rs @@ -31,9 +31,9 @@ const PROTO_DECLS: &[Declaration] = declare_properties! { "docTypeDecl" => property(doc_type_decl; READ_ONLY); "ignoreWhite" => bool(false); "contentType" => string("application/x-www-form-urlencoded"; READ_ONLY); - "xmlDecl" => property(xml_decl; READ_ONLY); - "idMap" => property(id_map; READ_ONLY); - "status" => property(status; READ_ONLY); + "xmlDecl" => property(xml_decl); + "idMap" => property(id_map); + "status" => property(status); "createElement" => method(create_element); "createTextNode" => method(create_text_node); "parseXML" => method(parse_xml); diff --git a/core/src/avm1/globals/xml_node.rs b/core/src/avm1/globals/xml_node.rs index 50853c7f3..0fa3e4146 100644 --- a/core/src/avm1/globals/xml_node.rs +++ b/core/src/avm1/globals/xml_node.rs @@ -12,19 +12,19 @@ use crate::xml::XmlNode; use gc_arena::MutationContext; const PROTO_DECLS: &[Declaration] = declare_properties! { - "localName" => property(local_name; READ_ONLY); - "nodeName" => property(node_name; READ_ONLY); - "nodeType" => property(node_type; READ_ONLY); - "nodeValue" => property(node_value; READ_ONLY); - "prefix" => property(prefix; READ_ONLY); - "childNodes" => property(child_nodes; READ_ONLY); - "firstChild" => property(first_child; READ_ONLY); - "lastChild" => property(last_child; READ_ONLY); - "parentNode" => property(parent_node; READ_ONLY); - "previousSibling" => property(previous_sibling; READ_ONLY); - "nextSibling" => property(next_sibling; READ_ONLY); - "attributes" => property(attributes; READ_ONLY); - "namespaceURI" => property(namespace_uri; READ_ONLY); + "localName" => property(local_name); + "nodeName" => property(node_name); + "nodeType" => property(node_type); + "nodeValue" => property(node_value); + "prefix" => property(prefix); + "childNodes" => property(child_nodes); + "firstChild" => property(first_child); + "lastChild" => property(last_child); + "parentNode" => property(parent_node); + "previousSibling" => property(previous_sibling); + "nextSibling" => property(next_sibling); + "attributes" => property(attributes); + "namespaceURI" => property(namespace_uri); "appendChild" => method(append_child); "insertBefore" => method(insert_before); "cloneNode" => method(clone_node);