mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-31 19:10:36 +00:00
setAdapterProto: now splices in wrapper's prototype, rather than replacing object's original prototype chain. seems to work fine.
This commit is contained in:
parent
0d650e898c
commit
24a3e9d1a9
@ -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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
Scriptable wrapped = (Scriptable) Context.toObject(adapter, scope);
|
||||
obj.setPrototype(wrapped);
|
||||
wrapped.setPrototype(oldProto);
|
||||
}
|
||||
|
||||
public static Scriptable initVarObj(Context cx, Scriptable scope,
|
||||
|
Loading…
x
Reference in New Issue
Block a user