@@ -9,6 +9,7 @@ use crate::avm2::traits::Trait;
99use crate :: avm2:: value:: Value ;
1010use crate :: avm2:: vtable:: VTable ;
1111use crate :: avm2:: { Avm2 , Error , Multiname , Namespace , QName } ;
12+ use crate :: string:: WStr ;
1213use crate :: tag_utils:: { self , ControlFlow , SwfMovie , SwfSlice , SwfStream } ;
1314use gc_arena:: Collect ;
1415use std:: sync:: Arc ;
@@ -812,9 +813,16 @@ macro_rules! avm2_system_classes_playerglobal {
812813 ( $activation: expr, [ $( ( $package: expr, $class_name: expr, $field: ident) ) ,* $( , ) ?] ) => {
813814 let activation = $activation;
814815 $(
816+ // Package and class names are ASCII
817+ let package = WStr :: from_units( $package. as_bytes( ) ) ;
818+ let class_name = WStr :: from_units( $class_name. as_bytes( ) ) ;
819+
820+ let package = activation. strings( ) . intern_static( package) ;
821+ let class_name = activation. strings( ) . intern_static( class_name) ;
822+
815823 // Lookup with the highest version, so we we see all defined classes here
816- let ns = Namespace :: package( $ package, ApiVersion :: VM_INTERNAL , activation. strings( ) ) ;
817- let name = QName :: new( ns, $ class_name) ;
824+ let ns = Namespace :: package( package, ApiVersion :: VM_INTERNAL , activation. strings( ) ) ;
825+ let name = QName :: new( ns, class_name) ;
818826 let class_object = activation. domain( ) . get_defined_value( activation, name) . unwrap_or_else( |e| panic!( "Failed to lookup {name:?}: {e:?}" ) ) ;
819827 let class_object = class_object. as_object( ) . unwrap( ) . as_class_object( ) . unwrap( ) ;
820828 let sc = activation. avm2( ) . system_classes. as_mut( ) . unwrap( ) ;
@@ -827,11 +835,18 @@ macro_rules! avm2_system_class_defs_playerglobal {
827835 ( $activation: expr, [ $( ( $package: expr, $class_name: expr, $field: ident) ) ,* $( , ) ?] ) => {
828836 let activation = $activation;
829837 $(
838+ // Package and class names are ASCII
839+ let package = WStr :: from_units( $package. as_bytes( ) ) ;
840+ let class_name = WStr :: from_units( $class_name. as_bytes( ) ) ;
841+
842+ let package = activation. strings( ) . intern_static( package) ;
843+ let class_name = activation. strings( ) . intern_static( class_name) ;
844+
830845 let domain = activation. domain( ) ;
831846
832847 // Lookup with the highest version, so we we see all defined classes here
833- let ns = Namespace :: package( $ package, ApiVersion :: VM_INTERNAL , activation. strings( ) ) ;
834- let name = Multiname :: new( ns, $ class_name) ;
848+ let ns = Namespace :: package( package, ApiVersion :: VM_INTERNAL , activation. strings( ) ) ;
849+ let name = Multiname :: new( ns, class_name) ;
835850 let class_def = domain. get_class( activation. context, & name) . unwrap_or_else( || panic!( "Failed to lookup {name:?}" ) ) ;
836851 let sc = activation. avm2( ) . system_class_defs. as_mut( ) . unwrap( ) ;
837852 sc. $field = class_def;
0 commit comments