Skip to content

Commit ac4d74b

Browse files
Bale001Aaron1011
authored andcommitted
core: Use applicationDomain specified in context if available
1 parent 7e50183 commit ac4d74b

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

core/src/loader.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,12 +1346,13 @@ impl<'gc> Loader<'gc> {
13461346
}
13471347
}
13481348
player.lock().unwrap().update(|uc| {
1349-
let (clip, event_handler) = match uc.load_manager.get_loader(handle) {
1349+
let (clip, event_handler, context) = match uc.load_manager.get_loader(handle) {
13501350
Some(Loader::Movie {
13511351
target_clip,
13521352
event_handler,
1353+
context,
13531354
..
1354-
}) => (*target_clip, *event_handler),
1355+
}) => (*target_clip, *event_handler, *context),
13551356
None => return Err(Error::Cancelled),
13561357
_ => unreachable!(),
13571358
};
@@ -1396,8 +1397,20 @@ impl<'gc> Loader<'gc> {
13961397
}
13971398

13981399
let mut activation = Avm2Activation::from_nothing(uc.reborrow());
1399-
let parent_domain = activation.avm2().global_domain();
1400-
let domain = Avm2Domain::movie_domain(&mut activation, parent_domain);
1400+
let domain = context
1401+
.and_then(|o| {
1402+
o.get_property(
1403+
&Avm2Multiname::public("applicationDomain"),
1404+
&mut activation,
1405+
)
1406+
.ok()
1407+
})
1408+
.and_then(|v| v.coerce_to_object(&mut activation).ok())
1409+
.and_then(|o| o.as_application_domain())
1410+
.unwrap_or_else(|| {
1411+
let parent_domain = activation.avm2().global_domain();
1412+
Avm2Domain::movie_domain(&mut activation, parent_domain)
1413+
});
14011414
activation
14021415
.context
14031416
.library

0 commit comments

Comments
 (0)