avm1: Make FunctionObject::functional require prototype, it's not optional
This commit is contained in:
parent
9123d92513
commit
fb7fb6f99a
|
@ -919,7 +919,7 @@ impl<'a, 'gc: 'a> Activation<'a, 'gc> {
|
|||
context.gc_context,
|
||||
Gc::allocate(context.gc_context, func),
|
||||
Some(self.avm.prototypes.function),
|
||||
Some(prototype),
|
||||
prototype,
|
||||
);
|
||||
if name == "" {
|
||||
self.avm.push(func_obj);
|
||||
|
@ -954,7 +954,7 @@ impl<'a, 'gc: 'a> Activation<'a, 'gc> {
|
|||
context.gc_context,
|
||||
Gc::allocate(context.gc_context, func),
|
||||
Some(self.avm.prototypes.function),
|
||||
Some(prototype),
|
||||
prototype,
|
||||
);
|
||||
if action_func.name == "" {
|
||||
self.avm.push(func_obj);
|
||||
|
|
|
@ -487,11 +487,11 @@ impl<'gc> FunctionObject<'gc> {
|
|||
context: MutationContext<'gc, '_>,
|
||||
function: impl Into<Executable<'gc>>,
|
||||
fn_proto: Option<Object<'gc>>,
|
||||
prototype: Option<Object<'gc>>,
|
||||
prototype: Object<'gc>,
|
||||
) -> Object<'gc> {
|
||||
// Avoid type inference issues
|
||||
let none: Option<Executable> = None;
|
||||
Self::allocate_function(context, Some(function), none, fn_proto, prototype)
|
||||
Self::allocate_function(context, Some(function), none, fn_proto, Some(prototype))
|
||||
}
|
||||
|
||||
/// Construct a constructor function from an executable and associated protos.
|
||||
|
|
|
@ -389,14 +389,14 @@ pub fn create_globals<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(color_transform::constructor),
|
||||
Some(function_proto),
|
||||
Some(color_transform_proto),
|
||||
color_transform_proto,
|
||||
)
|
||||
.into(),
|
||||
EnumSet::empty(),
|
||||
);
|
||||
|
||||
let (broadcaster_functions, as_broadcaster) =
|
||||
as_broadcaster::create(gc_context, Some(object_proto), Some(function_proto));
|
||||
as_broadcaster::create(gc_context, Some(object_proto), function_proto);
|
||||
|
||||
let mut globals = ScriptObject::bare_object(gc_context);
|
||||
globals.define_value(
|
||||
|
@ -474,8 +474,7 @@ pub fn create_globals<'gc>(
|
|||
DontEnum.into(),
|
||||
);
|
||||
|
||||
let system_security =
|
||||
system_security::create(gc_context, Some(object_proto), Some(function_proto));
|
||||
let system_security = system_security::create(gc_context, Some(object_proto), function_proto);
|
||||
let system_capabilities =
|
||||
system_capabilities::create(gc_context, Some(object_proto), function_proto);
|
||||
let system_ime = system_ime::create(
|
||||
|
@ -489,7 +488,7 @@ pub fn create_globals<'gc>(
|
|||
let system = system::create(
|
||||
gc_context,
|
||||
Some(object_proto),
|
||||
Some(function_proto),
|
||||
function_proto,
|
||||
system_security,
|
||||
system_capabilities,
|
||||
system_ime,
|
||||
|
@ -537,7 +536,7 @@ pub fn create_globals<'gc>(
|
|||
gc_context,
|
||||
Some(object_proto),
|
||||
Some(array_proto),
|
||||
Some(function_proto),
|
||||
function_proto,
|
||||
broadcaster_functions,
|
||||
)),
|
||||
DontEnum.into(),
|
||||
|
@ -594,7 +593,7 @@ pub fn create_globals<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(get_nan),
|
||||
Some(function_proto),
|
||||
Some(function_proto),
|
||||
function_proto,
|
||||
),
|
||||
None,
|
||||
DontEnum.into(),
|
||||
|
@ -606,7 +605,7 @@ pub fn create_globals<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(get_infinity),
|
||||
Some(function_proto),
|
||||
Some(function_proto),
|
||||
function_proto,
|
||||
),
|
||||
None,
|
||||
DontEnum.into(),
|
||||
|
|
|
@ -194,7 +194,7 @@ pub fn initialize_internal<'gc>(
|
|||
pub fn create<'gc>(
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
proto: Option<Object<'gc>>,
|
||||
fn_proto: Option<Object<'gc>>,
|
||||
fn_proto: Object<'gc>,
|
||||
) -> (BroadcasterFunctions<'gc>, Object<'gc>) {
|
||||
let mut as_broadcaster = ScriptObject::object(gc_context, proto);
|
||||
|
||||
|
@ -203,11 +203,15 @@ pub fn create<'gc>(
|
|||
initialize,
|
||||
gc_context,
|
||||
DontDelete | DontEnum,
|
||||
fn_proto,
|
||||
Some(fn_proto),
|
||||
);
|
||||
|
||||
let add_listener =
|
||||
FunctionObject::function(gc_context, Executable::Native(add_listener), fn_proto, None);
|
||||
let add_listener = FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(add_listener),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
);
|
||||
as_broadcaster.define_value(
|
||||
gc_context,
|
||||
"addListener",
|
||||
|
@ -218,8 +222,8 @@ pub fn create<'gc>(
|
|||
let remove_listener = FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(remove_listener),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
None,
|
||||
);
|
||||
as_broadcaster.define_value(
|
||||
gc_context,
|
||||
|
@ -231,8 +235,8 @@ pub fn create<'gc>(
|
|||
let broadcast_message = FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(broadcast_message),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
None,
|
||||
);
|
||||
as_broadcaster.define_value(
|
||||
gc_context,
|
||||
|
|
|
@ -18,8 +18,8 @@ macro_rules! with_color_transform {
|
|||
$obj.add_property(
|
||||
$gc,
|
||||
$name,
|
||||
FunctionObject::function($gc, Executable::Native($get), Some($fn_proto), Some($fn_proto)),
|
||||
Some(FunctionObject::function($gc, Executable::Native($set), Some($fn_proto), Some($fn_proto))),
|
||||
FunctionObject::function($gc, Executable::Native($get), Some($fn_proto), $fn_proto),
|
||||
Some(FunctionObject::function($gc, Executable::Native($set), Some($fn_proto), $fn_proto)),
|
||||
EnumSet::empty(),
|
||||
);
|
||||
)*
|
||||
|
|
|
@ -60,13 +60,13 @@ pub fn define_display_object_proto<'gc>(
|
|||
Ok(activation.avm.global_object(context))
|
||||
}),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(overwrite_global),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
DontDelete | ReadOnly | DontEnum,
|
||||
);
|
||||
|
@ -80,13 +80,13 @@ pub fn define_display_object_proto<'gc>(
|
|||
Ok(activation.root_object(context))
|
||||
}),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(overwrite_root),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
DontDelete | ReadOnly | DontEnum,
|
||||
);
|
||||
|
@ -98,13 +98,13 @@ pub fn define_display_object_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(get_parent),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(overwrite_parent),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
DontDelete | ReadOnly | DontEnum,
|
||||
);
|
||||
|
|
|
@ -394,7 +394,7 @@ pub fn create_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(length),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
Attribute::ReadOnly.into(),
|
||||
|
|
|
@ -1040,13 +1040,13 @@ pub fn create_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(get_left),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_left),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
Attribute::DontDelete | Attribute::DontEnum,
|
||||
);
|
||||
|
@ -1058,13 +1058,13 @@ pub fn create_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(get_top),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_top),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
Attribute::DontDelete | Attribute::DontEnum,
|
||||
);
|
||||
|
@ -1076,13 +1076,13 @@ pub fn create_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(get_right),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_right),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
Attribute::DontDelete | Attribute::DontEnum,
|
||||
);
|
||||
|
@ -1094,13 +1094,13 @@ pub fn create_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(get_bottom),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_bottom),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
Attribute::DontDelete | Attribute::DontEnum,
|
||||
);
|
||||
|
@ -1112,13 +1112,13 @@ pub fn create_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(get_size),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_size),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
Attribute::DontDelete | Attribute::DontEnum,
|
||||
);
|
||||
|
@ -1130,13 +1130,13 @@ pub fn create_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(get_top_left),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_top_left),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
Attribute::DontDelete | Attribute::DontEnum,
|
||||
);
|
||||
|
@ -1148,13 +1148,13 @@ pub fn create_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(get_bottom_right),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_bottom_right),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
Attribute::DontDelete | Attribute::DontEnum,
|
||||
);
|
||||
|
|
|
@ -53,7 +53,7 @@ pub fn create_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(duration),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
DontDelete | ReadOnly | DontEnum,
|
||||
|
@ -66,7 +66,7 @@ pub fn create_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(id3),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
DontDelete | ReadOnly | DontEnum,
|
||||
|
@ -127,7 +127,7 @@ pub fn create_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(position),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
DontDelete | ReadOnly | DontEnum,
|
||||
|
|
|
@ -14,7 +14,7 @@ pub fn create_stage_object<'gc>(
|
|||
gc_context: MutationContext<'gc, '_>,
|
||||
proto: Option<Object<'gc>>,
|
||||
array_proto: Option<Object<'gc>>,
|
||||
fn_proto: Option<Object<'gc>>,
|
||||
fn_proto: Object<'gc>,
|
||||
broadcaster_functions: BroadcasterFunctions<'gc>,
|
||||
) -> Object<'gc> {
|
||||
let stage = ScriptObject::object(gc_context, proto);
|
||||
|
@ -24,11 +24,16 @@ pub fn create_stage_object<'gc>(
|
|||
stage.add_property(
|
||||
gc_context,
|
||||
"align",
|
||||
FunctionObject::function(gc_context, Executable::Native(align), fn_proto, fn_proto),
|
||||
FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(align),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_align),
|
||||
fn_proto,
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
Attribute::DontEnum | Attribute::DontDelete,
|
||||
|
@ -37,7 +42,12 @@ pub fn create_stage_object<'gc>(
|
|||
stage.add_property(
|
||||
gc_context,
|
||||
"height",
|
||||
FunctionObject::function(gc_context, Executable::Native(height), fn_proto, fn_proto),
|
||||
FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(height),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||
);
|
||||
|
@ -48,13 +58,13 @@ pub fn create_stage_object<'gc>(
|
|||
FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(scale_mode),
|
||||
fn_proto,
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_scale_mode),
|
||||
fn_proto,
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
Attribute::DontEnum | Attribute::DontDelete,
|
||||
|
@ -66,13 +76,13 @@ pub fn create_stage_object<'gc>(
|
|||
FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(show_menu),
|
||||
fn_proto,
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_show_menu),
|
||||
fn_proto,
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
Attribute::DontEnum | Attribute::DontDelete,
|
||||
|
@ -81,7 +91,12 @@ pub fn create_stage_object<'gc>(
|
|||
stage.add_property(
|
||||
gc_context,
|
||||
"width",
|
||||
FunctionObject::function(gc_context, Executable::Native(width), fn_proto, fn_proto),
|
||||
FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(width),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
Attribute::DontEnum | Attribute::DontDelete | Attribute::ReadOnly,
|
||||
);
|
||||
|
|
|
@ -509,7 +509,7 @@ pub fn on_status<'gc>(
|
|||
pub fn create<'gc>(
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
proto: Option<Object<'gc>>,
|
||||
fn_proto: Option<Object<'gc>>,
|
||||
fn_proto: Object<'gc>,
|
||||
security: Object<'gc>,
|
||||
capabilities: Object<'gc>,
|
||||
ime: Object<'gc>,
|
||||
|
@ -522,13 +522,13 @@ pub fn create<'gc>(
|
|||
FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(get_exact_settings),
|
||||
fn_proto,
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_exact_settings),
|
||||
fn_proto,
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
EnumSet::empty(),
|
||||
|
@ -540,13 +540,13 @@ pub fn create<'gc>(
|
|||
FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(get_use_code_page),
|
||||
fn_proto,
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_use_code_page),
|
||||
fn_proto,
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
EnumSet::empty(),
|
||||
|
@ -568,7 +568,7 @@ pub fn create<'gc>(
|
|||
set_clipboard,
|
||||
gc_context,
|
||||
EnumSet::empty(),
|
||||
fn_proto,
|
||||
Some(fn_proto),
|
||||
);
|
||||
|
||||
system.force_set_function(
|
||||
|
@ -576,7 +576,7 @@ pub fn create<'gc>(
|
|||
show_settings,
|
||||
gc_context,
|
||||
EnumSet::empty(),
|
||||
fn_proto,
|
||||
Some(fn_proto),
|
||||
);
|
||||
|
||||
// Pretty sure this is a variable
|
||||
|
@ -585,7 +585,7 @@ pub fn create<'gc>(
|
|||
on_status,
|
||||
gc_context,
|
||||
EnumSet::empty(),
|
||||
fn_proto,
|
||||
Some(fn_proto),
|
||||
);
|
||||
|
||||
system.into()
|
||||
|
|
|
@ -40,7 +40,7 @@ macro_rules! capabilities_prop {
|
|||
$capabilities.add_property(
|
||||
$gc_ctx,
|
||||
$name,
|
||||
FunctionObject::function($gc_ctx, Executable::Native($func), Some($fn_proto), Some($fn_proto)),
|
||||
FunctionObject::function($gc_ctx, Executable::Native($func), Some($fn_proto), $fn_proto),
|
||||
None,
|
||||
EnumSet::empty()
|
||||
);
|
||||
|
|
|
@ -93,7 +93,7 @@ fn policy_file_resolver<'gc>(
|
|||
pub fn create<'gc>(
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
proto: Option<Object<'gc>>,
|
||||
fn_proto: Option<Object<'gc>>,
|
||||
fn_proto: Object<'gc>,
|
||||
) -> Object<'gc> {
|
||||
let mut security = ScriptObject::object(gc_context, proto);
|
||||
|
||||
|
@ -102,7 +102,7 @@ pub fn create<'gc>(
|
|||
policy_file_resolver,
|
||||
gc_context,
|
||||
EnumSet::empty(),
|
||||
fn_proto,
|
||||
Some(fn_proto),
|
||||
);
|
||||
|
||||
security.force_set_function(
|
||||
|
@ -110,7 +110,7 @@ pub fn create<'gc>(
|
|||
allow_domain,
|
||||
gc_context,
|
||||
EnumSet::empty(),
|
||||
fn_proto,
|
||||
Some(fn_proto),
|
||||
);
|
||||
|
||||
security.force_set_function(
|
||||
|
@ -118,7 +118,7 @@ pub fn create<'gc>(
|
|||
allow_insecure_domain,
|
||||
gc_context,
|
||||
EnumSet::empty(),
|
||||
fn_proto,
|
||||
Some(fn_proto),
|
||||
);
|
||||
|
||||
security.force_set_function(
|
||||
|
@ -126,7 +126,7 @@ pub fn create<'gc>(
|
|||
load_policy_file,
|
||||
gc_context,
|
||||
EnumSet::empty(),
|
||||
fn_proto,
|
||||
Some(fn_proto),
|
||||
);
|
||||
|
||||
security.force_set_function(
|
||||
|
@ -134,7 +134,7 @@ pub fn create<'gc>(
|
|||
escape_domain,
|
||||
gc_context,
|
||||
EnumSet::empty(),
|
||||
fn_proto,
|
||||
Some(fn_proto),
|
||||
);
|
||||
|
||||
security.add_property(
|
||||
|
@ -143,7 +143,7 @@ pub fn create<'gc>(
|
|||
FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(get_sandbox_type),
|
||||
fn_proto,
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
|
@ -156,7 +156,7 @@ pub fn create<'gc>(
|
|||
FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(get_choose_local_swf_path),
|
||||
fn_proto,
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
|
|
|
@ -452,13 +452,13 @@ pub fn attach_virtual_properties<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(get_text),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_text),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
ReadOnly.into(),
|
||||
);
|
||||
|
@ -469,13 +469,13 @@ pub fn attach_virtual_properties<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(get_html),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_html),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
ReadOnly.into(),
|
||||
);
|
||||
|
@ -486,13 +486,13 @@ pub fn attach_virtual_properties<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(get_html_text),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_html_text),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
ReadOnly.into(),
|
||||
);
|
||||
|
@ -503,7 +503,7 @@ pub fn attach_virtual_properties<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(get_length),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
ReadOnly.into(),
|
||||
|
@ -515,7 +515,7 @@ pub fn attach_virtual_properties<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(text_width),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
ReadOnly.into(),
|
||||
|
@ -527,7 +527,7 @@ pub fn attach_virtual_properties<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(text_height),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
ReadOnly.into(),
|
||||
|
@ -539,13 +539,13 @@ pub fn attach_virtual_properties<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(multiline),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_multiline),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
ReadOnly.into(),
|
||||
);
|
||||
|
@ -556,13 +556,13 @@ pub fn attach_virtual_properties<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(variable),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_variable),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
DontDelete | ReadOnly | DontEnum,
|
||||
);
|
||||
|
@ -573,13 +573,13 @@ pub fn attach_virtual_properties<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(word_wrap),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_word_wrap),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
ReadOnly.into(),
|
||||
);
|
||||
|
@ -590,13 +590,13 @@ pub fn attach_virtual_properties<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(auto_size),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_auto_size),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
ReadOnly.into(),
|
||||
);
|
||||
|
@ -607,13 +607,13 @@ pub fn attach_virtual_properties<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(get_border),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_border),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
ReadOnly.into(),
|
||||
);
|
||||
|
@ -624,13 +624,13 @@ pub fn attach_virtual_properties<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(get_embed_fonts),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
Some(FunctionObject::function(
|
||||
gc_context,
|
||||
Executable::Native(set_embed_fonts),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
)),
|
||||
ReadOnly.into(),
|
||||
);
|
||||
|
|
|
@ -527,7 +527,7 @@ pub fn create_xmlnode_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(xmlnode_local_name),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
ReadOnly.into(),
|
||||
|
@ -539,7 +539,7 @@ pub fn create_xmlnode_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(xmlnode_node_name),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
ReadOnly.into(),
|
||||
|
@ -551,7 +551,7 @@ pub fn create_xmlnode_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(xmlnode_node_type),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
ReadOnly.into(),
|
||||
|
@ -563,7 +563,7 @@ pub fn create_xmlnode_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(xmlnode_node_value),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
ReadOnly.into(),
|
||||
|
@ -575,7 +575,7 @@ pub fn create_xmlnode_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(xmlnode_prefix),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
ReadOnly.into(),
|
||||
|
@ -587,7 +587,7 @@ pub fn create_xmlnode_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(xmlnode_child_nodes),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
ReadOnly.into(),
|
||||
|
@ -599,7 +599,7 @@ pub fn create_xmlnode_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(xmlnode_first_child),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
ReadOnly.into(),
|
||||
|
@ -611,7 +611,7 @@ pub fn create_xmlnode_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(xmlnode_last_child),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
ReadOnly.into(),
|
||||
|
@ -623,7 +623,7 @@ pub fn create_xmlnode_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(xmlnode_parent_node),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
ReadOnly.into(),
|
||||
|
@ -635,7 +635,7 @@ pub fn create_xmlnode_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(xmlnode_previous_sibling),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
ReadOnly.into(),
|
||||
|
@ -647,7 +647,7 @@ pub fn create_xmlnode_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(xmlnode_next_sibling),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
ReadOnly.into(),
|
||||
|
@ -659,7 +659,7 @@ pub fn create_xmlnode_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(xmlnode_attributes),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
ReadOnly.into(),
|
||||
|
@ -671,7 +671,7 @@ pub fn create_xmlnode_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(xmlnode_namespace_uri),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
ReadOnly.into(),
|
||||
|
@ -1056,7 +1056,7 @@ pub fn create_xml_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(xml_doc_type_decl),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
ReadOnly.into(),
|
||||
|
@ -1068,7 +1068,7 @@ pub fn create_xml_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(xml_xml_decl),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
ReadOnly.into(),
|
||||
|
@ -1080,7 +1080,7 @@ pub fn create_xml_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(xml_id_map),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
ReadOnly.into(),
|
||||
|
@ -1092,7 +1092,7 @@ pub fn create_xml_proto<'gc>(
|
|||
gc_context,
|
||||
Executable::Native(xml_status),
|
||||
Some(fn_proto),
|
||||
Some(fn_proto),
|
||||
fn_proto,
|
||||
),
|
||||
None,
|
||||
ReadOnly.into(),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::avm1::activation::Activation;
|
||||
use crate::avm1::error::Error;
|
||||
use crate::avm1::function::{ExecutionReason, FunctionObject, NativeFunction};
|
||||
use crate::avm1::function::{Executable, ExecutionReason, FunctionObject, NativeFunction};
|
||||
use crate::avm1::property::{Attribute, Property};
|
||||
use crate::avm1::{AvmString, Object, ObjectPtr, TObject, UpdateContext, Value};
|
||||
use crate::property_map::{Entry, PropertyMap};
|
||||
|
@ -196,9 +196,13 @@ impl<'gc> ScriptObject<'gc> {
|
|||
self.define_value(
|
||||
gc_context,
|
||||
name,
|
||||
Value::Object(FunctionObject::function(
|
||||
gc_context, function, fn_proto, None,
|
||||
)),
|
||||
FunctionObject::bare_function(
|
||||
gc_context,
|
||||
Some(function),
|
||||
Option::<Executable>::None,
|
||||
fn_proto,
|
||||
)
|
||||
.into(),
|
||||
attributes.into(),
|
||||
)
|
||||
}
|
||||
|
@ -1061,7 +1065,7 @@ mod tests {
|
|||
context.gc_context,
|
||||
Executable::Native(|_avm, _context, _this, _args| Ok("Virtual!".into())),
|
||||
None,
|
||||
None,
|
||||
activation.avm.prototypes.function,
|
||||
);
|
||||
|
||||
object.as_script_object().unwrap().add_property(
|
||||
|
@ -1095,7 +1099,7 @@ mod tests {
|
|||
context.gc_context,
|
||||
Executable::Native(|_avm, _context, _this, _args| Ok("Virtual!".into())),
|
||||
None,
|
||||
None,
|
||||
activation.avm.prototypes.function,
|
||||
);
|
||||
|
||||
object.as_script_object().unwrap().add_property(
|
||||
|
@ -1172,7 +1176,7 @@ mod tests {
|
|||
context.gc_context,
|
||||
Executable::Native(|_avm, _context, _this, _args| Ok(Value::Null)),
|
||||
None,
|
||||
None,
|
||||
activation.avm.prototypes.function,
|
||||
);
|
||||
|
||||
object.as_script_object().unwrap().define_value(
|
||||
|
|
|
@ -633,7 +633,7 @@ mod test {
|
|||
context.gc_context,
|
||||
Executable::Native(value_of_impl),
|
||||
Some(protos.function),
|
||||
None,
|
||||
protos.function,
|
||||
);
|
||||
|
||||
let o = ScriptObject::object_cell(context.gc_context, Some(protos.object));
|
||||
|
|
Loading…
Reference in New Issue