Skip to content

Commit 8b9bae8

Browse files
Bale001Aaron1011
authored andcommitted
tests: Add test for LoaderContext.applicationDomain
1 parent ac4d74b commit 8b9bae8

File tree

6 files changed

+44
-0
lines changed

6 files changed

+44
-0
lines changed

tests/tests/regression_tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ swf_tests! {
389389
(as3_lazyinit, "avm2/lazyinit", 1),
390390
(as3_lessequals, "avm2/lessequals", 1),
391391
(as3_lessthan, "avm2/lessthan", 1),
392+
(as3_loader_applicationdomain, "avm2/loader_applicationDomain", 2),
392393
(as3_loader_events, "avm2/loader_events", 3, img = true),
393394
(as3_loader_loadbytes_events, "avm2/loader_loadbytes_events", 3, img = true),
394395
(as3_loaderinfo_events, "avm2/loaderinfo_events", 2),
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package {
2+
import flash.net.*;
3+
import flash.display.Loader;
4+
import flash.system.LoaderContext;
5+
import flash.system.ApplicationDomain;
6+
import flash.utils.ByteArray;
7+
import flash.utils.getDefinitionByName;
8+
public class Test {
9+
10+
public function Test(s) {
11+
var myURLReq: URLRequest = new URLRequest();
12+
myURLReq.url = "framework_4.5.0.20967.swz";
13+
myURLReq.digest = "9f67b1c289a5b5db7b32844af679e758541d101b46a7f75672258953804971ff";
14+
var myURLLoader: URLLoader = new URLLoader();
15+
myURLLoader.dataFormat = URLLoaderDataFormat.BINARY;
16+
myURLLoader.addEventListener("complete", onC);
17+
18+
myURLLoader.load(myURLReq);
19+
20+
function onC(e) {
21+
var someLoader:Loader = new Loader();
22+
var context: LoaderContext = new LoaderContext();
23+
context.applicationDomain = ApplicationDomain.currentDomain;
24+
s.addChild(someLoader);
25+
someLoader.loadBytes((ByteArray)(myURLLoader.data), context);
26+
someLoader.contentLoaderInfo.addEventListener("init", init);
27+
}
28+
29+
function init(e) {
30+
// verify that the classes loaded from the SWZ is now in our current domain.
31+
trace(getDefinitionByName("mx.events.PropertyChangeEvent"));
32+
trace(getDefinitionByName("mx.core.ByteArrayAsset"));
33+
trace(getDefinitionByName("Test"));
34+
}
35+
36+
}
37+
38+
}
39+
40+
}
Binary file not shown.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[class PropertyChangeEvent]
2+
[class ByteArrayAsset]
3+
[class Test]
3.86 KB
Binary file not shown.
1.28 KB
Binary file not shown.

0 commit comments

Comments
 (0)