зеркало из https://github.com/mozilla/pjs.git
setAdapterProto: now splices in wrapper's prototype, rather than replacing object's original prototype chain. seems to work fine.
This commit is contained in:
Родитель
6708def373
Коммит
d06b137123
|
@ -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,
|
||||
|
|
Загрузка…
Ссылка в новой задаче