Fix ecma_2/Exceptions/exception-006.js

This commit is contained in:
norris%netscape.com 1999-12-03 23:32:46 +00:00
parent 589bd0d760
commit db8bea4b84
4 changed files with 20 additions and 12 deletions

View File

@ -60,11 +60,13 @@ public class NativeError extends ScriptableObject {
}
public String getName() {
return ScriptRuntime.toString(ScriptRuntime.getProp(this, "name", this));
return ScriptRuntime.toString(
ScriptRuntime.getProp(this, "name", this));
}
public String getMessage() {
return ScriptRuntime.toString(ScriptRuntime.getProp(this, "message", this));
return ScriptRuntime.toString(
ScriptRuntime.getProp(this, "message", this));
}
public static void finishInit(Scriptable scope, FunctionObject ctor,
@ -72,9 +74,9 @@ public class NativeError extends ScriptableObject {
throws PropertyException
{
((ScriptableObject) proto).defineProperty("message", "",
ScriptableObject.EMPTY);
ScriptableObject.EMPTY);
((ScriptableObject) proto).defineProperty("name", "Error",
ScriptableObject.EMPTY);
ScriptableObject.EMPTY);
}
}

View File

@ -587,8 +587,10 @@ public abstract class ScriptableObject implements Scriptable {
}
Object arg = typeHint == null ? "undefined" : typeHint.toString();
Object[] args = { arg };
throw Context.reportRuntimeError(Context.getMessage
("msg.default.value", args));
throw NativeGlobal.constructError(
Context.getContext(), "TypeError",
ScriptRuntime.getMessage("msg.default.value", args),
this);
}
/**

View File

@ -60,11 +60,13 @@ public class NativeError extends ScriptableObject {
}
public String getName() {
return ScriptRuntime.toString(ScriptRuntime.getProp(this, "name", this));
return ScriptRuntime.toString(
ScriptRuntime.getProp(this, "name", this));
}
public String getMessage() {
return ScriptRuntime.toString(ScriptRuntime.getProp(this, "message", this));
return ScriptRuntime.toString(
ScriptRuntime.getProp(this, "message", this));
}
public static void finishInit(Scriptable scope, FunctionObject ctor,
@ -72,9 +74,9 @@ public class NativeError extends ScriptableObject {
throws PropertyException
{
((ScriptableObject) proto).defineProperty("message", "",
ScriptableObject.EMPTY);
ScriptableObject.EMPTY);
((ScriptableObject) proto).defineProperty("name", "Error",
ScriptableObject.EMPTY);
ScriptableObject.EMPTY);
}
}

View File

@ -587,8 +587,10 @@ public abstract class ScriptableObject implements Scriptable {
}
Object arg = typeHint == null ? "undefined" : typeHint.toString();
Object[] args = { arg };
throw Context.reportRuntimeError(Context.getMessage
("msg.default.value", args));
throw NativeGlobal.constructError(
Context.getContext(), "TypeError",
ScriptRuntime.getMessage("msg.default.value", args),
this);
}
/**