setAdapterProto: now splices in wrapper's prototype, rather than replacing object's original prototype chain. seems to work fine.

This commit is contained in:
beard%netscape.com 1999-09-24 16:51:25 +00:00
Родитель 6708def373
Коммит d06b137123
2 изменённых файлов: 8 добавлений и 10 удалений

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

@ -1928,12 +1928,11 @@ public class ScriptRuntime {
}
public static void setAdapterProto(Scriptable obj, Object adapter) {
Scriptable p = obj.getPrototype();
Scriptable oldProto = obj.getPrototype();
Scriptable scope = ScriptableObject.getTopLevelScope(obj);
if (p == null || p == ScriptableObject.getObjectPrototype(scope)) {
Scriptable wrapped = (Scriptable) Context.toObject(adapter, scope);
obj.setPrototype(wrapped);
}
wrapped.setPrototype(oldProto);
}
public static Scriptable initVarObj(Context cx, Scriptable scope,

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

@ -1928,12 +1928,11 @@ public class ScriptRuntime {
}
public static void setAdapterProto(Scriptable obj, Object adapter) {
Scriptable p = obj.getPrototype();
Scriptable oldProto = obj.getPrototype();
Scriptable scope = ScriptableObject.getTopLevelScope(obj);
if (p == null || p == ScriptableObject.getObjectPrototype(scope)) {
Scriptable wrapped = (Scriptable) Context.toObject(adapter, scope);
obj.setPrototype(wrapped);
}
wrapped.setPrototype(oldProto);
}
public static Scriptable initVarObj(Context cx, Scriptable scope,