It's a security error to specify a non-null SecurityDomain to Loader
when in a local sandbox. Annoying. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@270 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -49,6 +49,7 @@ import flash.text.TextFieldAutoSize;
|
|||||||
|
|
||||||
import flash.system.ApplicationDomain;
|
import flash.system.ApplicationDomain;
|
||||||
import flash.system.LoaderContext;
|
import flash.system.LoaderContext;
|
||||||
|
import flash.system.Security;
|
||||||
import flash.system.SecurityDomain;
|
import flash.system.SecurityDomain;
|
||||||
|
|
||||||
import flash.net.URLRequest;
|
import flash.net.URLRequest;
|
||||||
@@ -428,7 +429,7 @@ public class MediaContainer extends Sprite
|
|||||||
// load images into our domain so that we can view their pixels
|
// load images into our domain so that we can view their pixels
|
||||||
return new LoaderContext(true,
|
return new LoaderContext(true,
|
||||||
new ApplicationDomain(ApplicationDomain.currentDomain),
|
new ApplicationDomain(ApplicationDomain.currentDomain),
|
||||||
SecurityDomain.currentDomain);
|
getSecurityDomain(url));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// share nothing, trust nothing
|
// share nothing, trust nothing
|
||||||
@@ -436,6 +437,22 @@ public class MediaContainer extends Sprite
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the security domain to use for the specified image url.
|
||||||
|
*/
|
||||||
|
protected function getSecurityDomain (imageURL :String) :SecurityDomain
|
||||||
|
{
|
||||||
|
switch (Security.sandboxType) {
|
||||||
|
case Security.LOCAL_WITH_FILE:
|
||||||
|
case Security.LOCAL_WITH_NETWORK:
|
||||||
|
case Security.LOCAL_TRUSTED:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return SecurityDomain.currentDomain;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the specified url represent an image?
|
* Does the specified url represent an image?
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user