Allow null returns from SecuritySupport methods if someone only

wants to implement LiveConnect filtering
This commit is contained in:
nboyd%atg.com 2000-09-29 13:49:47 +00:00
Родитель 3e5ae4d5dc
Коммит d52574f9e0
6 изменённых файлов: 50 добавлений и 42 удалений

Просмотреть файл

@ -1754,6 +1754,7 @@ public final class Context {
Object result = null;
if (securitySupport != null) {
Class[] classes = securitySupport.getClassContext();
if (classes != null) {
if (depth != -1) {
int depth1 = depth + 1;
result = getSecurityDomainFromClass(classes[depth1]);
@ -1765,6 +1766,7 @@ public final class Context {
}
}
}
}
if (result != null)
return result;
if (requireSecurityDomain)

Просмотреть файл

@ -283,17 +283,18 @@ public class JavaAdapter extends ScriptableObject {
SecuritySupport ss = cx.getSecuritySupport();
if (ss != null) {
Object securityDomain = cx.getSecurityDomainForStackDepth(-1);
return ss.defineClass(adapterName, bytes, securityDomain);
} else {
Class result = ss.defineClass(adapterName, bytes, securityDomain);
if (result != null)
return result;
}
if (classLoader == null)
classLoader = new MyClassLoader();
classLoader.defineClass(adapterName, bytes);
return classLoader.loadClass(adapterName, true);
}
}
/**
* Utility method, which dynamically binds a Context to the current thread,
* Utility method which dynamically binds a Context to the current thread,
* if none already exists.
*/
public static Object callMethod(Scriptable object, Object thisObj,

Просмотреть файл

@ -118,17 +118,18 @@ public class Codegen extends Interpreter {
}
}
try {
Class clazz;
if (securitySupport == null) {
Class clazz = null;
if (securitySupport != null) {
clazz = securitySupport.defineClass(name, classFile,
securityDomain);
}
if (clazz == null) {
Context.checkSecurityDomainRequired();
if (classLoader == null)
classLoader = new JavaScriptClassLoader();
clazz = classLoader.defineClass(name, classFile);
ClassLoader loader = clazz.getClassLoader();
clazz = loader.loadClass(name);
} else {
clazz = securitySupport.defineClass(name, classFile,
securityDomain);
}
if (name.equals(generatedName))
result = clazz;

Просмотреть файл

@ -1754,6 +1754,7 @@ public final class Context {
Object result = null;
if (securitySupport != null) {
Class[] classes = securitySupport.getClassContext();
if (classes != null) {
if (depth != -1) {
int depth1 = depth + 1;
result = getSecurityDomainFromClass(classes[depth1]);
@ -1765,6 +1766,7 @@ public final class Context {
}
}
}
}
if (result != null)
return result;
if (requireSecurityDomain)

Просмотреть файл

@ -283,17 +283,18 @@ public class JavaAdapter extends ScriptableObject {
SecuritySupport ss = cx.getSecuritySupport();
if (ss != null) {
Object securityDomain = cx.getSecurityDomainForStackDepth(-1);
return ss.defineClass(adapterName, bytes, securityDomain);
} else {
Class result = ss.defineClass(adapterName, bytes, securityDomain);
if (result != null)
return result;
}
if (classLoader == null)
classLoader = new MyClassLoader();
classLoader.defineClass(adapterName, bytes);
return classLoader.loadClass(adapterName, true);
}
}
/**
* Utility method, which dynamically binds a Context to the current thread,
* Utility method which dynamically binds a Context to the current thread,
* if none already exists.
*/
public static Object callMethod(Scriptable object, Object thisObj,

Просмотреть файл

@ -118,17 +118,18 @@ public class Codegen extends Interpreter {
}
}
try {
Class clazz;
if (securitySupport == null) {
Class clazz = null;
if (securitySupport != null) {
clazz = securitySupport.defineClass(name, classFile,
securityDomain);
}
if (clazz == null) {
Context.checkSecurityDomainRequired();
if (classLoader == null)
classLoader = new JavaScriptClassLoader();
clazz = classLoader.defineClass(name, classFile);
ClassLoader loader = clazz.getClassLoader();
clazz = loader.loadClass(name);
} else {
clazz = securitySupport.defineClass(name, classFile,
securityDomain);
}
if (name.equals(generatedName))
result = clazz;