зеркало из https://github.com/mozilla/pjs.git
Add ConversionError and make it work for undefined.foo.
This commit is contained in:
Родитель
bf8cbd877b
Коммит
eadef0d104
|
@ -79,7 +79,8 @@ public class NativeGlobal {
|
|||
global.defineProperty("undefined", Undefined.instance,
|
||||
ScriptableObject.DONTENUM);
|
||||
|
||||
String[] errorMethods = { "EvalError",
|
||||
String[] errorMethods = { "ConversionError",
|
||||
"EvalError",
|
||||
"RangeError",
|
||||
"ReferenceError",
|
||||
"SyntaxError",
|
||||
|
|
|
@ -766,10 +766,12 @@ public class ScriptRuntime {
|
|||
catch (ClassCastException e) {
|
||||
start = toObject(scope, obj);
|
||||
}
|
||||
if (start == null) {
|
||||
if (start == null || start == Undefined.instance) {
|
||||
String msg = start == null ? "msg.null.to.object"
|
||||
: "msg.undefined";
|
||||
throw NativeGlobal.constructError(
|
||||
Context.getContext(), "TypeError",
|
||||
ScriptRuntime.getMessage("msg.null.to.object", null),
|
||||
Context.getContext(), "ConversionError",
|
||||
ScriptRuntime.getMessage(msg, null),
|
||||
scope);
|
||||
}
|
||||
Scriptable m = start;
|
||||
|
|
|
@ -79,7 +79,8 @@ public class NativeGlobal {
|
|||
global.defineProperty("undefined", Undefined.instance,
|
||||
ScriptableObject.DONTENUM);
|
||||
|
||||
String[] errorMethods = { "EvalError",
|
||||
String[] errorMethods = { "ConversionError",
|
||||
"EvalError",
|
||||
"RangeError",
|
||||
"ReferenceError",
|
||||
"SyntaxError",
|
||||
|
|
|
@ -766,10 +766,12 @@ public class ScriptRuntime {
|
|||
catch (ClassCastException e) {
|
||||
start = toObject(scope, obj);
|
||||
}
|
||||
if (start == null) {
|
||||
if (start == null || start == Undefined.instance) {
|
||||
String msg = start == null ? "msg.null.to.object"
|
||||
: "msg.undefined";
|
||||
throw NativeGlobal.constructError(
|
||||
Context.getContext(), "TypeError",
|
||||
ScriptRuntime.getMessage("msg.null.to.object", null),
|
||||
Context.getContext(), "ConversionError",
|
||||
ScriptRuntime.getMessage(msg, null),
|
||||
scope);
|
||||
}
|
||||
Scriptable m = start;
|
||||
|
|
Загрузка…
Ссылка в новой задаче