added a prototype field, so that a wrapped JavaAdapter can preserve the delegate object's original prototype chain.

This commit is contained in:
beard%netscape.com 1999-09-24 16:52:23 +00:00
parent 24a3e9d1a9
commit 5185946b51
2 changed files with 24 additions and 6 deletions

View File

@ -97,13 +97,17 @@ public class NativeJavaObject implements Scriptable, Wrapper {
}
public Scriptable getPrototype() {
if (javaObject.getClass() == ScriptRuntime.StringClass) {
if (prototype == null && javaObject.getClass() == ScriptRuntime.StringClass) {
return ScriptableObject.getClassPrototype(parent, "String");
}
return null;
return prototype;
}
public void setPrototype(Scriptable prototype) {
/**
* Sets the prototype of the object.
*/
public void setPrototype(Scriptable m) {
prototype = m;
}
/**
@ -863,6 +867,11 @@ public class NativeJavaObject implements Scriptable, Wrapper {
}
}
/**
* The prototype of this object.
*/
protected Scriptable prototype;
/**
* The parent scope of this object.
*/

View File

@ -97,13 +97,17 @@ public class NativeJavaObject implements Scriptable, Wrapper {
}
public Scriptable getPrototype() {
if (javaObject.getClass() == ScriptRuntime.StringClass) {
if (prototype == null && javaObject.getClass() == ScriptRuntime.StringClass) {
return ScriptableObject.getClassPrototype(parent, "String");
}
return null;
return prototype;
}
public void setPrototype(Scriptable prototype) {
/**
* Sets the prototype of the object.
*/
public void setPrototype(Scriptable m) {
prototype = m;
}
/**
@ -863,6 +867,11 @@ public class NativeJavaObject implements Scriptable, Wrapper {
}
}
/**
* The prototype of this object.
*/
protected Scriptable prototype;
/**
* The parent scope of this object.
*/