tests: Add avm2/sandbox_type_remote test

Verifies the sandbox type of SWFs loaded through network.
This commit is contained in:
Kamil Jarosz 2024-09-03 12:53:58 +02:00
parent f77dddb6f5
commit acdb355918
8 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,24 @@
package {
import flash.display.MovieClip;
import flash.display.Loader;
import flash.system.Security;
import flash.net.URLRequest;
// Compile with network enabled
public class Test extends MovieClip {
public function Test() {
trace("Current sandbox type: " + Security.sandboxType);
var test:Test = this;
test.loadSwf("http://localhost:8000/test-network.swf", function():void {
test.loadSwf("http://localhost:8000/test-no-network.swf", function():void {});
});
}
private function loadSwf(url:String, callback:Function):void {
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener("complete", callback);
loader.load(new URLRequest(url));
}
}
}

View File

@ -0,0 +1,11 @@
package {
import flash.display.Sprite;
import flash.system.Security;
// Compile with network enabled as localhost/test-network.swf
public class TestNetwork extends Sprite {
public function TestNetwork() {
trace("[Network] Current sandbox type: " + Security.sandboxType);
}
}
}

View File

@ -0,0 +1,11 @@
package {
import flash.display.Sprite;
import flash.system.Security;
// Compile with network disabled as localhost/test-no-network.swf
public class TestNoNetwork extends Sprite {
public function TestNoNetwork() {
trace("[No network] Current sandbox type: " + Security.sandboxType);
}
}
}

View File

@ -0,0 +1,3 @@
Current sandbox type: localWithNetwork
[Network] Current sandbox type: remote
[No network] Current sandbox type: remote

Binary file not shown.

View File

@ -0,0 +1 @@
num_ticks = 2