Remove reference to parent scope for Java methods. This was resulting in dangling

references that were never released to a large pool of objects.
This commit is contained in:
norris%netscape.com 2000-02-29 17:27:56 +00:00
Родитель 6a76191c91
Коммит fc2ff1cb84
4 изменённых файлов: 0 добавлений и 26 удалений

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

@ -161,7 +161,6 @@ class JavaMembers {
if (methodOrCtor instanceof Constructor) {
NativeJavaConstructor fun =
new NativeJavaConstructor((Constructor)methodOrCtor);
fun.setParentScope(scope);
fun.setPrototype(prototype);
member = fun;
ht.put(name, fun);
@ -173,7 +172,6 @@ class JavaMembers {
((NativeJavaMethod)member).getMethods().length > 1 ) {
NativeJavaMethod fun =
new NativeJavaMethod((Method)methodOrCtor, name);
fun.setParentScope(scope);
fun.setPrototype(prototype);
ht.put(name, fun);
member = fun;
@ -273,7 +271,6 @@ class JavaMembers {
FieldAndMethods fam = new FieldAndMethods(method.getMethods(),
field,
null);
fam.setParentScope(scope);
fam.setPrototype(ScriptableObject.getFunctionPrototype(scope));
getFieldAndMethodsTable(isStatic).put(name, fam);
ht.put(name, fam);
@ -305,7 +302,6 @@ class JavaMembers {
NativeJavaMethod fun = (NativeJavaMethod) ht.get(name);
if (fun == null) {
fun = new NativeJavaMethod();
fun.setParentScope(scope);
fun.setPrototype(ScriptableObject.getFunctionPrototype(scope));
ht.put(name, fun);
fun.add(method);
@ -480,7 +476,6 @@ class JavaMembers {
FieldAndMethods fam = (FieldAndMethods) e.nextElement();
fam = (FieldAndMethods) fam.clone();
fam.setJavaObject(javaObject);
fam.setParentScope(scope);
result.put(fam.getName(), fam);
}
return result;

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

@ -220,18 +220,10 @@ public class NativeJavaMethod extends NativeFunction implements Function {
" class = " + actualType);
}
// XXX set prototype && parent
if (wrapped == Undefined.instance)
return wrapped;
if (wrapped == null && staticType == Void.TYPE)
return Undefined.instance;
if (retval != wrapped && wrapped instanceof Scriptable) {
Scriptable s = (Scriptable)wrapped;
if (s.getPrototype() == null)
s.setPrototype(parent.getPrototype());
if (s.getParentScope() == null)
s.setParentScope(parent.getParentScope());
}
return wrapped;
} catch (IllegalAccessException accessEx) {
throw Context.reportRuntimeError(accessEx.getMessage());

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

@ -161,7 +161,6 @@ class JavaMembers {
if (methodOrCtor instanceof Constructor) {
NativeJavaConstructor fun =
new NativeJavaConstructor((Constructor)methodOrCtor);
fun.setParentScope(scope);
fun.setPrototype(prototype);
member = fun;
ht.put(name, fun);
@ -173,7 +172,6 @@ class JavaMembers {
((NativeJavaMethod)member).getMethods().length > 1 ) {
NativeJavaMethod fun =
new NativeJavaMethod((Method)methodOrCtor, name);
fun.setParentScope(scope);
fun.setPrototype(prototype);
ht.put(name, fun);
member = fun;
@ -273,7 +271,6 @@ class JavaMembers {
FieldAndMethods fam = new FieldAndMethods(method.getMethods(),
field,
null);
fam.setParentScope(scope);
fam.setPrototype(ScriptableObject.getFunctionPrototype(scope));
getFieldAndMethodsTable(isStatic).put(name, fam);
ht.put(name, fam);
@ -305,7 +302,6 @@ class JavaMembers {
NativeJavaMethod fun = (NativeJavaMethod) ht.get(name);
if (fun == null) {
fun = new NativeJavaMethod();
fun.setParentScope(scope);
fun.setPrototype(ScriptableObject.getFunctionPrototype(scope));
ht.put(name, fun);
fun.add(method);
@ -480,7 +476,6 @@ class JavaMembers {
FieldAndMethods fam = (FieldAndMethods) e.nextElement();
fam = (FieldAndMethods) fam.clone();
fam.setJavaObject(javaObject);
fam.setParentScope(scope);
result.put(fam.getName(), fam);
}
return result;

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

@ -220,18 +220,10 @@ public class NativeJavaMethod extends NativeFunction implements Function {
" class = " + actualType);
}
// XXX set prototype && parent
if (wrapped == Undefined.instance)
return wrapped;
if (wrapped == null && staticType == Void.TYPE)
return Undefined.instance;
if (retval != wrapped && wrapped instanceof Scriptable) {
Scriptable s = (Scriptable)wrapped;
if (s.getPrototype() == null)
s.setPrototype(parent.getPrototype());
if (s.getParentScope() == null)
s.setParentScope(parent.getParentScope());
}
return wrapped;
} catch (IllegalAccessException accessEx) {
throw Context.reportRuntimeError(accessEx.getMessage());