avm1: Returning from with{} should return from the parent activation

This commit is contained in:
Nathan Adams 2020-07-02 00:24:18 +02:00 committed by Mike Welsh
parent 4b4370b90d
commit d1732dd3d6
5 changed files with 8 additions and 2 deletions

View File

@ -2241,9 +2241,12 @@ impl<'a, 'gc: 'a> Activation<'a, 'gc> {
let object = self.avm.pop().coerce_to_object(self, context);
let with_scope = Scope::new_with_scope(self.scope_cell(), object, context.gc_context);
let mut new_activation = self.with_new_scope(with_scope);
let _ = new_activation.run_actions(context, code)?;
if let ReturnType::Explicit(value) = new_activation.run_actions(context, code)? {
Ok(FrameControl::Return(ReturnType::Explicit(value)))
} else {
Ok(FrameControl::Continue)
}
}
/// Retrieve a given register value.
///

View File

@ -189,6 +189,7 @@ swf_tests! {
(loadvariablesnum, "avm1/loadvariablesnum", 3),
(loadvariables_method, "avm1/loadvariables_method", 3),
(xml_load, "avm1/xml_load", 1),
(with_return, "avm1/with_return", 1),
(cross_movie_root, "avm1/cross_movie_root", 5),
(roots_and_levels, "avm1/roots_and_levels", 1),
(swf6_case_insensitive, "avm1/swf6_case_insensitive", 1),

View File

@ -0,0 +1,2 @@
// test()
Success!

Binary file not shown.

Binary file not shown.