This commit is contained in:
norris%netscape.com 2000-04-20 23:08:07 +00:00
Родитель e02cdc0d7c
Коммит 0bca489fe4
2 изменённых файлов: 26 добавлений и 16 удалений

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

@ -148,7 +148,7 @@ public class NativeObject extends ScriptableObject {
Function funObj)
{
if (args.length != 0)
if (thisObj.has(ScriptRuntime.toString(args[0]), null))
if (thisObj.has(ScriptRuntime.toString(args[0]), thisObj))
return Boolean.TRUE;
return Boolean.FALSE;
}
@ -161,10 +161,11 @@ public class NativeObject extends ScriptableObject {
try {
if (args.length != 0) {
String name = ScriptRuntime.toString(args[0]);
if (thisObj.has(name, null))
if ((((ScriptableObject)thisObj).getAttributes(name, null)
& ScriptableObject.DONTENUM) == 0)
if (thisObj.has(name, thisObj)) {
int a = ((ScriptableObject)thisObj).getAttributes(name, thisObj);
if ((a & ScriptableObject.DONTENUM) == 0)
return Boolean.TRUE;
}
}
}
catch (PropertyException x) {
@ -177,10 +178,14 @@ public class NativeObject extends ScriptableObject {
public static Object jsFunction_isPrototypeOf(Context cx, Scriptable thisObj,
Object[] args, Function funObj)
{
if (args.length != 0)
if (args[0] instanceof Scriptable)
if (thisObj == ((Scriptable)args[0]).getPrototype())
return Boolean.TRUE;
if (args.length != 0 && args[0] instanceof Scriptable) {
Scriptable v = (Scriptable) args[0];
do {
v = v.getPrototype();
if (v == thisObj)
return Boolean.TRUE;
} while (v != null);
}
return Boolean.FALSE;
}
}

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

@ -148,7 +148,7 @@ public class NativeObject extends ScriptableObject {
Function funObj)
{
if (args.length != 0)
if (thisObj.has(ScriptRuntime.toString(args[0]), null))
if (thisObj.has(ScriptRuntime.toString(args[0]), thisObj))
return Boolean.TRUE;
return Boolean.FALSE;
}
@ -161,10 +161,11 @@ public class NativeObject extends ScriptableObject {
try {
if (args.length != 0) {
String name = ScriptRuntime.toString(args[0]);
if (thisObj.has(name, null))
if ((((ScriptableObject)thisObj).getAttributes(name, null)
& ScriptableObject.DONTENUM) == 0)
if (thisObj.has(name, thisObj)) {
int a = ((ScriptableObject)thisObj).getAttributes(name, thisObj);
if ((a & ScriptableObject.DONTENUM) == 0)
return Boolean.TRUE;
}
}
}
catch (PropertyException x) {
@ -177,10 +178,14 @@ public class NativeObject extends ScriptableObject {
public static Object jsFunction_isPrototypeOf(Context cx, Scriptable thisObj,
Object[] args, Function funObj)
{
if (args.length != 0)
if (args[0] instanceof Scriptable)
if (thisObj == ((Scriptable)args[0]).getPrototype())
return Boolean.TRUE;
if (args.length != 0 && args[0] instanceof Scriptable) {
Scriptable v = (Scriptable) args[0];
do {
v = v.getPrototype();
if (v == thisObj)
return Boolean.TRUE;
} while (v != null);
}
return Boolean.FALSE;
}
}