mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
added a prototype field, so that a wrapped JavaAdapter can preserve the delegate object's original prototype chain.
This commit is contained in:
parent
24a3e9d1a9
commit
5185946b51
@ -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.
|
||||
*/
|
||||
|
@ -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.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user