Load images into our own security domain so that we can examine their

pixels.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4449 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-11-10 23:45:05 +00:00
parent 6dddf9c234
commit ff951383c3
+26 -6
View File
@@ -317,13 +317,33 @@ public class MediaContainer extends Box
*/
protected function getContext (url :String) :LoaderContext
{
// // We allow content to share but not overwrite our classes
// return new LoaderContext(true,
// new ApplicationDomain(ApplicationDomain.currentDomain),
// SecurityDomain.currentDomain);
if (isImage(url)) {
// load images into our domain so that we can view their pixels
return new LoaderContext(true,
new ApplicationDomain(ApplicationDomain.currentDomain),
SecurityDomain.currentDomain);
// share nothing, trust nothing
return new LoaderContext(false, null, null);
} else {
// share nothing, trust nothing
return new LoaderContext(false, null, null);
}
}
/**
* Does the specified url represent an image?
*/
protected function isImage (url :String) :Boolean
{
// look at the last 4 characters in the lowercased url
switch (url.toLowerCase().slice(-4)) {
case ".png":
case ".jpg":
case ".gif":
return true;
default:
return false;
}
}
/**